Comparison of corpora
compare_textsCompares two corpora of Spanish texts across 210 style features to reveal where they differ most, supporting authorship attribution and genre, translation or human-vs-model comparison.
Instructions
Compare two corpora of texts by the features of style and find where they differ most.
Use it for authorship attribution and for comparing genres, translations, texts by a person and by a model. The texts are cut in order into windows of exactly window words (whole_texts - the whole texts), 210 features of esTS are computed for every window, and the distributions of a feature in the corpora A and B are compared. The rest of a text shorter than a window and a text shorter than a window are left out: the response warns about such texts and about losing more than 10% of the words of a corpus on the rests. The comparison needs two windows at least in each corpus. The syntactic parse takes most of the time: two corpora of 250 thousand characters each are compared in about 6 seconds, of 500 thousand - in about 12. Pass the texts from files through a_paths and b_paths.
Features by prefix: basic_ - shares of long, complex, simple, mono- and polysyllabic words, of letters, spaces and marks, letters and syllables per word; readability_ - the readability formulas and the consensus grade; diversity_ - measures of lexical diversity; morph_ - shares of the parts of speech and of the features of one value among all the words (morph_pos_NOUN, morph_polarity_Neg) and of the values of the other features among the words that carry them (morph_mood_Sub, morph_tense_Imp), shares of the infinitive, gerund, participle, clitics, ser, adverbs in -mente and diminutives (morph_p_enclitics); sents_ - the mean length of a sentence in words, its standard deviation, coefficient of variation and the autocorrelation of adjacent lengths; punct_ - the marks by type per 1000 words and the share of the inverted ¿ and ¡ among the question and exclamation marks (punct_inverted_share); cohesion_ - the cohesion statistics: repetitions between sentences, pronouns, givenness, repetition of tense and mood, connectors per 1000 words; syntax_ - the statistics of the group syntax: dependency lengths, tree shape, clauses and the indices of L2SCA, chains, participial and gerund clauses, the passive and se, word order, similarity of adjacent sentences.
The result has "window" - the size of a window (null - the whole texts), "n_windows" and "n_texts" - the number of windows and texts in A and B, and "features" - the features by decreasing absolute Cliff's delta, with equal delta by the relative difference of the medians: the means over the windows "mean_a" and "mean_b", the difference of the medians A - B "median_diff" with its 95% bootstrap interval "ci_low" - "ci_high", Cliff's delta "cliff_delta" (from -1 to 1: the share of the pairs of windows where A is greater minus the share where it is smaller; in absolute value from 0.147 - a small, from 0.33 - a medium, from 0.474 - a large effect, Romano et al. 2006) and the p-value of the Mann-Whitney U test with Holm's correction for the number of features "p_holm". The windows of one text are not independent: p_holm takes them as independent and is too small when a corpus has few texts, while the bootstrap interval takes whole texts and is undefined with one text in a corpus. The key "warnings" lists the warnings: a corpus not in Spanish, texts of the corpora of different length with whole_texts, texts or their rests left out of the comparison, one text in a corpus, no significant difference.
Tool call template
This tool declares no required parameters. Add optional parameters from the input schema as needed.
{
"id": 1,
"jsonrpc": "2.0",
"method": "tools/call",
"params": {
"arguments": {},
"name": "compare_texts"
}
}Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| a | No | Texts of the first corpus (A) | |
| b | No | Texts of the second corpus (B) | |
| top_n | No | Number of the features with the largest difference | |
| window | No | Size of a window in words; not set - at most 1000 and such that the shortest text splits into two windows at least, but at least 100 | |
| a_paths | No | Absolute paths to files with the texts of corpus A or links ests://datasets/... from find_texts, with a or instead of it; a query link gives all its texts as separate texts of the corpus | |
| b_paths | No | Absolute paths to files with the texts of corpus B or links ests://datasets/... from find_texts, with b or instead of it; a query link gives all its texts as separate texts of the corpus | |
| whole_texts | No | Compare the whole texts, without windows; needs two texts at least in each corpus |
Output Schema
| Name | Required | Description | Default |
|---|---|---|---|
No arguments | |||