Loading page...Загружаем страницу...正在加载页面...
AtlasRepo

I Built a Free Word Counter That Runs 100% in Your Browser — Here's What I Learned About Client-Side Text Analysis

Description and use

A fully client‑side word counter built with Unicode‑aware tokenization, accurately handling complex text cases and running without server round‑trips.

Problem

Counting words accurately in client‑side web tools is harder than it appears; naive regex splits fail on hyphenated words, dashes, numbers, URLs, emails, and Unicode whitespace.

Outcome

A fully client‑side word counter that accurately handles diverse linguistic constructs, runs without server round‑trips, and scales infinitely with zero infrastructure cost.

Workflow

  • 1. Identify shortcomings of naive split regex.
  • 2. Research published segmentation rules (UAX #29).
  • 3. Design a rule‑based tokenizer with Unicode property escapes (\p{L}, \p{N}).
  • 4. Normalize text to NFC.
  • 5. Match tokens with regex pattern covering letters, numbers, apostrophes, hyphens, dashes, and Unicode scripts.
  • 6. Return token array for word count.
  • 7. Deploy tokenizer in browser, offloading heavy analysis to Web Workers.
  • 8. Integrate additional metrics (reading time, keyword density, speaking time, readability).

Evidence

Most tutorials tell you this: const wordCount = text.trim().split(/\s+/).length;

Source

I ended up implementing a rule-based tokenizer that handles apostrophes within words, hyphens within compounds, decimal numbers, URLs and emails as single tokens, CJK characters, and emoji sequences.

Source

Every tool on Word Counter Suite runs entirely in the browser. No server round-trips, no data leaving the machine. Web Workers handle heavy analysis off the main thread, so pasting a 100,000-word manuscript doesn't freeze the UI.

Source

  • Record date: 2026-10-06T21:41:04.581Z