Skip to main content
Glama

Дисперсия слов

dispersion
Read-onlyIdempotent

Measure how evenly words are spread across a text to distinguish terms used throughout from those concentrated in one section, using Gries DP and related distribution metrics.

Instructions

Измерить, насколько равномерно слова распределены по тексту (дисперсия Гриса).

Используйте, чтобы отличить слово, которое проходит через весь текст, от слова, сосредоточенного в одном месте: частота их не различает. Текст делится на parts частей примерно равного размера.

В результате "n_words" - число слов текста, "words" - слова в порядке запроса или по убыванию частоты, с частотой "freq" и мерами дисперсии:

  • dp: отклонение пропорций DP Гриса, основная мера; 0 - слово распределено пропорционально размерам частей, наибольшее значение около 1 - 1/parts - все вхождения в одной части.

  • dp_norm: DP, деленное на наибольшее возможное значение; 1 - все вхождения в самой малой части.

  • juilland_d: D Жюйана; 1 - равномерно, 0 - в одной части.

  • carroll_d2: D2 Кэрролла по энтропии распределения; 1 - равномерно, 0 - в одной части.

  • rosengren_s: S Розенгрена; 1 - пропорционально, около 1/parts - в одной части.

  • kl_divergence: дивергенция Кульбака-Лейблера в битах; 0 - пропорционально, растет при сосредоточении. У слова, которого нет в тексте, частота 0 и меры null. Слово с частотой меньше parts не может попасть во все части, и его меры показывают сосредоточенность даже при самом ровном распределении. Ключ "warnings" - предупреждения: текст не на русском языке, слов нет в тексте, частота слов меньше числа частей.

Input Schema

NameRequiredDescriptionDefault
pathNoАбсолютный путь к текстовому файлу в UTF-8 на машине, где запущен сервер, вместо text: длинный текст не нужно пересылать в аргументе
textNoТекст на русском языке; вместо него можно задать path
partsNoЧисло частей текста примерно равного размера
top_nNoЧисло самых частых слов, если words не задано
wordsNoСлова, дисперсия которых нужна; не задано - самые частые слова
lemmatizeNoСравнивать леммы: формы слова считаются одним словом

Output Schema

NameRequiredDescriptionDefault

No arguments

Schema Changelog

Changes observed during successful MCP inspections.

  1. First observedv0.1.0

TDQS

A4.4/5.0
Behavior5/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

Annotations already declare this as a read-only, idempotent, closed-world operation, and the description adds substantial behavioral detail beyond that. It explains the text partitioning into parts, the meaning and direction of each dispersion measure, null handling for missing words, the frequency-below-parts caveat, and the warnings key.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness5/5

Is the description appropriately sized, front-loaded, and free of redundancy?

The description is front-loaded with purpose and usage, then structured into a compact bullet list explaining the output measures. Despite its length, every section earns its place given the number of non-obvious statistical measures and edge cases.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness5/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

For a specialized statistical tool with multiple output metrics, the description is complete: it covers purpose, use case, partitioning, measure interpretation, missing-word behavior, the low-frequency caveat, and warnings. Even though an output schema exists, the description provides the interpretive context an agent needs to use the results correctly.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters4/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

Schema description coverage is 100%, so the schema already documents all six parameters. The description adds useful semantics beyond the schema by explaining that the text is divided into parts of roughly equal size, that words appear in request order or frequency order, and that frequency relative to parts affects interpretation of the measures.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose4/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description clearly states a specific verb and resource: measuring how evenly words are distributed across a text using Gries dispersion. It also distinguishes the measure from raw frequency, which does not reveal whether a word is spread throughout the text or concentrated in one place. It does not explicitly name or differentiate itself from sibling tools such as analyze_text, keyness, or collocations.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines4/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

It gives a clear use case: use it to distinguish a word that runs through the whole text from one concentrated in a single place, which frequency alone cannot do. However, it does not explicitly state when not to use it or name alternative tools for related analyses.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.