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

Function make_examples

spacy/tests/test_cli.py:1024–1046  ·  view source on GitHub ↗
(nlp: Language)

Source from the content-addressed store, hash-verified

1022
1023def test_cli_find_threshold(capsys):
1024 def make_examples(nlp: Language) -> List[Example]:
1025 docs: List[Example] = []
1026
1027 for t in [
1028 (
1029 "I am angry and confused in the Bank of America.",
1030 {
1031 "cats": {"ANGRY": 1.0, "CONFUSED": 1.0, "HAPPY": 0.0},
1032 "spans": {"sc": [(31, 46, "ORG")]},
1033 },
1034 ),
1035 (
1036 "I am confused but happy in New York.",
1037 {
1038 "cats": {"ANGRY": 0.0, "CONFUSED": 1.0, "HAPPY": 1.0},
1039 "spans": {"sc": [(27, 35, "GPE")]},
1040 },
1041 ),
1042 ]:
1043 doc = nlp.make_doc(t[0])
1044 docs.append(Example.from_dict(doc, t[1]))
1045
1046 return docs
1047
1048 def init_nlp(
1049 components: Tuple[Tuple[str, Dict[str, Any]], ...] = (),

Callers 1

init_nlpFunction · 0.70

Calls 3

make_docMethod · 0.80
appendMethod · 0.80
from_dictMethod · 0.80

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…