pyests 0.3.0__tar.gz → 0.5.0__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (57) hide show
  1. {pyests-0.3.0 → pyests-0.5.0}/.gitignore +1 -0
  2. {pyests-0.3.0 → pyests-0.5.0}/PKG-INFO +116 -42
  3. {pyests-0.3.0 → pyests-0.5.0}/README.es.md +114 -41
  4. {pyests-0.3.0 → pyests-0.5.0}/README.md +114 -41
  5. {pyests-0.3.0 → pyests-0.5.0}/ests/__init__.py +12 -2
  6. {pyests-0.3.0 → pyests-0.5.0}/ests/basic_stats.py +63 -42
  7. {pyests-0.3.0 → pyests-0.5.0}/ests/cohesion_stats.py +61 -330
  8. {pyests-0.3.0 → pyests-0.5.0}/ests/components.py +238 -84
  9. {pyests-0.3.0 → pyests-0.5.0}/ests/constants.py +473 -171
  10. {pyests-0.3.0 → pyests-0.5.0}/ests/corpus/__init__.py +2 -1
  11. pyests-0.5.0/ests/corpus/collocations.py +12 -0
  12. pyests-0.5.0/ests/corpus/compare.py +435 -0
  13. pyests-0.5.0/ests/corpus/dispersion.py +10 -0
  14. pyests-0.5.0/ests/corpus/keyness.py +103 -0
  15. {pyests-0.3.0 → pyests-0.5.0}/ests/corpus/kwic.py +24 -22
  16. pyests-0.5.0/ests/corpus/stylometry.py +110 -0
  17. pyests-0.5.0/ests/datasets/__init__.py +5 -0
  18. {pyests-0.3.0 → pyests-0.5.0}/ests/datasets/dataset.py +17 -10
  19. {pyests-0.3.0 → pyests-0.5.0}/ests/datasets/freq_dict.py +48 -62
  20. {pyests-0.3.0 → pyests-0.5.0}/ests/datasets/spanish_literature.py +28 -18
  21. pyests-0.5.0/ests/datasets/spanish_sonnets.py +303 -0
  22. pyests-0.5.0/ests/diversity_stats.py +182 -0
  23. pyests-0.5.0/ests/exceptions.py +13 -0
  24. pyests-0.5.0/ests/extractors.py +139 -0
  25. {pyests-0.3.0 → pyests-0.5.0}/ests/lexical_stats.py +37 -38
  26. {pyests-0.3.0 → pyests-0.5.0}/ests/morph_stats.py +29 -52
  27. pyests-0.5.0/ests/phon_stats.py +613 -0
  28. {pyests-0.3.0 → pyests-0.5.0}/ests/readability_stats.py +47 -81
  29. pyests-0.5.0/ests/style_stats.py +697 -0
  30. {pyests-0.3.0 → pyests-0.5.0}/ests/syllables.py +48 -55
  31. {pyests-0.3.0 → pyests-0.5.0}/ests/syntax_stats.py +65 -302
  32. {pyests-0.3.0 → pyests-0.5.0}/ests/utils.py +103 -249
  33. pyests-0.5.0/ests/verse_stats.py +1226 -0
  34. {pyests-0.3.0 → pyests-0.5.0}/ests/visualizers/__init__.py +4 -0
  35. {pyests-0.3.0 → pyests-0.5.0}/ests/visualizers/corpus.py +22 -28
  36. {pyests-0.3.0 → pyests-0.5.0}/ests/visualizers/fingerprinting.py +14 -17
  37. pyests-0.5.0/ests/visualizers/highlight.py +1056 -0
  38. {pyests-0.3.0 → pyests-0.5.0}/ests/visualizers/sentences.py +9 -10
  39. {pyests-0.3.0 → pyests-0.5.0}/ests/visualizers/stylometry.py +8 -13
  40. {pyests-0.3.0 → pyests-0.5.0}/ests/visualizers/vocabulary.py +7 -7
  41. {pyests-0.3.0 → pyests-0.5.0}/ests/visualizers/word_tree.py +12 -15
  42. {pyests-0.3.0 → pyests-0.5.0}/ests/visualizers/zipf.py +16 -11
  43. {pyests-0.3.0 → pyests-0.5.0}/pyproject.toml +9 -3
  44. pyests-0.3.0/ests/corpus/collocations.py +0 -319
  45. pyests-0.3.0/ests/corpus/compare.py +0 -787
  46. pyests-0.3.0/ests/corpus/dispersion.py +0 -334
  47. pyests-0.3.0/ests/corpus/keyness.py +0 -432
  48. pyests-0.3.0/ests/corpus/stylometry.py +0 -635
  49. pyests-0.3.0/ests/datasets/__init__.py +0 -4
  50. pyests-0.3.0/ests/diversity_stats.py +0 -1582
  51. pyests-0.3.0/ests/exceptions.py +0 -93
  52. pyests-0.3.0/ests/extractors.py +0 -377
  53. {pyests-0.3.0 → pyests-0.5.0}/LICENSE.txt +0 -0
  54. {pyests-0.3.0 → pyests-0.5.0}/ests/py.typed +0 -0
  55. {pyests-0.3.0 → pyests-0.5.0}/ests/resources/README.md +0 -0
  56. {pyests-0.3.0 → pyests-0.5.0}/ests/resources/connectors.tsv +0 -0
  57. {pyests-0.3.0 → pyests-0.5.0}/ests/resources/google_books_top10000.txt +0 -0
