Word dispersion¶
dispersion(text="", path=null, words=null, parts=10, lemmatize=true, top_n=20)
Dispersion - how evenly a word is spread over the text: it tells a word that runs through the whole text from a word concentrated in one place, although their frequency does not. The text is split into parts parts of about equal size, while the texts of a query link are parts on their own: the measure shows whether a word runs through the texts of the corpus. The measures of Gries and other dispersion measures are computed for every word. The definitions and formulas of the measures are on the esTS page Word dispersion.
A word with a frequency below the number of parts cannot fall into all the parts, and its measures show concentration even with the most even spread: the response warns about such words. A word absent from the text has frequency 0 and null measures. With lemmatize a word of words takes that of its lemmas which occurs in the text, as node of collocations does.
Errors - those common to the tools, a text without words, more parts than words and a word in words that is not one word.
In a paragraph of the first chapter of Don Quijote «caballero» comes from the first sentence to the last, while «Amadís» only in the dispute about the best knight that ends the paragraph:
{
"name": "dispersion",
"arguments": {
"text": "Con estas razones perdía el pobre caballero el juicio, y desvelábase por entenderlas y desentrañarles el sentido, que no se lo sacara ni las entendiera el mesmo Aristóteles, si resucitara para sólo ello. No estaba muy bien con las heridas que don Belianís daba y recebía, porque se imaginaba que, por grandes maestros que le hubiesen curado, no dejaría de tener el rostro y todo el cuerpo lleno de cicatrices y señales. Pero, con todo, alababa en su autor aquel acabar su libro con la promesa de aquella inacabable aventura, y muchas veces le vino deseo de tomar la pluma y dalle fin al pie de la letra, como allí se promete; y sin duda alguna lo hiciera, y aun saliera con ello, si otros mayores y continuos pensamientos no se lo estorbaran. Tuvo muchas veces competencia con el cura de su lugar —que era hombre docto, graduado en Sigüenza—, sobre cuál había sido mejor caballero: Palmerín de Ingalaterra o Amadís de Gaula; mas maese Nicolás, barbero del mesmo pueblo, decía que ninguno llegaba al Caballero del Febo, y que si alguno se le podía comparar, era don Galaor, hermano de Amadís de Gaula, porque tenía muy acomodada condición para todo; que no era caballero melindroso, ni tan llorón como su hermano, y que en lo de la valentía no le iba en zaga.",
"words": ["caballero", "Amadís"],
"parts": 4
}
}
{
"n_words": 224,
"n_parts": 4,
"words": [
{
"word": "caballero",
"freq": 4,
"dp": 0.25,
"dp_norm": 0.3333,
"juilland_d": 0.5918,
"carroll_d2": 0.75,
"rosengren_s": 0.7286,
"kl_divergence": 0.5
},
{
"word": "amadís",
"freq": 2,
"dp": 0.5,
"dp_norm": 0.6667,
"juilland_d": 0.4226,
"carroll_d2": 0.5,
"rosengren_s": 0.5,
"kl_divergence": 1.0
}
],
"warnings": [
"The frequency of the words is below the number of parts (4): amadís. Such a word cannot get into every part, and the measures of dispersion show concentration even with the most even spread; for them decrease parts"
]
}
Parameters¶
| Parameter | Type | Default | Description |
|---|---|---|---|
text |
string |
"" |
Text |
path |
string |
null |
Absolute path to a file with the text or a link ests://datasets/... instead of text |
words |
array[string] |
null |
Words whose dispersion is needed, up to 200; not given - the most frequent words |
parts |
integer |
10 |
Number of parts of the text, from 2 to 100; the texts of a query link are the parts |
lemmatize |
boolean |
true |
Compare lemmas: the forms of a word count as one word |
top_n |
integer |
20 |
Number of the most frequent words if words is not given, up to 200 |
Result¶
| Field | Type | Description |
|---|---|---|
n_words |
integer |
Number of words in the text |
n_parts |
integer |
Number of parts: parts or the number of texts of the query link |
words |
array[object] |
Words in the order of the request or by descending frequency: the word word, the frequency freq and the dispersion measures below |
warnings |
array[string] |
The text is not in Spanish, words are not in the text, word frequencies are below the number of parts |
| Measure | Values |
|---|---|
dp |
Deviation of proportions DP of Gries, the main measure: 0 - the word is spread in proportion to the part sizes, the greatest value about 1 - 1/n_parts - all occurrences in one part |
dp_norm |
DP divided by its greatest possible value: 1 - all occurrences in the smallest part |
juilland_d |
Juilland's D: 1 - even, 0 - in one part |
carroll_d2 |
Carroll's D2 by the entropy of the distribution: 1 - even, 0 - in one part |
rosengren_s |
Rosengren's S: 1 - proportional, about 1/n_parts - in one part |
kl_divergence |
Kullback-Leibler divergence in bits: 0 - proportional, grows with concentration |