ckmtools / textlens / vs textstat

TextLens vs textstat

textstat is a popular Python readability library. TextLens brings the same capabilities to the JavaScript/TypeScript ecosystem with zero dependencies — plus sentiment analysis, keyword extraction, and SEO scoring.

$ npm install textlens

Side-by-side comparison

Feature TextLens textstat
Language TypeScript / JavaScript Python
Dependencies Zero Multiple (pyphen, etc.)
Readability formulas 8 formulas + consensus grade ~10 formulas
Sentiment analysis
Keyword extraction ✓ TF-IDF
SEO scoring
Reading time
CLI
Browser support
License MIT BSD-3

What TextLens adds beyond textstat

textstat focuses on readability formulas. TextLens covers readability and goes further with sentiment, keywords, SEO, and a CLI.

Sentiment analysis Detect whether text reads as positive, negative, or neutral. textstat has no sentiment capability.
Keyword extraction (TF-IDF) Extract the most relevant terms from any text. Useful for SEO, content tagging, and summarization.
SEO scoring Get an actionable SEO score based on readability, keyword density, and content structure.
Consensus grade TextLens averages all 8 readability formulas into a single consensus grade for a more reliable score.
CLI and browser support Analyze files from the terminal or run TextLens in the browser with zero server dependencies. textstat is Python-only.

Code comparison

TextLens returns readability, sentiment, keywords, and SEO in one call. textstat requires a separate function for each metric.

TextLens TypeScript

import { analyze } from 'textlens';

const result = analyze(text);

result.readability.fleschKincaidGrade;  // 8.2
result.readability.gunningFogIndex;     // 10.1
result.readability.consensusGrade;      // 8.7
result.sentiment.label;                 // 'positive'
result.keywords;                        // ['readability', ...]
result.seo.score;                       // 82

textstat Python

import textstat

textstat.flesch_kincaid_grade(text)    # 8.2
textstat.gunning_fog(text)             # 10.1
textstat.text_standard(text)           # '8th and 9th grade'

# no sentiment analysis
# no keyword extraction
# no SEO scoring
# no CLI

When to use each

Use TextLens for JavaScript and TypeScript projects If your stack is Node.js, Deno, or browser-based, TextLens is the native choice. Zero dependencies, full TypeScript types, works everywhere JS runs.
Use textstat for Python projects If your stack is Python and you only need readability scores, textstat is a solid choice with a well-tested formula set.
Use TextLens when you need more than readability Sentiment, keywords, SEO scoring, and a CLI come built in. textstat only covers readability formulas.

Get started

$ npm install textlens