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

Function test_en_sentence_breaks

spacy/tests/lang/en/test_sbd.py:32–46  ·  view source on GitHub ↗
(en_vocab, en_parser)

Source from the content-addressed store, hash-verified

30 reason="The step_through API was removed (but should be brought back)"
31)
32def test_en_sentence_breaks(en_vocab, en_parser):
33 # fmt: off
34 words = ["This", "is", "a", "sentence", ".", "This", "is", "another", "one", "."]
35 heads = [1, 1, 3, 1, 1, 6, 6, 8, 6, 6]
36 deps = ["nsubj", "ROOT", "det", "attr", "punct", "nsubj", "ROOT", "det",
37 "attr", "punct"]
38 transition = ["L-nsubj", "S", "L-det", "R-attr", "D", "R-punct", "B-ROOT",
39 "L-nsubj", "S", "L-attr", "R-attr", "D", "R-punct"]
40 # fmt: on
41 doc = Doc(en_vocab, words=words, heads=heads, deps=deps)
42 apply_transition_sequence(en_parser, doc, transition)
43 assert len(list(doc.sents)) == 2
44 for token in doc:
45 assert token.dep != 0 or token.is_space
46 assert [token.head.i for token in doc] == [1, 1, 3, 1, 1, 6, 6, 8, 6, 6]

Callers

nothing calls this directly

Calls 1

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…