aeba99ab0d9cf3967ef54f3a1c509c9d496ce4b3,spacy/tests/doc/test_span_merge.py,,test_spans_merge_tokens,#Any#,11
Before Change
assert len(doc) == 4
assert doc[0].head.text == "Angeles"
assert doc[1].head.text == "start"
doc.merge(0, len("Los Angeles"), tag="NNP", lemma="Los Angeles", ent_type="GPE")
assert len(doc) == 3
assert doc[0].text == "Los Angeles"
assert doc[0].head.text == "start"
After Change
text = "Los Angeles start."
heads = [1, 1, 0, -1]
tokens = en_tokenizer(text)
doc = get_doc(tokens.vocab, [t.text for t in tokens], heads=heads)
assert len(doc) == 4
assert doc[0].head.text == "Angeles"
assert doc[1].head.text == "start"
with doc.retokenize() as retokenizer:
retokenizer.merge(doc[0 : 2], attrs={"tag":"NNP", "lemma":"Los Angeles", "ent_type":"GPE"})
assert len(doc) == 3
assert doc[0].text == "Los Angeles"
assert doc[0].head.text == "start"
assert doc[0].ent_type_ == "GPE"
In pattern: SUPERPATTERN
Frequency: 3
Non-data size: 7
Instances
Project Name: explosion/spaCy
Commit Name: aeba99ab0d9cf3967ef54f3a1c509c9d496ce4b3
Time: 2018-09-10
Author: 33332500+grivaz@users.noreply.github.com
File Name: spacy/tests/doc/test_span_merge.py
Class Name:
Method Name: test_spans_merge_tokens
Project Name: explosion/spaCy
Commit Name: 5651a0d052bcfd160b187828aa3d8d90652929fe
Time: 2019-02-15
Author: ines@ines.io
File Name: spacy/tests/doc/test_doc_api.py
Class Name:
Method Name: test_doc_api_merge_hang
Project Name: explosion/spaCy
Commit Name: 5651a0d052bcfd160b187828aa3d8d90652929fe
Time: 2019-02-15
Author: ines@ines.io
File Name: spacy/tests/doc/test_span_merge.py
Class Name:
Method Name: test_spans_merge_tokens
Project Name: explosion/spaCy
Commit Name: aeba99ab0d9cf3967ef54f3a1c509c9d496ce4b3
Time: 2018-09-10
Author: 33332500+grivaz@users.noreply.github.com
File Name: spacy/tests/doc/test_span_merge.py
Class Name:
Method Name: test_spans_merge_tokens