360 Secure SkillHub
360 安全技能中心

Text Stats

读取文本文件或标准输入,统计词数、字符数、行数、句数、段落数、音节数、唯一词数、平均词句长度,估算阅读与朗读时间,并给出 Flesch 阅读难度、Flesch-Kincaid 年级和难度分级;支持 plain/json 及紧凑输出,可一次处理多个文件。

johnnywang2001
johnnywang2001
热度 79.52
最近更新 2026-05-11 17:34:24
分类:效率依赖:代码执行 / 读写文件应用场景:数据处理 / 校对润色 / 报告撰写

安装技能

复制下面的话术发给你的 Agent,它会通过 secure-skills 检索并安装该技能。

执行命令安装此 skill: npx secure-skills-cli add jrv-text-stats
Metadata
name
text-stats
description
Analyze text files for word count, character count, line count, sentence count, reading time, speaking time, readability scores (Flesch Reading Ease, Flesch-Kincaid Grade Level), and vocabulary statistics. Use when counting words, analyzing readability, estimating reading time, or getting text metrics for documents, essays, blog posts, or any text content.

Text Stats

Analyze text for word count, readability, reading time, and more. Reads files or stdin.

Quick Start

# Analyze a file
python3 scripts/text_stats.py README.md

# Multiple files
python3 scripts/text_stats.py file1.txt file2.txt

# From stdin
echo "The quick brown fox jumps over the lazy dog." | python3 scripts/text_stats.py

# JSON output
python3 scripts/text_stats.py essay.md -f json

# Compact (key metrics only)
python3 scripts/text_stats.py chapter.txt --compact

Output Metrics

Metric Description
Words Total word count
Characters Total characters (with and without spaces)
Lines Total and non-blank line count
Sentences / Paragraphs Count of each
Syllables Estimated syllable count
Unique Words Vocabulary diversity
Avg Word/Sentence Length Average sizes
Reading Time Estimated at 238 WPM
Speaking Time Estimated at 150 WPM
Flesch Reading Ease 0-100 scale (higher = easier)
Flesch-Kincaid Grade US grade level equivalent
Difficulty Easy / Standard / Fairly Difficult / Difficult / Very Difficult

Options

Flag Description
-f, --format plain or json output
--compact Show only words, sentences, reading time, grade, difficulty

Notes

  • No external dependencies (Python 3 stdlib only)
  • Handles UTF-8 text with graceful fallback for encoding errors
  • Syllable counting is heuristic-based (English-optimized)