mirror of
https://github.com/explosion/spaCy.git
synced 2025-08-07 05:40:20 +03:00
Simplify cats specs
This commit is contained in:
parent
51f61b823e
commit
38abc802a6
|
@ -152,7 +152,7 @@ def test_evaluate_no_pipe(nlp):
|
||||||
def test_evaluate_textcat_multilabel(nlp_tcm):
|
def test_evaluate_textcat_multilabel(nlp_tcm):
|
||||||
"""Test that evaluate works with a multilabel textcat pipe."""
|
"""Test that evaluate works with a multilabel textcat pipe."""
|
||||||
text = "hello world"
|
text = "hello world"
|
||||||
annots = {"doc_annotation": {"cats": {"FEATURE": 1.0, "QUESTION": 1.0}}}
|
annots = {"cats": {"FEATURE": 1.0, "QUESTION": 1.0}}
|
||||||
doc = Doc(nlp_tcm.vocab, words=text.split(" "))
|
doc = Doc(nlp_tcm.vocab, words=text.split(" "))
|
||||||
example = Example.from_dict(doc, annots)
|
example = Example.from_dict(doc, annots)
|
||||||
scores = nlp_tcm.evaluate([example])
|
scores = nlp_tcm.evaluate([example])
|
||||||
|
@ -169,8 +169,13 @@ def test_evaluate_multiple_textcat(nlp_tc_tcm):
|
||||||
with more than one textcat or textcat_multilabel."""
|
with more than one textcat or textcat_multilabel."""
|
||||||
text = "hello world"
|
text = "hello world"
|
||||||
annots = {
|
annots = {
|
||||||
"doc_annotation": {
|
"cats": {
|
||||||
"cats": {"FEATURE": 1.0, "QUESTION": 1.0, "POSITIVE": 1.0, "NEGATIVE": 0.0}
|
"POSITIVE": 1.0,
|
||||||
|
"NEGATIVE": 0.0,
|
||||||
|
"FEATURE": 1.0,
|
||||||
|
"QUESTION": 1.0,
|
||||||
|
"POSITIVE": 1.0,
|
||||||
|
"NEGATIVE": 0.0,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
doc = Doc(nlp_tc_tcm.vocab, words=text.split(" "))
|
doc = Doc(nlp_tc_tcm.vocab, words=text.split(" "))
|
||||||
|
|
Loading…
Reference in New Issue
Block a user