Repository navigation
0.8.0
The eighth release of esTS moves every class of statistics onto the frames of anyTS 0.3, the language-independent core of text statistics. esTS keeps the Spanish layer: the tokenizer and the sentences, the transcription and the syllables, the clause rules, the lists of words and the dictionary of connectors. It also:
- counts the infinitive clauses apart from the subordinate ones;
- counts the connectors by their place in the sentence;
- imports about ten times faster, without loading spaCy;
- gives every class of statistics the same interface:
get_stats(flat=True),to_dataframe,describeandprint_stats.
Requires Python 3.11 or newer. Install with pip install -U pyests and import with import ests. The dependencies are now anyts>=0.3.9,<0.4 and spacy>=3.8.15,<4, both installed with the package.
New
- The frames of anyTS 0.3.
StyleStats,LexicalStats,PhonStats,SyntaxStatsandCohesionStatsare subclasses of the frames of the core. So are the spaCy components and the finders of the highlighting. - One interface for all classes.
MorphStatsandVerseStatsare nowStatsof the core too.- Every class has
get_stats(flat=True),to_dataframe(),describe(stat)and the table ofprint_stats. MorphStats.get_statsgives the counts by keys such asmood_Subwithflat=True.describegivesNonefor a statistic without a scale.
- Every class has
- Infinitive clauses.
- The new key
infinitive_clauses_per_sentcounts the infinitive clauses under a verb (quiere salir). They no longer count as subordinate clauses. is_infinitive_clause_headis new inests.syntax_stats.is_infinitive_periphrasisalso covers the infinitive of a raising verb underxcomp(parece dormir).
- The new key
- Connectors by place.
- The new keys
connectors_interandconnectors_intracount, per 1000 words, the connectors that link a sentence to the ones before and those that link the parts of a sentence. - A subordinator that opens a sentence begins its own clause or phrase, so it is intra-sentential.
SpanishConnectorMatcheris public. It carries the Spanish rules as class attributes, with three new lists ofests.constants:CONNECTOR_SUBORDINATORS: 66 conjunctive and prepositional phrases (ya que, a pesar de, siempre que);CONNECTOR_PARCELLATION: porque and conque, which link a sentence they open to the one before;CONNECTOR_SPLIT_BY_MARKS: 51 phrases ending in que, como or si, which a punctuation mark inside splits (No tire así, que se romperá).
- The dictionary gains 23 anaphoric forms (a pesar de esto, gracias a ello) and now has 273 connectors.
find_connectors(..., breaks=)takes the positions of the marks, andfind_connector_highlights(..., text=)the text, so the layer of the highlighting follows the same rules asCohesionStats.
- The new keys
- Fast import.
import eststakes 0.08 s instead of 0.89 s and loads no spaCy, pandas, matplotlib or SciPy.ests.visualizersandests.corpusload their modules on first use, and the spaCy components load when they are first used or found by their entry points. - Clichés of the component.
nlp.add_pipe("ests_style", config={"cliches": [...]})counts the clichés of a list. - Presets of a subclass. A subclass of
ReadabilityStatsmay narrow the presets, and a preset it adds is read by the scales ofgeneral(preset_level_scales,preset_reading_ease_grades). - Documentation. Every page has metric cards and signature blocks, with the errors of every class and function. The examples are run in English and in Spanish.
Incompatible changes
The public classes and functions keep their names. Their signatures change only by new optional parameters, except the name that a component class built directly needs.
- Dependencies.
- anyTS 0.3.9 or newer within 0.3 is required.
- spaCy is bounded below 4: the model
es_core_news_sm3.8.0 bounds it only in itsmeta.json.
- Names removed from
ests.constants. Their values live inanyts.constants:ALLITERATION_MIN_WORD_LEN,ALLITERATION_THRESHOLD;CLAUSE_DEPS,SUBORDINATE_CLAUSE_DEPS,SUBJECT_DEPS,NOUN_MODIFIER_DEPS;PHON_STATS_DESC,PHON_WINDOW_LEN;CONTENT_UD_POS,NAUSEA_TOP_N;FREQUENCY_BANDS, whichests.lexical_statsstill re-exports.
- Other names.
ests.phon_stats.PHON_STATS_DESCis gone: usePhonStats.stats_desc.ests.cohesion_statshas noConnectorIndexandsplit_doc_sents(the core hassplit_doc_units). ImportCONNECTOR_CLASSESandCONNECTOR_TYPESfromests.constants.is_finite_verbandis_infinitivecome fromanyts.utils, not fromests.syntax_stats.AUXILIARY_DEPSthere is now afrozenset.ests.utils.BLANK_LINEis gone.ests.lexical_stats.is_numberis the function of the core,is_number(word, pattern). The Spanish pattern isests.extractors.NUMBER_PATTERN.
- Components.
- The component classes leave
ests.__all__, sofrom ests import *no longer brings them.ests.StyleStatsComponentand the factories work as before. - A component class built directly needs its name:
LexicalStatsComponent(nlp, "lexical").add_pipeis unaffected. - The
presetofests_readabilityisNoneby default, the preset of the class; a saved config hasnull. - A wrong parameter raises the error of the core at
add_pipe. A wrongseseoordata_diror an unknown key still raises theConfigValidationErrorof spaCy.
- The component classes leave
- Syntax.
- An infinitive clause under a verb no longer counts in
subordinate_clauses_per_sentandp_complex_sents; it has its own key. - An infinitive in a gerund or participial phrase belongs to that phrase and heads no clause.
- An infinitive that the model tags as
csubjof its periphrasis (llega a convertirse) heads no clause.
- An infinitive clause under a verb no longer counts in
- Connectors.
- A rule of a connector reads no word across a punctuation mark.
- A phrase of
CONNECTOR_SPLIT_BY_MARKSwith a mark inside is no connector. - An anaphoric form counts as a connector of its own text in
c_connectors.
- Windows.
split_windowscuts consecutive windows of exactlywindowwords. The rest is a window only with at leastmin_wordswords, a whole window by default;min_wordsabovewindowraisesParameterError. Before, the windows were equal parts of aboutwindowwords. - Messages and tables.
- The errors have the texts of the core, with hints (The data source has no parts of speech: parse the text with a model…).
print_statsprints the table of the core, with the columns fitted to the text, in every class butMorphStats.ests.constants.CORE_MESSAGESis gone.
- Checks.
seseoofVerseStatsmust be abool.- So must the switches of
BasicStats,WordsExtractor,CharNgramsExtractorandkwic. - The finders of the highlighting,
find_phrases,sentence_rhythm,is_parentheticalandnoun_lemmascheck their arguments.SourceTypeErrororParameterErrorreplaces a bareTypeErrororAttributeError.
- Readability attributes.
ReadabilityStats.level_scaleshas the keyflesch_reading_easy, andreading_ease_gradesis the scale ofgeneral. The results of the methods are the same. StyleStats.verbal_nounsis apropertyinstead of acached_property.
Numbers
On a fixed set of texts, 137 of 4620 results changed against 0.7.0, all in these categories. Everything else is bitwise equal.
- New keys.
infinitive_clauses_per_sentin everySyntaxStats, andconnectors_interandconnectors_intrain everyCohesionStats, with their components. - Clauses. The clause keys of
SyntaxStatsmove in the texts with infinitive clauses: the subordinate clauses only fall. On 1050 fragments ofSpanishLiterature:- the subordinate clauses fall from 43,989 to 39,875;
- 3,766 infinitive clauses are counted apart;
- the clauses go from 89,293 to 89,223. The infinitives in gerund and participial phrases no longer count, while a coordinated nominal predicate (y estaba cansado) and an infinitive under a periphrasis attached as
conjnow do.
- Connectors. A few texts gain a connector after a comma (sin gracia alguna, y el amor). On the same fragments the connectors go from 36,050 to 36,092: 64 more by the marks, 22 fewer split by a mark. 11.8% of them link a sentence to the ones before.
- Chains of
de. A punctuation mark is no link of a chain: one text goes from 11 chains to 10. - Windows, as above:
split_windows,corpus_features,compare_featuresandcompare_corpora. - Error texts, of the core.
Fixes
- Pickles.
SyntaxStatskeeps noDocof the user: a pickle of 30k characters takes 141 KB instead of 885 KB.LexicalStats,StyleStats,SyntaxStatsandCohesionStatsbuilt withnlp=leave the pipeline out of a pickle and a copy. ALexicalStatstook 17 MB.
- Speed.
VerseStatsis linear in the length of a line: 0.03 s instead of 0.41 s on a line of 8,000 words. - Extractors.
StyleStatsandPhonStatsof aDocwith awords_extractorread the words with the extractor, as the other classes do. expand_phrasesgives its keys in one order whatever the hash seed.is_agentlessof a word that is no passive form givesFalse.- Demo.
- It started again.
- It cuts a long run of punctuation marks, on which the tokenizer of spaCy hung for minutes.
Quality
-
2073 tests pass with 100% line and branch coverage.
-
ruffandmypyare clean. -
CI runs on Python 3.11–3.14, on Linux, Windows and macOS, and with the lowest versions of the dependencies.
-
A QA pass before the release covered:
- the rules of 0.8 on 1050 fragments of
SpanishLiteratureand 1500 sonnets; - 2218 outcomes of the ten classes on 29 sources, and a fuzzing of 17 entry points;
- the import time, the lowest and the newest dependencies, Python 3.14, the notebooks and the demo;
- the documentation in English and in Spanish, with all their examples run.
Its findings are fixed in anyTS 0.3.9 and in this release, except one: the non-conditional si (¡Si ya te lo dije!) still counts as a conditional connector, until a hook of the core in 0.9.
- the rules of 0.8 on 1050 fragments of