Catalog.with_comparisons
Catalog.with_comparisons ¶
Returns a new catalog with comparisons added to it.
New comparisons will overwrite existing comparisons with the same name.
Example
import wordlevel as wl
cl = wl.Catalog.from_dict_of_freqs(
{
"before": {"good": 12, "bad": 8, "happy": 6, "sad": 4},
"after": {"good": 5, "bad": 7, "happy": 3, "sad": 9},
}
)
cl = cl.with_comparisons(
wl.comp("before", "after").score.kld().alias("kld_comparison"),
wl.comp("before", "after").score.jsd().alias("jsd_comparison"),
)
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
|
Comparison
|
The comparisons to add to the catalog |
()
|
Returns:
| Type | Description |
|---|---|
Catalog
|
The catalog with the comparisons added to it |