MCPcopy
hub / github.com/explosion/spaCy / test_frequency_distribution_is_correct

Function test_frequency_distribution_is_correct

spacy/tests/test_cli.py:864–873  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

862
863
864def test_frequency_distribution_is_correct():
865 nlp = English()
866 docs = [
867 Doc(nlp.vocab, words=["Bank", "of", "China"]),
868 Doc(nlp.vocab, words=["China"]),
869 ]
870
871 expected = Counter({"china": 0.5, "bank": 0.25, "of": 0.25})
872 freq_distribution = _get_distribution(docs, normalize=True)
873 assert freq_distribution == expected
874
875
876def test_kl_divergence_computation_is_correct():

Callers

nothing calls this directly

Calls 2

EnglishClass · 0.90
_get_distributionFunction · 0.90

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…