Download the PHP package globus-studio/readsight without Composer
On this page you can find all versions of the php package globus-studio/readsight. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download globus-studio/readsight
More information about globus-studio/readsight
Files in globus-studio/readsight
Package readsight
Short Description Multilingual readability library for PHP — 86 languages, 17 formulas, TeX-based syllable counting via Frank M. Liang algorithm. Zero dependencies.
License MIT
Homepage https://github.com/MADEVAL/ReadSight
Informations about the package readsight
ReadSight - Multilingual Readability Engine
ReadSight is a PHP library for measuring text readability across 86 languages. It implements 17 readability formulas with language-specific coefficients and uses the Frank M. Liang (TeX) hyphenation algorithm for accurate syllable counting — all with zero runtime dependencies.
See It in Action
Two texts of almost equal length — a plain sentence and a chunk of legal boilerplate:
There is no "score everything" call — you loop over the formulas the language supports and call score() for each:
For both texts that produces:
All 9 formulas for en-us agree the second text is far harder. The bundled example prints this grid plus text metrics and a syllable histogram, for any text and language:
17 formulas, 86 languages, one consistent API. Five of the formulas are truly universal — Gunning Fog, SMOG, Coleman-Liau, ARI and LIX score text in every one of the 86 languages. The remaining 12 are language-aware, each carrying its own published coefficients: Flesch Reading Ease and Flesch-Kincaid span 12 languages, the Wiener Sachtextformel speaks German, Gulpease speaks Italian, OSMAN speaks Arabic, and the Fernández-Huerta · Szigriszt-Pazos · Gutiérrez-Polini · Crawford family handles Spanish. getSupportedFormulas() then hands each language exactly the slice that fits it — 9 formulas for en-us, 11 for es, 8 for de-1996 — so an English-only metric never lands on a Thai sentence by mistake.
Table of Contents
- Installation
- See It in Action
- Quick Start
- Syllable Counting Modes
- Demo
- Supported Languages
- Readability Formulas
- FormulaResult
- Performance
- Custom Configuration
- Architecture
- Data Sources
- Development
- License
Installation
Requirements:
- PHP >= 8.2
ext-mbstringext-json
No other runtime dependencies.
Quick Start
Syllable Counting Modes
ReadSight has three syllable counting modes, configured per language via syllableMode in data/languages/*.json:
| Mode | How it works | count accuracy |
split accuracy |
|---|---|---|---|
heuristic |
Vowel patterns + word list + prefix/suffix rules | ✓ | ≈ approximate |
tex |
Frank M. Liang hyphenation algorithm (TeX .tex patterns) |
≈ approximate | ✓ exact |
composite |
Heuristic first, TeX as fallback | ✓ | ≈ approximate (uses heuristic split) |
80 languages use tex, 2 use composite (en-us, en-gb), 4 use heuristic (ru, uk, be, bg). The default mode is tex.
Why
texcount is approximate: TeX hyphenation patterns are optimised for line-breaking, not phonetic syllabification. They respecthyphenMinsand avoid awkward break points, so the number of pieces can differ from the true syllable count. For scripts where one syllable = one vowel (e.g. Cyrillic Slavic languages), TeX under- or over-counts. Those languages useheuristicmode with a per-languagevowelPatternand"vowelMode": "individual"so each vowel is counted as a syllable.splitWord()keeps using the exact TeX hyphenator regardless of mode.
Vowel counting: vowelMode
syllableHeuristics accepts a vowelMode field:
vowelMode |
Behaviour | Example |
|---|---|---|
"cluster" (default) |
Each run of consecutive vowels = 1 syllable (English diphthongs) | beau → 1 |
"individual" |
Each vowel letter = 1 syllable (Slavic Cyrillic) | дыхание → 4 |
Example: "hyphenation" in each mode
Tip:
splitWord()always uses the TeX hyphenator (exact).splitSyllables()may use the heuristic split (approximate) incomposite/heuristicmodes. Syllable counts are exact inheuristic/compositemode; intexmode they follow TeX break points and are approximate (see note above).Note:
addHyphenations()adds overrides to the TeX hyphenator. These affectsplitWord()but NOTsplitSyllables()incomposite/heuristicmodes (the heuristic counter doesn't see them).
Demo
Run the interactive demo to see ReadSight in action:
This analyzes built-in sample text and outputs:
- Syllable breakdown with hyphenation points for common words
- Text statistics - letters, words, sentences, syllables, histogram
- All applicable readability formulas with scores and interpretations
Compare the same text across 8 languages:
Analyze your own text file:
Supported Languages
86 languages across 19 writing systems: Latin, Cyrillic, Arabic, Hebrew, Devanagari, Bengali, Tamil, Thai, Greek, Armenian, Georgian, Gujarati, Gurmukhi, Kannada, Malayalam, Odia, Telugu, Ethiopic, Coptic.
Readability Formulas
Universal (all 86 languages)
| Formula | Method | Type | Score Range |
|---|---|---|---|
| Gunning Fog | gunningFog() |
Syllable-based | 0–20+ |
| SMOG Index | smogIndex() |
Syllable-based | 3–18+ |
| Coleman-Liau | colemanLiau() |
Letter-based | 0–18+ |
| ARI | automatedReadabilityIndex() |
Letter-based | 0–18+ |
| LIX | lix() |
Letter-based | 20–60+ |
Language-Specific
| Language | Formulas |
|---|---|
English (en-us, en-gb) |
Flesch Reading Ease, FK Grade Level, Dale-Chall, Spache |
German (de-*) |
Flesch Reading Ease (Amstad), FKGL, Wiener Sachtextformel (4 variants) |
Russian (ru) |
Flesch Reading Ease (Oborneva), FKGL |
Spanish (es) |
Flesch Reading Ease, Fernandez-Huerta, Szigriszt-Pazos, Gutierrez-Polini, Crawford |
Italian (it) |
Flesch Reading Ease, Gulpease |
French (fr) |
Flesch Reading Ease (Kandel-Moles) |
Dutch (nl) |
Flesch Reading Ease (Douma) |
Portuguese (pt) |
Flesch Reading Ease (Martins) |
Turkish (tr) |
Flesch Reading Ease (Ateşman) |
Polish (pl) |
FOG-PL |
Arabic (ar) |
OSMAN |
* Note: Dale-Chall and Spache formulas use a syllable-based heuristic to estimate difficult words (1-syllable ≈ easy). This is a simplified estimation, not based on the original Dale/Spache word lists. For accurate Dale-Chall/Spache scores, a curated word list would be required.
Generic dispatching:
FormulaResult
API Reference
Text Analysis Methods
splitSyllablesvssplitWord:splitSyllablesmay use the heuristic ≈approximate split (depends on the language'ssyllableMode).splitWordalways uses the TeX hyphenator for exact hyphenation points. Syllable counts are exact inheuristic/compositemode and approximate intexmode. See Syllable Counting Modes.
Formula Methods
Performance
| Operation | Time |
|---|---|
| Syllable counting (single word) | ~0.15 ms |
| Text analysis (450 words) | ~20 ms |
| Formula calculation (incl. analysis) | ~4 ms |
| Engine init (en-us, cached) | ~5 ms |
| Engine init (de-1996, first load) | ~380 ms |
Caching: compiled patterns are stored as JSON in the cache/ directory.
First load parses .tex files (native hyph-utf8 format); subsequent loads use the pre-compiled cache.
Custom Configuration
Architecture
Data Sources
- TeX hyphenation patterns: hyph-utf8 version 2026-02-21 -
the canonical TeX hyphenation repository maintained by the TeX Users Group (TUG).
86
.texpattern files from hyph-utf8 covering 86 language variants. Packaged under each pattern file's original license. - FRE coefficients: Amstad (DE), Oborneva (RU), Fernandez-Huerta (ES), Vacca-Franchina (IT), Kandel-Moles (FR), Douma (NL), Martins (PT), Ateşman (TR)
- WSTF: Bamberger & Vanecek (DE)
- Gulpease: GULP, La Sapienza University (IT)
Development
Quality Metrics
| Metric | Value |
|---|---|
| Tests | 257 |
| Assertions | 1 047 |
| PHPStan | Level max, 0 errors |
| Source classes | 53 |
| Test classes | 21 |
| Supported languages | 86 |
| Writing systems | 19 |
| Readability formulas | 17 |
| Runtime dependencies | 0 |
License
MIT. Author: Yevhen Leonidov.
TeX pattern files from hyph-utf8 are packaged under their original licenses (see individual file headers).
All versions of readsight with dependencies
ext-json Version *
ext-mbstring Version *