単語・文字数カウンター
テキストの単語・文字・文・段落数をカウント。
0
単語数
0
文字数
0
文字数(スペース除く)
0
文の数
0
段落数
1
行数
約1分
読み時間
ワードカウンターはテキストを分析し、単語数、文字数(スペース含む/除く)、文数、段落数を即座に報告します。ツイート、大学志願エッセイ、学術誌投稿の単語制限、文字数制限のある広告コピーなど、特定の長さ制約内で作業するすべての人にとって必須のライティングツールです。
テキストを入力エリアに貼り付けるか入力すると、書いている間にカウントがリアルタイムで更新されます。ツールは平均的な成人の読書速度(1分あたり200〜250語)に基づいて読書時間も推定します。
単語数と文字数は数え方によって若干異なります。このツールはワードプロセッサで最も一般的に使用される規則に従います:連続した非空白文字が1単語を形成し、空白が単語を区切ります。
よくある質問
コード実装
def count_text(text: str) -> dict:
words = text.split()
chars_with_spaces = len(text)
chars_no_spaces = len(text.replace(" ", "").replace("\n", "").replace("\t", ""))
sentences = len([s for s in text.replace("!", ".").replace("?", ".").split(".") if s.strip()])
paragraphs = len([p for p in text.split("\n\n") if p.strip()])
reading_time_min = round(len(words) / 225, 1) # ~225 wpm average
return {
"words": len(words),
"chars_with_spaces": chars_with_spaces,
"chars_no_spaces": chars_no_spaces,
"sentences": sentences,
"paragraphs": paragraphs,
"reading_time_min": reading_time_min,
}
text = """Hello world. This is a sample paragraph.
This is the second paragraph with more words and sentences!"""
stats = count_text(text)
for key, value in stats.items():
print(f"{key}: {value}")Comments & Feedback
Comments are powered by Giscus. Sign in with GitHub to leave a comment.