Installation¶
Requirements¶
python3.11 or newerspaCy3.8.15 or newer within 3anyts0.4.5 or newer within 0.4, the language-independent core: the extractors, the basic statistics and the common readability formulas, the lexical diversity metrics, the corpus measures, the plots and the machinery of the highlighting come from it with the tokenizer, the lemmatizer, the sentence splitter and the syllables of Spanishnumpy,scipy,pandas,simplemma2matplotlibandgraphvizfor the visualizers
The dependencies are installed with the package. import ests loads neither spaCy nor matplotlib nor pandas: spaCy comes with the first text, whose words its Spanish tokenizer finds, and the plots and the corpus functions on first use.
Graphviz
The graphviz package among the dependencies is only a wrapper: rendering the word tree and the network of collocations requires the executables of Graphviz, installed separately (brew install graphviz, apt install graphviz, conda install graphviz), otherwise render() and displaying the graph in Jupyter fail with ExecutableNotFound. Nothing else needs them.
From PyPI¶
The distribution on PyPI is pyests, the package it installs is ests:
pip install pyests
From the repository¶
git clone https://github.com/SergeyShk/esTS.git
cd esTS
uv sync --all-groups
The spaCy model¶
Basic statistics, readability, lexical diversity, the style metrics except the verbal nouns, phonostatistics and verse statistics need no trained model. The morphological, the syntactic (with a parser), the cohesion and the lexical sophistication statistics of a string need one, and so do the verbal nouns of the style metrics, function_words_profile, the features of a text, the comparison of corpora and building a Doc yourself. The test suite needs it too; the test dependency group installs it:
python -m spacy download es_core_news_sm
Datasets¶
The corpus of literature, the sonnets and the frequency dictionary are downloaded once by their download() method; the statistics of LexicalStats by the dictionary and keyness against it need FreqDict().download(). The archives go to the directory ests_data next to the installed package (ests.constants.DEFAULT_DATA_DIR), dicts for the dictionary and texts for the corpus and the sonnets. Where that directory cannot be written, pass another one in data_dir (FreqDict(data_dir="...")) or set the environment variable ESTS_DATA_DIR before the package is imported:
export ESTS_DATA_DIR=~/ests_data