Formulas of other languages¶
UnadaptedReadabilityStats(source, sents_extractor=None, words_extractor=None)
Readability formulas made for English, German or Italian, computed from the basic statistics of a text with the coefficients they were published with (Linsear Write in the form of textstat), without a calibration for its language. Their values compare texts of one language with each other; they are no grade levels of another language. A word without syllables (a number, a preposition of one consonant) counts as monosyllabic in FORCAST and the Wiener Sachtextformeln and as easy in Linsear Write, as in textstat. The data source is a text, a Doc object of spaCy or a ready BasicStats object, as for ReadabilityStats.
Raises:
SourceTypeError- a source that is neither a string, aDocnor aBasicStatsobject, basic statistics of another class, an extractor of another type, a string or aDocfor a class withoutbasic_stats_class;SourceError- a source without words or without sentences.
The class extends the UnadaptedReadabilityStats of the anyTS core with the basic statistics of ruTS, which count the syllables and the letters of Russian words and take the Russian SentsExtractor and WordsExtractor by default. The print_stats table and the error messages are in Russian (UNADAPTED_READABILITY_STATS_DESC and CORE_MESSAGES of ruts.constants).
The formulas are not calibrated for Russian. Their values serve to compare Russian texts with each other and with the results of these formulas in other tools, but they give no grade of the Russian school: on the first-grade texts of the TextsByGrade dataset the median FORCAST is 14.9, the Powers-Sumner-Kearl grade 8.2 and the Wiener Sachtextformel 1 9.4. These formulas therefore have no reading scales, describe gives None for them, and they do not enter the consensus grade. The formulas with coefficients for Russian are in ReadabilityStats.
from ruts import UnadaptedReadabilityStats
text = "Ног нет, а хожу, рта нет, а скажу: когда спать, когда вставать, когда работу начинать"
urs = UnadaptedReadabilityStats(text)
urs.print_stats()
Метрика | Значение
-----------------------------------------------------
Класс FORCAST | 13.00
Класс Linsear Write | 8.50
Класс Пауэрса-Самнера-Керла | 6.55
Индекс EFLAW Макалпайна | 21.00
Венская формула 1 (Wiener Sachtextformel) | 4.42
Венская формула 2 (Wiener Sachtextformel) | 4.25
Венская формула 3 (Wiener Sachtextformel) | 5.69
Венская формула 4 (Wiener Sachtextformel) | 5.95
Индекс Дикеса-Штайвера | 42.20
Индекс Gulpease | 65.67
Индекс Фукса | 25.00
Индекс Strain | 7.50
Формула легкости на слух (ELF) | 10.00
Индекс Уилера-Смита | 80.00
Parameters¶
| Parameter | Type | Default | Description |
|---|---|---|---|
source |
str / Doc / BasicStats |
- | Data source |
sents_extractor |
SentsExtractor |
None |
Sentence extraction tool, not used for ready basic statistics |
words_extractor |
WordsExtractor |
None |
Word extraction tool, not used for ready basic statistics |
Attributes¶
| Attribute | Type | Description |
|---|---|---|
bs |
BasicStats |
Basic statistics of the text |
Ready basic statistics can be taken from a ReadabilityStats object, so as not to compute them again:
from ruts import ReadabilityStats
rs = ReadabilityStats(text)
urs = UnadaptedReadabilityStats(rs.bs)
urs.bs is rs.bs, urs.forcast
(True, 13.0)
Metrics¶
Every metric is a property of the object, computed on each access from bs, and get_stats gives them all. A hard word has complex_syl_factor syllables or more (3), a long word long_word_letter_factor letters or more (7).
| Metric | Language and readers | Range | Higher means |
|---|---|---|---|
forcast |
English technical texts, a grade | 5-20 | Harder |
linsear_write |
English, a grade | -1 and above | Harder |
powers_sumner_kearl |
English primary school texts, a grade | Any | Harder |
eflaw |
English for foreign learners | 1 and above | Harder |
wiener_sachtextformel_1 ... wiener_sachtextformel_4 |
German non-fiction, a grade from 4 to 15 | Any | Harder |
dickes_steiwer |
German, without syllables | Any | Easier |
gulpease |
Italian, by letters | 0-100 for most texts | Easier |
fucks |
German, syllables per sentence | 0 and above | Harder |
strain_index |
English | 0 and above | Harder |
elf |
English texts read aloud | 0 and above | Harder |
wheeler_smith |
English primary school texts | 0 and above | Harder |
Here ASL is the mean number of words per sentence, ASW the mean number of syllables per word. The functions of the formulas are imported from ruts.unadapted_readability_stats and compute a value from counts:
from ruts.unadapted_readability_stats import calc_forcast, calc_gulpease
calc_forcast(n_monosyllable_words=30, n_words=150)
calc_gulpease(n_letters=550, n_words=100, n_sents=8)
17.0
58.0
FORCAST¶
calc_forcast(n_monosyllable_words, n_words)
The grade of Caylor et al. (1973) for technical texts: 20 minus a tenth of the monosyllabic words per 150 words, from 5 (every word monosyllabic) to 20; nan without words.
| Parameter | Type | Default | Description |
|---|---|---|---|
n_monosyllable_words |
int |
- | Number of monosyllabic words |
n_words |
int |
- | Number of words |
A count that is not an integer or is negative, and more monosyllabic words than words, raise ParameterError.
Linsear Write¶
calc_linsear_write(n_easy_words, n_hard_words, n_sents)
The grade of Linsear Write in the form of textstat; the Lensear Write Formula of O'Hayre (1966) is another one, of the monosyllabic words and the sentences of a sample of 100 words. An easy word, of at most two syllables, weighs 1 and a hard one 3; their sum per sentence \(r\) is halved above 20, and otherwise loses 2 before it is halved. It is computed over the whole text rather than a sample of 100 words; nan without sentences.
| Parameter | Type | Default | Description |
|---|---|---|---|
n_easy_words |
int |
- | Number of the words of one or two syllables |
n_hard_words |
int |
- | Number of the words of three syllables or more |
n_sents |
int |
- | Number of sentences |
A count that is not an integer or is negative raises ParameterError.
Powers-Sumner-Kearl grade¶
calc_powers_sumner_kearl(n_syllables, n_words, n_sents)
The recalculation of the Flesch formula by Powers, Sumner and Kearl (1958) as a grade, for primary school texts; nan without words or sentences.
| Parameter | Type | Default | Description |
|---|---|---|---|
n_syllables |
int |
- | Number of syllables |
n_words |
int |
- | Number of words |
n_sents |
int |
- | Number of sentences |
A count that is not an integer or is negative raises ParameterError.
McAlpine EFLAW¶
calc_eflaw(n_mini_words, n_words, n_sents)
The score of McAlpine (2005) for readers of English as a foreign language: the words and the mini words, of one to three letters (mini_word_letters), per sentence; 20 and below is very easy, 30 and above confusing. nan without sentences.
| Parameter | Type | Default | Description |
|---|---|---|---|
n_mini_words |
int |
- | Number of the words of one to three letters |
n_words |
int |
- | Number of words |
n_sents |
int |
- | Number of sentences |
A count that is not an integer or is negative raises ParameterError.
Wiener Sachtextformel¶
calc_wiener_sachtextformel(n_complex, n_long_words, n_monosyllable_words, n_words, n_sents, variant=1)
The four formulas of Bamberger and Vanecek (1984) for German non-fiction, a grade from 4 to 15, over the percentages of the words of three syllables or more (MS), of more than six letters (IW) and of one syllable (ES) and the mean sentence length (SL); nan without words or sentences. A variant that is not an integer from 1 to 4 raises ParameterError.
| Parameter | Type | Default | Description |
|---|---|---|---|
n_complex |
int |
- | Number of the words of three syllables or more |
n_long_words |
int |
- | Number of the words of more than six letters |
n_monosyllable_words |
int |
- | Number of monosyllabic words |
n_words |
int |
- | Number of words |
n_sents |
int |
- | Number of sentences |
variant |
int |
1 |
Variant of the formula, from 1 to 4 |
A count that is not an integer or is negative raises ParameterError.
Dickes-Steiwer index¶
calc_dickes_steiwer(n_letters, n_words, n_sents, n_types)
The short formula of Dickes and Steiwer (1977) for German, as Bamberger and Vanecek (1984) give it, over the letters per word, the words per sentence and the type-token ratio, without syllables; higher is easier. nan without words or sentences. The ratio falls with the length of a text, so the values compare texts of one length.
| Parameter | Type | Default | Description |
|---|---|---|---|
n_letters |
int |
- | Number of the letters of the words |
n_words |
int |
- | Number of words |
n_sents |
int |
- | Number of sentences |
n_types |
int |
- | Number of the distinct words |
A count that is not an integer or is negative raises ParameterError.
Gulpease index¶
calc_gulpease(n_letters, n_words, n_sents)
The index of Lucisano and Piemontese (1988) for Italian, by letters rather than syllables: about 0 for the hardest texts and 100 for the easiest, beyond them for extreme ones; below 80 a text is hard for a reader of primary school, below 40 for a reader with a secondary education. nan without words.
| Parameter | Type | Default | Description |
|---|---|---|---|
n_letters |
int |
- | Number of the letters of the words |
n_words |
int |
- | Number of words |
n_sents |
int |
- | Number of sentences |
A count that is not an integer or is negative raises ParameterError.
Fucks index¶
calc_fucks(n_syllables, n_sents)
The style characteristic of Fucks (1955): the mean word length in syllables times the mean sentence length in words, the syllables per sentence; nan without sentences.
| Parameter | Type | Default | Description |
|---|---|---|---|
n_syllables |
int |
- | Number of syllables |
n_sents |
int |
- | Number of sentences |
A count that is not an integer or is negative raises ParameterError.
Strain index¶
calc_strain_index(n_syllables, n_sents)
The index of Nathaniel (2009): the syllables of three sentences over 10, here those of three sentences on average over the whole text, which makes it 0.3 times the index of Fucks; nan without sentences.
| Parameter | Type | Default | Description |
|---|---|---|---|
n_syllables |
int |
- | Number of syllables |
n_sents |
int |
- | Number of sentences |
A count that is not an integer or is negative raises ParameterError.
Easy listening formula¶
calc_elf(n_syllables, n_syllabic_words, n_sents)
The formula of Fang (1966) for texts read aloud: the syllables above one per word, per sentence, a word without syllables (a number) adding none; 12 and below is easy to listen to. nan without sentences.
| Parameter | Type | Default | Description |
|---|---|---|---|
n_syllables |
int |
- | Number of syllables |
n_syllabic_words |
int |
- | Number of the words of one syllable or more |
n_sents |
int |
- | Number of sentences |
A count that is not an integer or is negative raises ParameterError.
Wheeler-Smith index¶
calc_wheeler_smith(n_polysyllable_words, n_sents)
The index of Wheeler and Smith (1954) for primary school texts: the mean sentence length times the share of the words of two syllables or more, times 10, which makes 10 such words per sentence; it reads sentences where the original reads units ended by any final mark. nan without sentences.
| Parameter | Type | Default | Description |
|---|---|---|---|
n_polysyllable_words |
int |
- | Number of the words of two syllables or more |
n_sents |
int |
- | Number of sentences |
A count that is not an integer or is negative raises ParameterError.
Methods¶
The methods get_stats, to_dataframe, print_stats and describe are those of the statistics interface of the anyTS core; the formulas have no scales, and describe gives None for any of them.
from ruts import UnadaptedReadabilityStats
text = "Ног нет, а хожу, рта нет, а скажу: когда спать, когда вставать, когда работу начинать"
urs = UnadaptedReadabilityStats(text)
urs.describe("forcast"), urs.describe("gulpease")
urs.get_stats()
(None, None)
{'forcast': 13.0,
'linsear_write': 8.5,
'powers_sumner_kearl': 6.547433333333334,
'eflaw': 21.0,
'wiener_sachtextformel_1': 4.416333333333334,
'wiener_sachtextformel_2': 4.250666666666667,
'wiener_sachtextformel_3': 5.693766666666667,
'wiener_sachtextformel_4': 5.949666666666667,
'dickes_steiwer': 42.19782322089459,
'gulpease': 65.66666666666667,
'fucks': 25.0,
'strain_index': 7.5,
'elf': 10.0,
'wheeler_smith': 80.0}