Word count is off by one when text ends with a space

オープン
#1 コメント 1 件 リアクション 0 件 担当者 1 名 GitHub で見る

@accesswatch がすでに取り組んでいます。

2026年11月8日 から。

評価

この issue はまだ評価されていません。

説明

bug

What happened

word_count("hello world ") returns 3. There are only two words.

What I expected

  1. A space at the end of the text shouldn't count as a word.

How to see it

  1. Run python -c "import sys; sys.path.insert(0, 'src'); import tally; print(tally.word_count('hello world '))"
  2. It prints 3.

The same happens with two spaces between words.

主要言語
Python
スター
1
フォーク
0
PR マージ指標
30日以内にマージされた PR はありません

環境構築

はじめの一歩

  1. issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
  2. 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
  3. リポジトリをフォークし、ブランチを切って変更します。
  4. issue 番号を参照したプルリクエストを送ります。

Community-Access/quill-github-practice のほかの issue

Community-Access/quill-github-practice の issue をすべて見る

似ている issue

Python の issue をもっと見る

新しい issue をメールで受け取る

初心者向けの GitHub issue を短くまとめたダイジェスト。