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

Function test_simple_train

spacy/tests/pipeline/test_textcat.py:309–325  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

307
308@pytest.mark.skip(reason="Test is flakey when run with others")
309def test_simple_train():
310 nlp = Language()
311 textcat = nlp.add_pipe("textcat")
312 textcat.add_label("answer")
313 nlp.initialize()
314 for i in range(5):
315 for text, answer in [
316 ("aaaa", 1.0),
317 ("bbbb", 0),
318 ("aa", 1.0),
319 ("bbbbbbbbb", 0.0),
320 ("aaaaaa", 1),
321 ]:
322 nlp.update((text, {"cats": {"answer": answer}}))
323 doc = nlp("aaa")
324 assert "answer" in doc.cats
325 assert doc.cats["answer"] >= 0.5
326
327
328@pytest.mark.skip(reason="Test is flakey when run with others")

Callers

nothing calls this directly

Calls 6

add_pipeMethod · 0.95
initializeMethod · 0.95
updateMethod · 0.95
LanguageClass · 0.90
nlpFunction · 0.70
add_labelMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…