Text Statistics API - Word, Sentence, Syllable Counts avatar

Text Statistics API - Word, Sentence, Syllable Counts

Pricing

Pay per usage

Go to Apify Store
Text Statistics API - Word, Sentence, Syllable Counts

Text Statistics API - Word, Sentence, Syllable Counts

Exact counts for any text: characters with and without spaces, words, unique words, sentences, paragraphs, syllables, longest words, per-word and per-sentence averages, and lexical diversity. Unicode-correct. Up to 200 texts per run. Currently listed free - see the Pricing tab.

Pricing

Pay per usage

Rating

0.0

(0)

Developer

Broke to Built

Broke to Built

Maintained by Community

Actor stats

0

Bookmarked

2

Total users

1

Monthly active users

3 days ago

Last modified

Share

Text Statistics API - Word, Sentence, Syllable and Character Counts

Every count you would want about a text, exact and machine-readable. Characters with and without spaces, words, unique words, sentences, paragraphs, syllables, longest words, per-word and per-sentence averages, and lexical diversity - for up to 200 texts in one run. Currently listed free; inputs with no words are recorded as such rather than counted.

Enforcing word-count limits in a CMS, QA-ing content length before publish, profiling a dataset before training, building an editorial dashboard, spotting spun or templated copy: all of it reduces to counting text properties reliably at scale, which is exactly and only what this does.

What you get

Per text, one record with these exact fields:

  • ok - true when the text contained countable words
  • text - your input, truncated to 280 characters in the record
  • characters - withSpaces and withoutSpaces, counted in Unicode code points
  • words, uniqueWords, sentences, paragraphs, syllables
  • averages - wordLength, wordsPerSentence, syllablesPerWord
  • longestWords - the five longest distinct words
  • lexicalDiversity - uniqueWords / words, 0 to 1
  • error - present instead of counts when the input had no words. Never charged.

Example 1: one text

Input:

{ "text": "The quick brown fox jumps over the lazy dog. It was a bright cold day in April, and the clocks were striking thirteen.\n\nNatural language processing turns raw text into structured insight." }

Output (real run, 2026-08-15):

{
"ok": true,
"characters": { "withSpaces": 187, "withoutSpaces": 155 },
"words": 32,
"uniqueWords": 30,
"sentences": 3,
"paragraphs": 2,
"syllables": 45,
"averages": { "wordLength": 4.72, "wordsPerSentence": 10.67, "syllablesPerWord": 1.41 },
"longestWords": ["processing", "structured", "language", "striking", "thirteen"],
"lexicalDiversity": 0.9375
}

Two paragraphs, three sentences, and a lexical diversity of 0.94 - almost every word is distinct, which is what natural prose looks like.

Example 2: bulk, for a content audit

Input:

{
"texts": [
"First article body...",
"Second article body...",
"Third article body..."
],
"maxTexts": 200
}

One record per text. Sort the results by words to find the thin pages, or by lexicalDiversity ascending to find the repetitive ones.

When texts is filled, the single text field is ignored - you get exactly the texts you listed, with no filler record.

Example 3: an input with nothing to count

Input:

{ "text": "!!! ???" }

Output:

{ "ok": false, "text": "!!! ???", "error": "No words found in text (punctuation/symbols only)" }

Recorded so you can see it happened, rather than silently dropped or counted as a zero-word success. A dataset full of empty or junk rows tells you exactly which rows were junk.

Pricing

This Actor is currently listed as free - no start fee and no per-event charge. The Pricing tab on this listing is the authoritative source; if it ever disagrees with this paragraph, believe the tab.

The unit that would be charged, if it ever is, is one text fully analyzed: every count, every average, the longest words and lexical diversity, in a single record. Inputs with no countable words return ok: false and are never billable either way.

For context on what this work costs elsewhere, read from the Apify Store on 2026-08-07: moving_beacon/word-character-counter charges $0.001 per item and mahogany_songbird/page-word-count-batch $0.002 per item, so a 10,000-text audit runs $10 to $20 there.

Also honest: counting words is a few lines of code in any language. Use this when you want it as a hosted step in a pipeline, over many texts, with a stable output schema, or as a tool an AI agent can call - not because counting is hard.

When NOT to use this

  • Chinese, Japanese, Korean, Thai and other scripts that do not put spaces between words. The character counts are correct, but the word count will not be meaningful, because tokenization here is Latin-script oriented. Use a language-specific segmenter.
  • Exact syllable counts for individual rare words. The syllable counter is an English heuristic. Totals across a paragraph are reliable; a single unusual word can be off by one.
  • Abbreviation-heavy text where the sentence count must be exact. "Dr. Smith of Ft. Worth" counts as three sentences, as it does in every mechanical splitter. If sentence count is your billing metric, be aware of that bias.
  • Readability scores. This is the raw measurement layer. If you want Flesch, Gunning Fog, SMOG or a grade level, use EliAI/text-readability-analyzer instead - it includes these stats plus the six formulas.
  • Counting one document by hand. Your editor already does that. This is for batches and pipelines.

Honest limits

  • Words are runs of letters and digits, allowing internal apostrophes and hyphens. Latin-script oriented, as above.
  • Sentences split on ., !, ? followed by whitespace or end of text.
  • Paragraphs split on blank lines. A text with no blank lines is one paragraph.
  • Syllables use an English heuristic (roughly 90%+ per-word accuracy).
  • Up to 200 texts per run.

FAQ

How do I count words and characters in a text via API? Send {"text": "..."}. You get words, characters.withSpaces, characters.withoutSpaces, sentences, paragraphs and syllables in one record. For many texts, send texts as an array.

Are emojis and accented characters counted correctly? Yes. Character counts use Unicode code points, so an emoji counts as one character rather than two surrogate halves, and accented letters count as one.

What is lexical diversity useful for? It is uniqueWords / words. Low values flag repetitive, templated or spun content; unusually high values on short texts flag keyword stuffing or disjointed writing. It is a cheap first-pass quality signal on scraped or machine-generated text.

Can I enforce a minimum or maximum word count in CI? Yes. Batch your documents, then assert on words or averages.wordsPerSentence per record and fail the build on the ones that miss. Records with no words come back ok: false with the reason.

How is this different from your readability analyzer? This is counts only, and it is the cheaper of the two. The readability analyzer adds the six scoring formulas, a consensus grade level, an audience label and rewrite suggestions. Use this one when your pipeline only needs to enforce lengths.

Does it work on Chinese or Japanese text? Character counts, yes. Word counts, no - see "When NOT to use this". Those scripts need a language-specific segmenter.

Why did some rows come back ok: false? The input had no countable words, only punctuation or symbols. Recorded with the reason rather than returned as a row of zeros.

Use from code or AI agents

curl -s "https://api.apify.com/v2/acts/EliAI~text-statistics/run-sync-get-dataset-items?token=$APIFY_TOKEN" \
-X POST -H 'Content-Type: application/json' \
-d '{"text": "Count everything about this text."}'

Agents: connect Apify MCP and call the EliAI/text-statistics tool.

  • Capability: exact counts, averages and lexical diversity for one or many texts
  • Required input: text (string) or texts (array)
  • Returns: one record per text; words, sentences and lexicalDiversity headline it
  • Bounded: 200 texts per run; failures isolate per text
  • Side effects: none (texts never leave the run)
  • Readability Analyzer (EliAI/text-readability-analyzer) - these same stats plus Flesch, Flesch-Kincaid, Gunning Fog, SMOG, ARI and Coleman-Liau with a consensus grade level.