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

Function test_applycli_mixed

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

Source from the content-addressed store, hash-verified

984
985
986def test_applycli_mixed():
987 with make_tempdir() as data_path:
988 output = data_path / "testout.spacy"
989 text = "Testing apply cli"
990 nlp = spacy.blank("en")
991 doc = nlp(text)
992 jsonl_data = [{"text": text}]
993 srsly.write_jsonl(data_path / "test.jsonl", jsonl_data)
994 docbin = DocBin()
995 docbin.add(doc)
996 docbin.to_disk(data_path / "testin.spacy")
997 with open(data_path / "test.txt", "w") as ftest:
998 ftest.write(text)
999 apply(data_path, output, "blank:en", "text", 1, 1)
1000 # Check whether it worked
1001 result = list(DocBin().from_disk(output).get_docs(nlp.vocab))
1002 assert len(result) == 3
1003 for doc in result:
1004 assert doc.text == text
1005
1006
1007def test_applycli_user_data():

Callers

nothing calls this directly

Calls 8

addMethod · 0.95
to_diskMethod · 0.95
DocBinClass · 0.90
applyFunction · 0.90
make_tempdirFunction · 0.85
get_docsMethod · 0.80
nlpFunction · 0.70
from_diskMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…