Text Statistics: Word Count, Reading Time & Density

Why Do You Need Text Statistics?

Scenario Metrics Needed
SEO optimization Word Count, keyword density, readability
Content pricing Word Count, reading time
Academic papers Word Count (Chinese and English counted separately)
Social media Character count (280/2000 limits)
Translation quotes Word/character count

Differences Between Chinese and English Word Counting

The Core Problem: Chinese Has No Spaces for Word Segmentation

English: Hello World → 2 words (space-separated)
Chinese: 你好世界 → 4 characters (counted one by one) or 2 words (你好/世界)?

Three Counting Methods

Method Algorithm Result for "你好World" Use Case
Character count All characters 7 Social media limits
Character/Word Count Chinese by character, English by word 6 (4 chars + 2 words) Content pricing, SEO
Byte count UTF-8 encoded length 10 (4×3 + 2×1) Storage space

JavaScript Implementation

function countText(text: string) {
  // Remove zero-width characters
  const clean = text.replace(/[\u200B-\u200D\uFEFF]/g, '');

  // Character count
  const charCount = clean.replace(/\s/g, '').length;

  // Chinese character count
  const chineseChars = (clean.match(/[\u4e00-\u9fff]/g) || []).length;

  // English word count
  const englishWords = (clean.match(/[a-zA-Z]+/g) || []).length;

  // Number groups
  const numbers = (clean.match(/\d+/g) || []).length;

  // Total character/word count
  const wordCount = chineseChars + englishWords + numbers;

  // Byte count (UTF-8)
  const byteCount = new TextEncoder().encode(clean).length;

  // Line count
  const lineCount = clean.split(/\n/).filter(l => l.trim()).length;

  // Paragraph count
  const paragraphCount = clean.split(/\n\s*\n/).filter(p => p.trim()).length;

  return {
    charCount,
    wordCount,
    chineseChars,
    englishWords,
    numbers,
    byteCount,
    lineCount,
    paragraphCount,
  };
}

Reading Time Estimation

The Formula

Chinese reading speed: ~500 characters/minute
English reading speed: ~200-250 words/minute

Reading time = Chinese characters / 500 + English words / 225

Implementation

function estimateReadingTime(text: string) {
  const chineseChars = (text.match(/[\u4e00-\u9fff]/g) || []).length;
  const englishWords = (text.match(/[a-zA-Z]+/g) || []).length;

  const minutes = chineseChars / 500 + englishWords / 225;

  if (minutes < 1) return 'Less than 1 minute';
  if (minutes < 60) return `About ${Math.ceil(minutes)} minutes`;
  const hours = Math.floor(minutes / 60);
  const mins = Math.ceil(minutes % 60);
  return `About ${hours} hours ${mins} minutes`;
}

Reading Speeds by Content Type

Content Type Chinese Speed English Speed
Novels/essays 500-700 chars/min 250-300 words/min
Technical docs 300-400 chars/min 150-200 words/min
Legal documents 200-300 chars/min 100-150 words/min
Social media 600-800 chars/min 300+ words/min

Keyword Density Analysis

What Is Keyword Density?

Keyword density = keyword occurrences / total words × 100%

Example:
Total words: 500
"frontend" appears 15 times
Density = 15 / 500 × 100% = 3%
Density Evaluation
< 1% Too low — search engines may not take notice
1-3% ✅ Optimal range
3-5% On the high side — keep it natural
> 5% ❌ Keyword stuffing — may be penalized

Implementation

function analyzeKeywordDensity(text: string, keyword: string) {
  const regex = new RegExp(keyword, 'gi');
  const occurrences = (text.match(regex) || []).length;

  const chineseChars = (text.match(/[\u4e00-\u9fff]/g) || []).length;
  const englishWords = (text.match(/[a-zA-Z]+/g) || []).length;
  const totalWords = chineseChars + englishWords;

  const density = (occurrences / totalWords) * 100;

  return {
    keyword,
    occurrences,
    totalWords,
    density: density.toFixed(2) + '%',
    evaluation: density < 1 ? 'Too low' : density <= 3 ? 'Optimal' : density <= 5 ? 'High' : 'Stuffing',
  };
}

Text Readability Scoring

Flesch Reading Ease (English)

Score = 206.835 - 1.015 × (total words / total sentences) - 84.6 × (total syllables / total words)

Score interpretation:
90-100  Very easy (5th grade)
60-70   Standard (8th-9th grade)
30-50   Difficult (college)
0-30    Very difficult (professional/academic)

Chinese Readability

Chinese has no concept of syllables, so average sentence length is commonly used:

function chineseReadability(text: string) {
  const sentences = text.split(/[。!?;\n]/).filter(s => s.trim());
  const chineseChars = (text.match(/[\u4e00-\u9fff]/g) || []).length;

  const avgSentenceLength = chineseChars / sentences.length;

  if (avgSentenceLength <= 15) return { score: 'Easy', level: 'General audience' };
  if (avgSentenceLength <= 25) return { score: 'Moderate', level: 'Standard' };
  if (avgSentenceLength <= 40) return { score: 'Hard', level: 'Professional' };
  return { score: 'Very hard', level: 'Academic' };
}

Counting Text with the Toolbox

  1. Open the Word Counter Tool
  2. Paste or type your text
  3. Automatically displays: character count, character/Word Count, line count, paragraph count, reading time
  4. Supports mixed Chinese-English statistics

SEO Copy Optimization in Practice

1. Title Length

// Google displays about 60 characters (roughly 30 Chinese characters)
function checkTitle(title: string) {
  const length = title.length;
  return {
    length,
    status: length <= 60 ? '✅' : '❌ Over 60 characters',
  };
}

2. Description Length

// Google displays about 160 characters (roughly 80 Chinese characters)
function checkDescription(desc: string) {
  const length = desc.length;
  return {
    length,
    status: length <= 160 ? '✅' : '❌ Over 160 characters',
  };
}

3. Body Length

Page Type Recommended Word Count
Blog post 1500-3000 words
Product page 300-800 words
Homepage 300-500 words
Tutorial 2000+ words

4. Keyword Distribution

✅ Good distribution:
  Keyword in the title
  Keyword in the first paragraph
  Keyword appears naturally 3-5 times in the body
  Variants in H2/H3 subheadings

❌ Bad distribution:
  Keyword repeated in every paragraph
  Keyword unrelated to context
  Hidden-text stuffing

FAQ

Why Do Word Counts Differ Between Word and Online Tools?

Word's "Word Count" rules may differ from online tools:

  • Word 2019+ counts Chinese by "character"
  • Some tools count Chinese by "character" too, others by "word"
  • Stick to one tool consistently to avoid pricing disputes

How Do You Measure Comment Ratio in Code?

function commentRate(code: string, language: string) {
  const totalLines = code.split('\n').length;
  let commentLines = 0;

  if (language === 'javascript') {
    const singleLineComments = (code.match(/\/\/.*/g) || []).length;
    const multiLineComments = (code.match(/\/\*[\s\S]*?\*\//g) || []).length;
    commentLines = singleLineComments + multiLineComments;
  }

  return (commentLines / totalLines * 100).toFixed(1) + '%';
}

Summary

Text statistics seem simple but hide plenty of nuance — mixed Chinese-English counting, reading-time estimation, and keyword density analysis each have their own subtleties. Master these metrics, and whether you're doing SEO optimization, content pricing, or translation quotes, you'll always know exactly where you stand. The toolbox's Word Counter Tool gives you every metric in one click, so you can focus on creating content.

#文本统计#字数统计#阅读时间#文本分析#教程