Text charts¶
visualize(chart, text="", path=null, words=[], width=800, height=500)
A chart of a text by the ruTS visualizers: the response is a PNG image and a short summary in numbers. The agent shows the image to the user and draws conclusions from the summary: a distribution is easier to see than to read a retelling of. Chart labels are in Russian. The visualizers are described in the ruTS section «Visualizations», starting with the page Zipf's law.
chart |
What the chart shows | Summary |
|---|---|---|
zipf |
Zipf's law: word frequencies by rank on a logarithmic scale with a Zipf-Mandelbrot fit | The slope zipf_alpha and the most frequent words |
heaps |
Heaps' law: the growth of the number of distinct words with the length of the text | The exponent heaps_beta |
spectrum |
Frequency spectrum: how many distinct words occur 1, 2, 3 and more times | The share of hapaxes hapax_ratio |
sentence_lengths |
Sentence lengths in order with a moving average and the distribution | The number of sentences, the mean, smallest and greatest length; the moving average window is 2 % of the sentences, at least 10, there is no line for a text shorter than the window |
dispersion |
The places of the words in the text: every occurrence is a stroke |
The frequency and Gries' DP of every word (see dispersion) |
fingerprinting |
Literature fingerprinting: the TTR of sliding segments as colour, the places where the vocabulary is poorer or richer | MATTR |
rhythm |
The rhythm of a verse: lines as rows of syllables, stressed ones highlighted | The number of lines and the meter; for prose and a text without a meter - a warning that the picture says nothing about the meter |
The numbers of the summary are the same as in the diversity and verse groups of analyze_text, with the same descriptions and the warning about a too short text; dispersion adds the warnings of the dispersion tool. The words for dispersion are compared as lemmas, as in the dispersion tool. The rhythm chart needs the downloaded stress dictionary.
Errors are the ones common to the tools, a text without words, dispersion without words, rhythm without the stress dictionary.

The summary of this chart: «Предложений: 41; слов в предложении - в среднем 5.854, наименьшее 1, наибольшее 20».
Parameters¶
| Parameter | Type | Default | Description |
|---|---|---|---|
chart |
string |
- | Chart: zipf, heaps, spectrum, sentence_lengths, dispersion, fingerprinting, rhythm |
text |
string |
"" |
Text |
path |
string |
null |
Absolute path to a file with the text or a link ruts://datasets/... instead of text |
words |
array[string] |
[] |
Words for dispersion, up to 10 |
width |
integer |
800 |
Image width in pixels, from 400 to 1200 |
height |
integer |
500 |
Image height in pixels, from 300 to 900 |
Result¶
A PNG image of the given size and the text of the summary. The last lines of the summary are warnings if the text is not in Russian.