@@ -21,6 +21,7 @@ coverage.xml
21
21
  # Data and documentation
22
22
  ests_data
23
23
  site/
24
+ docs/core/
24
25
 
25
26
  # Editors and OS
26
27
  .vscode
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.5
2
2
  Name: pyests
3
- Version: 0.3.0
3
+ Version: 0.5.0
4
4
  Summary: Spanish Texts Statistics
5
5
  Project-URL: Homepage, https://github.com/SergeyShk/esTS
6
6
  Project-URL: Repository, https://github.com/SergeyShk/esTS
@@ -28,6 +28,7 @@ Classifier: Topic :: Text Processing
28
28
  Classifier: Topic :: Text Processing :: Linguistic
29
29
  Classifier: Typing :: Typed
30
30
  Requires-Python: >=3.11
31
+ Requires-Dist: anyts<0.2,>=0.1
31
32
  Requires-Dist: graphviz>=0.20.3
32
33
  Requires-Dist: matplotlib>=3.8
33
34
  Requires-Dist: numpy>=1.26
@@ -52,6 +53,7 @@ Description-Content-Type: text/markdown
52
53
  </p>
53
54
 
54
55
  <p align="center">
56
+ <a href="https://huggingface.co/spaces/SergeyShk/esTS">Demo</a> ·
55
57
  <a href="https://sergeyshk.github.io/esTS/">Documentation</a> ·
56
58
  <a href="https://pypi.org/project/pyests/">PyPI</a> ·
57
59
  <a href="https://github.com/SergeyShk/esTS/blob/master/README.es.md">Español</a>
@@ -63,14 +65,15 @@ Description-Content-Type: text/markdown
63
65
  <a href="https://github.com/SergeyShk/esTS/actions/workflows/ci.yml"><img src="https://github.com/SergeyShk/esTS/actions/workflows/ci.yml/badge.svg" alt="Build"></a>
64
66
  <a href="https://github.com/astral-sh/ruff"><img src="https://img.shields.io/endpoint?url=https://raw.githubusercontent.com/astral-sh/ruff/main/assets/badge/v2.json" alt="Ruff"></a>
65
67
  <a href="https://github.com/SergeyShk/esTS/blob/master/LICENSE.txt"><img src="https://img.shields.io/github/license/sergeyshk/esTS.svg" alt="License"></a>
68
+ <a href="https://huggingface.co/spaces/SergeyShk/esTS"><img src="https://img.shields.io/badge/%F0%9F%A4%97%20Spaces-demo-blue" alt="Demo on Hugging Face Spaces"></a>
66
69
  <a href="https://doi.org/10.5281/zenodo.22924655"><img src="https://zenodo.org/badge/DOI/10.5281/zenodo.22924655.svg" alt="DOI"></a>
67
70
  </p>
68
71
 
69
72
  ---
70
73
 
71
- **esTS** computes for Spanish texts what usually requires assembling several separate tools: basic statistics, readability, lexical diversity, lexical sophistication, morphology, syntax and cohesion - by published formulas with the coefficients and the scales of their authors, and by the parts of speech and the features of Universal Dependencies.
74
+ **esTS** computes statistics of Spanish texts: basic statistics, readability, lexical diversity, lexical sophistication, style, phonostatistics, morphology, syntax and cohesion - by published formulas with the coefficients and the scales of their authors, and by the parts of speech and the features of Universal Dependencies.
72
75
 
