Skip to content

Result

ComparisonResult dataclass

The result of a Comparison when a plan is applied to corpus data.

Attributes:

Name Type Description
df DataFrame

The dataframe containing all scoring information for the comparison. Contains one row per token, with columns for the score, rank, attribution, and per-token contribution components.

reference str

Name of the reference corpus

comparison str

Name of the comparison corpus

alias str

The name of the comparison

method str

The name of a scoring method

is_weighted_avg bool

Whether the scoring method can be interpreted as a weighted average or difference in weighted averages

is_nonnegative bool

Whether the scoring method is inherently non-negative, i.e. all token-level contributions are non-negative

attributed_by ATTRIBUTION_TYPE

The attribution type used to split token contributions between the two bars of a bar plot. "frequency" and "rank" attribute each token to a corpus; "score_sign" attributes each token by whether it reinforces or offsets the overall difference

attribution_labels tuple[str, str]

The pair of labels the attribution produces, determined by attributed_by

parameters dict

Any parameters specific to the scoring method when making the comparison

exclusions dict[str, Any]

The exclusions applied to the vocabulary, keyed by the kind of exclusion. Each value describes what that kind of exclusion removed, e.g. {"tokens": {"the", "a"}}

normalized bool

Whether the token contributions have been normalized

normalized_by str | None

The normalization strategy applied to the token contributions, or None if they are not normalized

normalization_constant float | None

The constant by which the token contributions were divided to normalize them, or None if they are not normalized

Source