73
- The library works both with raw strings and with `Doc` objects of [spaCy](https://github.com/explosion/spaCy): sentences, words and character N-grams are extracted by rules, syllables and stress follow from the orthography, and only the morphological, the syntactic, the cohesion and the lexical sophistication statistics, the profile of the function words and the comparison of corpora need a trained model.
76
+ The library works both with raw strings and with `Doc` objects of [spaCy](https://github.com/explosion/spaCy); most statistics need no trained model (see Installation). Try it without installing in the [demo on Hugging Face Spaces](https://huggingface.co/spaces/SergeyShk/esTS): paste a text and get its readability, the metrics, the plots and the highlighting of its fragments.
74
77
 
75
78
  * **[Object extraction](https://sergeyshk.github.io/esTS/extractors/sentences/)** - configurable sentence, word and character N-gram tokenizers that know the inverted marks, the dialogue dash and the abbreviations of Spanish
76
79
  * **[Syllables and stress](https://sergeyshk.github.io/esTS/syllables/)** - rule-based syllabification and the stressed syllable derived from the spelling, with no dictionary
@@ -79,18 +82,19 @@ The library works both with raw strings and with `Doc` objects of [spaCy](https:
79
82
  * **[Lexical diversity metrics](https://sergeyshk.github.io/esTS/stats/diversity_stats/)** - TTR and its variations, MATTR, MSTTR, MTLD, HD-D, Simpson's and Yule's indices, entropy, Zipf's and Heaps' laws
80
83
  * **[Morphological statistics](https://sergeyshk.github.io/esTS/stats/morph_stats/)** - parts of speech and fifteen grammatical features of Universal Dependencies, with the markers of Spanish: the moods, the non-finite forms, `ser` against `estar`, the adverbs in `-mente`
81
84
  * **[Corpus measures](https://sergeyshk.github.io/esTS/corpus/keyness/)** - keywords against a reference corpus, collocations, the dispersion of a word over the parts of a text, a KWIC concordance and the stylometry of authorship: Burrows's Delta with its variants, Zeta, the Mendenhall curve, the profile of the function words; the comparison of two corpora by 132 features of a text with effect sizes
82
- * **[Visualizers](https://sergeyshk.github.io/esTS/visualizers/zipf/)** - Zipf's law, literature fingerprinting, a word tree, lexical dispersion and keywords, a network of collocations, a dendrogram, PCA and MDS by Delta, vocabulary growth, sentence lengths
83
- * **[Datasets](https://sergeyshk.github.io/esTS/datasets/spanishliterature/)** - Spanish-language literature in the public domain: 150 works by 33 authors from Spain, Latin America and the Philippines in prose, poems, drama and publicism, with the genre, the years and the country; a frequency dictionary of 83,785 lemmas by Google Books Ngram with ipm, range and dispersion
85
+ * **[Visualizers](https://sergeyshk.github.io/esTS/visualizers/zipf/)** - Zipf's law, literature fingerprinting, a word tree, lexical dispersion and keywords, a network of collocations, a dendrogram, PCA and MDS by Delta, vocabulary growth, sentence lengths, and the highlighting of the fragments the statistics count, such as long sentences and passives
86
+ * **[Datasets](https://sergeyshk.github.io/esTS/datasets/spanishliterature/)** - Spanish-language literature in the public domain: 150 works by 33 authors in four genres; 4,259 sonnets of the 15th-20th centuries with the metrical pattern and the rhyme of every line; a frequency dictionary of 83,785 lemmas by Google Books Ngram
84
87
  * **[spaCy components](https://sergeyshk.github.io/esTS/components/)** - every statistics class as a component of a pipeline, the statistics attached to the `Doc` in one pass
85
88
  * **[Cohesion statistics](https://sergeyshk.github.io/esTS/stats/cohesion_stats/)** - the overlap of nouns, arguments and content words between sentences, givenness and temporal cohesion in the manner of Coh-Metrix, with the density of 255 Spanish discourse markers
86
89
  * **[Lexical sophistication statistics](https://sergeyshk.github.io/esTS/stats/lexical_stats/)** - how rare the words of a text are in the language: the frequency, range and dispersion of the lemmas by a dictionary of Google Books Ngram, the frequency bands top-1000 to 10000, surprisal, perplexity and lexical density
90
+ * **[Style metrics](https://sergeyshk.github.io/esTS/stats/style_stats/)** - the SEO indicators of Advego and Text.ru (nausea, water content, spam score, naturalness by Zipf's law, keyword density) and the markers of the officialese style by the Spanish guides to plain language: verbal nouns, compound prepositions, parenthetical expressions and clichés
91
+ * **[Phonostatistics](https://sergeyshk.github.io/esTS/stats/phon_stats/)** - the shares of the classes of sounds, consonant clusters, hiatuses, open syllables, hardness and the indices of alliteration and assonance, over the sounds of a rule-based transcription
92
+ * **[Verse statistics](https://sergeyshk.github.io/esTS/stats/verse_stats/)** - the scansion of Spanish verse by its syllabic meter: the metrical syllables, the meter of a poem, the stress profile and the types of the endecasílabo, the rhyme in full and by assonance with its scheme, the strophes and the form of a poem
87
93
  * **[Syntactic statistics](https://sergeyshk.github.io/esTS/stats/syntax_stats/)** - the dependency tree by distances, depth, clauses and coordination, with the constructions of the administrative style: the passive with `ser` and with `se`, the participial and the gerund clauses, the chains of `de`, the split predicates
88
94
 
89
- Style, phonostatistics, metre and rhyme come in 0.4.
90
-
91
95
  ## Installation
92
96
 
93
- Requires Python 3.11 or newer.
97
+ Requires Python 3.11 or newer. The language-independent part - the extractors, the lexical diversity metrics and the corpus measures - comes from the [anyTS](https://github.com/SergeyShk/anyTS) core, installed with the package.
94
98
 
95
99
  ```bash
96
100
  pip install pyests
@@ -102,13 +106,13 @@ Or with [uv](https://docs.astral.sh/uv/):
102
106
  uv add pyests
103
107
  ```
104
108
 
105
- The distribution on PyPI is `pyests`, the package it installs is `ests`. The basic statistics, the readability and the lexical diversity metrics need no spaCy model; the morphological, the syntactic, the cohesion and the lexical sophistication statistics of a string do, and so do the profile of the function words, the features of a text and the comparison of corpora, and parsing a text yourself to pass the `Doc` instead of a string:
109
+ The distribution on PyPI is `pyests`, the package it installs is `ests`. The basic statistics, readability, lexical diversity, the style metrics except the verbal nouns, phonostatistics and verse statistics need no spaCy model. The morphological, syntactic, cohesion and lexical sophistication statistics of a string need one, and so do the verbal nouns, the profile of the function words, the features of a text, the comparison of corpora and parsing a `Doc` yourself:
106
110
 
107
111
  ```bash
108
112
  python -m spacy download es_core_news_sm
109
113
  ```
110
114
 
111
- The statistics by the frequency dictionary need it downloaded once with `FreqDict().download()`. The datasets go to the directory `ests_data` next to the installed package; another one is passed in `data_dir` or set in the environment variable `ESTS_DATA_DIR` before the package is imported.
115
+ The statistics by the frequency dictionary need it downloaded once with `FreqDict().download()`. The datasets go to the directory `ests_data` next to the installed package, or to the one passed in `data_dir` or set in `ESTS_DATA_DIR` before the package is imported.
112
116
 
113
117
  ## Quick start
114
118
 
@@ -149,7 +153,7 @@ The statistics by the frequency dictionary need it downloaded once with `FreqDic
149
153
 
150
154
  ### Object extraction
151
155
 
152
- The library allows creating your own tools for sentence, word and character N-gram extraction from a text, which can be further employed for counting statistics. The sentence splitter knows the inverted marks, the dash of a line of dialogue with the remark of the narrator, the abbreviations and the initials of Spanish; the word tokenizer keeps clitics, ordinals and numbers written the Spanish way together, and lemmas come from [simplemma](https://github.com/adbar/simplemma), which needs no model.
156
+ Configurable tools extract sentences, words and character N-grams from a text for the statistics. The sentence splitter knows the inverted marks, the dialogue dash and the abbreviations of Spanish; the word tokenizer keeps clitics, ordinals and Spanish numbers whole, and lemmas come from [simplemma](https://github.com/adbar/simplemma), which needs no model.
153
157
 
154
158
  ```python
155
159
  >>> from ests import CharNgramsExtractor, SentsExtractor, WordsExtractor
@@ -172,7 +176,7 @@ More in the [documentation](https://sergeyshk.github.io/esTS/extractors/sentence
172
176
 
173
177
  <br>
174
178
 
175
- Spanish spelling encodes both the syllable boundaries and the stress, so the library needs no dictionary: diphthongs, hiatuses and triphthongs, the silent `u` of `qu` and `gu`, the vocalic `y`, the `h` inside a diphthong and the consonant clusters give the syllables; the written accent, or the ending of the word when there is none, gives the stressed syllable. Adverbs in `-mente` and hyphenated compounds carry two stresses.
179
+ The syllables and the stress follow from the Spanish spelling, with no dictionary: the written accent, or the ending of the word when there is none, gives the stressed syllable. Adverbs in `-mente` and hyphenated compounds carry two stresses.
176
180
 
177
181
  ```python
178
182
  >>> from ests.syllables import stress_type, syllabify, word_stress, word_stresses
@@ -217,7 +221,7 @@ The library allows extracting the following statistics from a text:
217
221
  * the distribution of words by the number of letters
218
222
  * the distribution of words by the number of syllables
219
223
 
220
- A complex word has three or more syllables and a long word seven or more letters, as the Spanish readability formulas count them. Any statistic can be printed in a readable form:
224
+ A complex word has three or more syllables and a long word seven or more letters. Any statistic can be printed in a readable form:
221
225
 
222
226
  ```python
223
227
  >>> from ests import BasicStats
@@ -260,9 +264,9 @@ The library allows counting the following readability metrics:
260
264
  * LIX readability measure
261
265
  * RIX readability measure
262
266
 
263
- An interpretation layer works on top of the formulas: the band of a scale for the reading ease and for Legibilidad µ, a consensus grade as the median of the grade formulas, the school stage and the reader age of Spain, and reading time by the norms of Spanish-speaking readers.
267
+ On top of the formulas: the band of a scale for the reading ease and for Legibilidad µ, a consensus grade (the median of the grade formulas), the school stage and the reader age in Spain, and reading time.
264
268
 
265
- The coefficients of the Flesch reading ease are selected by the `preset` argument: by default the *fórmula de perspicuidad* of Szigriszt-Pazos with the INFLESZ scale validated on texts for patients (`general`); the coefficients of Fernández Huerta with the bands of their author are available as `classic`.
269
+ The coefficients of the Flesch reading ease are selected by `preset`: by default the *fórmula de perspicuidad* of Szigriszt-Pazos with the INFLESZ scale (`general`), or Fernández Huerta with the bands of its author (`classic`).
266
270
 
267
271
  ```python
268
272
  >>> from pprint import pprint
@@ -322,7 +326,7 @@ The library allows counting 32 lexical diversity metrics, among them:
322
326
  * Shannon entropy, evenness and perplexity
323
327
  * the slope of Zipf's law, the Zipf-Mandelbrot fit and the exponent of Heaps' law
324
328
 
325
- Any metric can be computed over windows of equal length, which is the standard way to compare texts of different lengths: the mean over the windows comes with a confidence interval.
329
+ Any metric can be computed over windows of equal length, to compare texts of different lengths, with a confidence interval of the mean.
326
330
 
327
331
  ```python
328
332
  >>> from ests import DiversityStats
@@ -352,7 +356,7 @@ More in the [documentation](https://sergeyshk.github.io/esTS/stats/diversity_sta
352
356
 
353
357
  <br>
354
358
 
355
- The library annotates a text with the parts of speech and the grammatical features of Universal Dependencies, as the Spanish models of spaCy give them, and counts them:
359
+ The parts of speech and the grammatical features of Universal Dependencies, as the Spanish models of spaCy give them:
356
360
 
357
361
  * the part of speech and fifteen features: case, definiteness, degree, gender, mood, numeral type, number, person, polarity, politeness, possessive, pronoun type, reflexive, tense and verb form
358
362
  * the distribution of the words by the values of any feature, and the parse of the text word by word
@@ -376,7 +380,7 @@ The library annotates a text with the parts of speech and the grammatical featur
376
380
  0.5
377
381
  ```
378
382
 
379
- The statistics need a spaCy model: a text is parsed with `es_core_news_sm`, and any other pipeline can be passed in `nlp`.
383
+ A text is parsed with `es_core_news_sm`; another pipeline can be passed in `nlp`.
380
384
 
381
385
  More in the [documentation](https://sergeyshk.github.io/esTS/stats/morph_stats/).
382
386
 
@@ -387,7 +391,7 @@ More in the [documentation](https://sergeyshk.github.io/esTS/stats/morph_stats/)
387
391
 
388
392
  <br>
389
393
 
390
- The library measures the dependency tree of Universal Dependencies and the constructions that the Spanish guides to clear language warn about:
394
+ The dependency tree of Universal Dependencies and the constructions that the Spanish guides to clear language warn about:
391
395
 
392
396
  * the complexity of the tree: dependency distances, depth, leaves and subtrees, valency of the finite verbs, coordination chains, clauses and subordinate clauses, modifiers per noun
393
397
  * the constructions: the passive with `ser` and with `se`, the participial and the gerund clauses, the chains of `de`, the split predicates, the impersonal `se`, the words of negation, the ratio of nouns to verbs
@@ -412,7 +416,7 @@ The library measures the dependency tree of Universal Dependencies and the const
412
416
  2.05
413
417
  ```
414
418
 
415
- The statistics need a parse: a text is parsed with `es_core_news_sm`, and any other pipeline can be passed in `nlp`.
419
+ A text is parsed with `es_core_news_sm`; another pipeline with a parser can be passed in `nlp`.
416
420
 
417
421
  More in the [documentation](https://sergeyshk.github.io/esTS/stats/syntax_stats/).
418
422
 
@@ -423,7 +427,7 @@ More in the [documentation](https://sergeyshk.github.io/esTS/stats/syntax_stats/
423
427
 
424
428
  <br>
425
429
 
426
- The library measures referential cohesion in the manner of Coh-Metrix and of its Spanish adaptation Coh-Metrix-Esp:
430
+ Referential cohesion in the manner of Coh-Metrix and its Spanish adaptation Coh-Metrix-Esp:
427
431
 
428
432
  * the overlap of nouns, of arguments and of content words between adjacent sentences and between all pairs of sentences, binary and proportional
429
433
  * givenness: pronouns, demonstratives and the content words whose lemma was already used
@@ -450,7 +454,7 @@ The library measures referential cohesion in the manner of Coh-Metrix and of its
450
454
  (86.96, 43.48)
451
455
  ```
452
456
 
453
- The statistics need the annotation: a text is parsed with `es_core_news_sm`, and any other pipeline can be passed in `nlp`.
457
+ A text is parsed with `es_core_news_sm`; another pipeline can be passed in `nlp`.
454
458
 
455
459
  More in the [documentation](https://sergeyshk.github.io/esTS/stats/cohesion_stats/).
456
460
 
@@ -461,7 +465,7 @@ More in the [documentation](https://sergeyshk.github.io/esTS/stats/cohesion_stat
461
465
 
462
466
  <br>
463
467
 
464
- How rare the words of a text are in the language, in the manner of TAALES: the mean frequency, range and dispersion of the lemmas by the frequency dictionary of Google Books Ngram, the shares of the words of the frequency bands top-1000, 2000, 5000 and 10000, the surprisal and the perplexity by the unigram model of the dictionary, the lexical density. The bands and the density work out of the box; the statistics by the dictionary need it downloaded once.
468
+ How rare the words of a text are in the language, in the manner of TAALES: the mean frequency, range and dispersion of the lemmas by the frequency dictionary of Google Books Ngram, the shares of the frequency bands top-1000, 2000, 5000 and 10000, surprisal and perplexity, the lexical density. The statistics by the dictionary need it downloaded once.
465
469
 
466
470
  ```python
467
471
  >>> from ests import LexicalStats
@@ -477,6 +481,71 @@ More in the [documentation](https://sergeyshk.github.io/esTS/stats/lexical_stats
477
481
 
478
482
  </details>
479
483
 
484
+ <details>
485
+ <summary><b>Style metrics</b></summary>
486
+
487
+ <br>
488
+
489
+ The SEO indicators of Advego and Text.ru - nausea, water content, spam score, naturalness by Zipf's law, keyword density - and the markers of the officialese style that the Spanish guides to plain language warn about: the nouns derived from a verb, the compound prepositions of the administrative style, the parenthetical expressions and the clichés.
490
+
491
+ ```python
492
+ >>> from ests import StyleStats
493
+
494
+ >>> ss = StyleStats("Se procedió a la revisión del expediente en el marco del plan a la mayor brevedad.")
495
+ >>> ss.compound_prepositions, ss.cliches, ss.verbal_nouns
496
+ (6.25, 12.5, 20.0)
497
+ ```
498
+
499
+ More in the [documentation](https://sergeyshk.github.io/esTS/stats/style_stats/).
500
+
501
+ </details>
502
+
503
+ <details>
504
+ <summary><b>Phonostatistics</b></summary>
505
+
506
+ <br>
507
+
508
+ The shares of the classes of sounds, the consonant clusters, the hiatuses, the open syllables, the hardness and the indices of alliteration and assonance, counted over the sounds of a rule-based transcription, not over the letters: `h` is silent, `ll` and `rr` are one sound.
509
+
510
+ ```python
511
+ >>> from ests import PhonStats
512
+
513
+ >>> ps = PhonStats("Los suspiros se escapan de su boca de fresa")
514
+ >>> round(ps.p_voiceless, 3), round(ps.hardness, 3), ps.sounds[-1]
515
+ (0.371, 0.684, ('f', 'r', 'e', 's', 'a'))
516
+ ```
517
+
518
+ More in the [documentation](https://sergeyshk.github.io/esTS/stats/phon_stats/).
519
+
520
+ </details>
521
+
522
+ <details>
523
+ <summary><b>Verse statistics</b></summary>
524
+
525
+ <br>
526
+
527
+ The scansion of Spanish verse by its syllabic meter: the metrical syllables of a line with the synalepha and the law of the final stress, fitted to the meter of the poem; the meter, the stress profile and the types of the endecasílabo; the rhyme in full (consonante) and by assonance (asonante) with its scheme, the strophes and the form of a poem. No model and no dictionary are needed.
528
+
529
+ ```python
530
+ >>> from ests import VerseStats
531
+
532
+ >>> text = """Cuando me paro a contemplar mi estado
533
+ ... y a ver los pasos por do me han traído,
534
+ ... hallo, según por do anduve perdido,
535
+ ... que a mayor mal pudiera haber llegado."""
536
+ >>> vs = VerseStats(text)
537
+ >>> vs.meter, vs.patterns[0], vs.c_rhythms
538
+ ('endecasílabo', '---+---+-+-', {'4-8-10': 2, '4-7-10': 1, '3-6-10': 1})
539
+ >>> vs.syllables[0]
540
+ ('cuan', 'do', 'me', 'pa', 'ro‿a', 'con', 'tem', 'plar', 'mi‿es', 'ta', 'do')
541
+ >>> vs.rhyme_schemes, vs.strophes
542
+ (('ABBA',), ('cuarteto',))
543
+ ```
544
+
545
+ More in the [documentation](https://sergeyshk.github.io/esTS/stats/verse_stats/).
546
+
547
+ </details>
548
+
480
549
  <details>
481
550
  <summary><b>spaCy components</b></summary>
482
551
 
@@ -500,7 +569,7 @@ Every statistics class is also a component of a pipeline, so a text is annotated
500
569
  (12, ('DET', 'NOUN'), 2.0)
501
570
  ```
502
571
 
503
- The factories are `ests_basic`, `ests_readability`, `ests_diversity`, `ests_morph`, `ests_syntax`, `ests_cohesion` and `ests_lexical`; the name of the pipe is free and is what the extension is called.
572
+ The factories are `ests_basic`, `ests_readability`, `ests_diversity`, `ests_morph`, `ests_syntax`, `ests_cohesion`, `ests_lexical`, `ests_style`, `ests_phon` and `ests_verse`; the name of the pipe is the name of the extension.
504
573
 
505
574
  More in the [documentation](https://sergeyshk.github.io/esTS/components/).
506
575
 
@@ -511,14 +580,14 @@ More in the [documentation](https://sergeyshk.github.io/esTS/components/).
511
580
 
512
581
  <br>
513
582
 
514
- The library compares corpora and describes the use of a word, with the measures of corpus linguistics:
583
+ The measures of corpus linguistics that compare corpora and describe the use of a word:
515
584
 
516
585
  * keywords of a target corpus against a reference one or against the frequency dictionary of Google Books Ngram: the log-likelihood with its p-value, Log Ratio, chi-square, %DIFF, BIC, ELL and the odds ratio
517
- * collocations by logDice, MI, MI³, t-score, Dice, log-likelihood, NPMI and minimum sensitivity, checked against NLTK
586
+ * collocations by logDice, MI, MI³, t-score, Dice, log-likelihood, NPMI and minimum sensitivity
518
587
  * the dispersion of a word over the parts of a text: DP of Gries, normalized DP, Juilland's D, Carroll's D2, Rosengren's S and the Kullback-Leibler divergence
519
588
  * a KWIC concordance by word form or by lemma
520
589
  * stylometry: the distances between texts by Burrows's Delta and its variants, with the attribution of a text to reference authors, the markers of preferred and avoided words by Zeta, Kilgarriff's chi-square, the Mendenhall curve and the profile of the function words
521
- * the comparison of two corpora by 132 features of a text over windows of about the same size: Cliff's delta, Cohen's d and the AUC of every feature, the Mann-Whitney test with Holm's correction and a bootstrap interval of the difference of the medians that resamples whole texts
590
+ * the comparison of two corpora by 132 features of a text over windows of about the same size: Cliff's delta, Cohen's d and the AUC of every feature, the Mann-Whitney test with Holm's correction and a bootstrap interval of the difference of the medians
522
591
 
523
592
  ```python
524
593
  >>> from ests import WordsExtractor
@@ -555,10 +624,11 @@ More in the [documentation](https://sergeyshk.github.io/esTS/corpus/keyness/).
555
624
 
556
625
  <br>
557
626
 
558
- * [spanish_literature](https://sergeyshk.github.io/esTS/datasets/spanishliterature/) - Spanish-language literature in the public domain: 150 works by 33 authors from Spain, Latin America and the Philippines, from Cervantes to the 1920s, in prose, poems, drama and publicism; 65 million characters
559
- * [freq_dict](https://sergeyshk.github.io/esTS/datasets/freqdict/) - a frequency dictionary of 83,785 Spanish lemmas from the books of Google Books Ngram of 1980-2019 (63 billion words): ipm, range and Juilland's D over the years, the number of books and the part of speech (CC BY 3.0)
627
+ * [spanish_literature](https://sergeyshk.github.io/esTS/datasets/spanishliterature/) - Spanish-language literature in the public domain: 150 works by 33 authors from Spain, Latin America and the Philippines, from Cervantes to the 1920s, in prose, poems, drama and publicism
628
+ * [spanish_sonnets](https://sergeyshk.github.io/esTS/datasets/spanishsonnets/) - Spanish sonnets of the Diachronic Spanish Sonnet Corpus (DISCO) in the public domain: 4,259 sonnets by 1,167 authors of the 15th-20th centuries, every line with its metrical pattern and the label of its rhyme, the automatic annotation of DISCO (CC BY 4.0)
629
+ * [freq_dict](https://sergeyshk.github.io/esTS/datasets/freqdict/) - a frequency dictionary of 83,785 Spanish lemmas from the books of Google Books Ngram of 1980-2019: ipm, range and Juilland's D over the years, the number of books and the part of speech (CC BY 3.0)
560
630
 
561
- The texts are cut to the text of the author, without title pages, notes of the transcribers and the editors, tables of contents and footnotes, and come with the genre, the author, the title, the years of the first publication and the country; the records can be filtered by any of them and by the length of the text.
631
+ The texts are cut to the text of the author and come with the genre, the author, the title, the years of the first publication and the country; the records can be filtered by any of them and by the length of the text.
562
632
 
563
633
  ```python
564
634
  >>> from ests.datasets import SpanishLiterature
@@ -573,7 +643,7 @@ La de Bringas 1884 413730
573
643
  Tormento 1884 477286
574
644
  ```
575
645
 
576
- The archive (19 MB) is downloaded once by `download()` into the data directory and verified against its SHA-256 checksum; before the download `get_texts()` and `get_records()` raise `DatasetNotFoundError` with a hint.
646
+ The archive (19 MB) is downloaded once by `download()` into the data directory; before that `get_texts()` and `get_records()` raise `DatasetNotFoundError`.
577
647
 
578
648
  More in the [documentation](https://sergeyshk.github.io/esTS/datasets/spanishliterature/).
579
649
 
@@ -585,13 +655,13 @@ More in the [documentation](https://sergeyshk.github.io/esTS/datasets/spanishlit
585
655
  <br>
586
656
 
587
657
  * [Zipf's law](https://sergeyshk.github.io/esTS/visualizers/zipf/) with the theoretical curve and the Zipf-Mandelbrot fit
588
- * [Literature fingerprinting](https://sergeyshk.github.io/esTS/visualizers/fingerprinting/) (Literature Fingerprinting)
589
- * [Word tree](https://sergeyshk.github.io/esTS/visualizers/word_tree/) (Word Tree)
658
+ * [Literature fingerprinting](https://sergeyshk.github.io/esTS/visualizers/fingerprinting/)
659
+ * [Word tree](https://sergeyshk.github.io/esTS/visualizers/word_tree/)
590
660
  * [Corpus plots](https://sergeyshk.github.io/esTS/visualizers/corpus/): lexical dispersion, a chart of keywords, a network of collocations
591
661
  * [Stylometric plots](https://sergeyshk.github.io/esTS/visualizers/stylometry/): a dendrogram, the principal components and the multidimensional scaling by Delta, the Mendenhall curves
592
662
  * [Vocabulary growth and frequency spectrum](https://sergeyshk.github.io/esTS/visualizers/vocabulary/), [sentence lengths](https://sergeyshk.github.io/esTS/visualizers/sentences/) with a moving average
593
663
 
594
- The matplotlib plots take the axes `ax` and return `Axes`, so they can be laid out on one figure; the network of collocations and the word tree are graphs of graphviz, whose executables render them. Cosine Delta separates three novels by Galdós from three by Unamuno:
664
+ The matplotlib plots take the axes `ax` and return `Axes`; the network of collocations and the word tree are rendered by the executables of Graphviz. Cosine Delta separates three novels by Galdós from three by Unamuno:
595
665
 
596
666
  ```python
597
667
  import matplotlib.pyplot as plt
@@ -651,7 +721,7 @@ Run `make help` for the full list of commands.
651
721
 
652
722
  The documentation is bilingual: English pages are `docs/*.md`, Spanish ones are `docs/*.es.md` next to them ([mkdocs-static-i18n](https://github.com/ultrabug/mkdocs-static-i18n)); when editing a page, update both versions.
653
723
 
654
- The installed version is `ests.__version__`. All exceptions inherit `ests.EstsError` and one of the built-in classes (`SourceError`, `ParameterError` and `DataFileError` - `ValueError`, `SourceTypeError` - `TypeError`, `UnknownStatError` - `KeyError`, `DatasetNotFoundError` - `OSError`, `DownloadError` - `RuntimeError`), so `except ValueError` keeps working. The library prints nothing on its own: its messages go to the `ests` logger (`logging.getLogger("ests")`) and are silent by default.
724
+ The installed version is `ests.__version__`. All exceptions inherit `ests.EstsError` and a built-in class (`ValueError`, `TypeError`, `KeyError`, `OSError` or `RuntimeError`), so `except ValueError` keeps working. The library prints nothing on its own: its messages go to the `ests` logger and are silent by default. More in the [documentation](https://sergeyshk.github.io/esTS/exceptions/).
655
725
 
656
726
  Before submitting changes, install the hooks that run the linters on commit and the tests on push:
657
727
 
@@ -661,13 +731,14 @@ uv run pre-commit install
661
731
 
662
732
  ## Contributing
663
733
 
664
- Bug reports, ideas and pull requests are welcome - [issues](https://github.com/SergeyShk/esTS/issues) are open. The workflow, the checks to run before submitting a pull request and how to shape the changes are described in [CONTRIBUTING.md](https://github.com/SergeyShk/esTS/blob/master/CONTRIBUTING.md); the rules of conduct are in the [code of conduct](https://github.com/SergeyShk/esTS/blob/master/CODE_OF_CONDUCT.md).
734
+ Bug reports, ideas and pull requests are welcome in the [issues](https://github.com/SergeyShk/esTS/issues). The workflow and the checks to run before a pull request are in [CONTRIBUTING.md](https://github.com/SergeyShk/esTS/blob/master/CONTRIBUTING.md); the rules of conduct are in the [code of conduct](https://github.com/SergeyShk/esTS/blob/master/CODE_OF_CONDUCT.md).
665
735
 
666
736
  <details>
667
737
  <summary><b>Project structure</b></summary>
668
738
 
669
739
  <br>
670
740
 
741
+ * **demo** - the demo on Hugging Face Spaces (Gradio)
671
742
  * **docs** - project documentation
672
743
  * **ests**:
673
744
  * basic_stats.py - basic text statistics
@@ -675,18 +746,21 @@ Bug reports, ideas and pull requests are welcome - [issues](https://github.com/S
675
746
  * lexical_stats.py - lexical sophistication statistics
676
747
  * components.py - components of a spaCy pipeline
677
748
  * corpus - measures of corpus linguistics: keywords, collocations, dispersion, concordance, stylometry, comparison of corpora
678
- * datasets - datasets: Spanish-language literature, the frequency dictionary
749
+ * datasets - datasets: Spanish-language literature, Spanish sonnets, the frequency dictionary
679
750
  * constants.py - constants of the Spanish language and of the metrics
680
- * diversity_stats.py - lexical diversity metrics
751
+ * diversity_stats.py - lexical diversity metrics of the anyTS core over a string or a Doc
681
752
  * exceptions.py - library exceptions
682
- * extractors.py - tools for object extraction from a text
753
+ * extractors.py - the extractors of the anyTS core with the Spanish tokenizers
683
754
  * morph_stats.py - morphological statistics
684
755
  * readability_stats.py - readability metrics
756
+ * style_stats.py - style metrics
757
+ * phon_stats.py - phonostatistics
685
758
  * syntax_stats.py - syntactic statistics
759
+ * verse_stats.py - verse statistics
686
760
  * syllables.py - syllabification and stress
687
761
  * utils.py - helper tools
688
- * visualizers - plots: Zipf's law, fingerprinting, word tree, corpus and stylometric plots, vocabulary growth, sentence lengths
689
- * **scripts** - scripts that build the archives of the datasets
762
+ * visualizers - plots: Zipf's law, fingerprinting, word tree, corpus and stylometric plots, vocabulary growth, sentence lengths, text highlighting
763
+ * **scripts** - scripts that build the archives of the datasets and fetch the anyTS pages of the documentation
690
764
  * **tests** - tests mirroring the package structure
691
765
 
692
766
  </details>
@@ -701,7 +775,7 @@ Bug reports, ideas and pull requests are welcome - [issues](https://github.com/S
701
775
 
702
776
  ## Citation
703
777
 
704
- Please use the following BibTeX entry for citing **esTS** if you use it in your research or software. Citations are helpful for the continued development and maintenance of this library. The same metadata is in [CITATION.cff](https://github.com/SergeyShk/esTS/blob/master/CITATION.cff) - GitHub shows it under the "Cite this repository" button. The Concept DOI [10.5281/zenodo.22924655](https://doi.org/10.5281/zenodo.22924655) on Zenodo points at every version of the library; the DOI of a single version is on the page of its release.
778
+ Please use the following BibTeX entry for citing **esTS** if you use it in your research or software. The same metadata is in [CITATION.cff](https://github.com/SergeyShk/esTS/blob/master/CITATION.cff) ("Cite this repository" on GitHub). The Concept DOI [10.5281/zenodo.22924655](https://doi.org/10.5281/zenodo.22924655) points at every version of the library; the DOI of a single version is on the page of its release.
705
779
 
706
780
  ```bibtex
707
781
  @software{esTS,