5651a0d052bcfd160b187828aa3d8d90652929fe,spacy/tests/doc/test_span_merge.py,,test_span_np_merges,#Any#,69
Before Change
assert doc[4].head.i == 1
doc.merge(
doc[2].idx, doc[4].idx + len(doc[4]), tag="NP", lemma="tool", ent_type="O"
)
assert doc[2].head.i == 1
After Change
tokens = en_tokenizer(text)
doc = get_doc(tokens.vocab, words=[t.text for t in tokens], heads=heads)
assert doc[4].head.i == 1
with doc.retokenize() as retokenizer:
attrs = {"tag": "NP", "lemma": "tool", "ent_type": "O"}
retokenizer.merge(doc[2:5], attrs=attrs)
assert doc[2].head.i == 1
text = "displaCy is a lightweight and modern dependency parse tree visualization tool built with CSS3 and JavaScript."
heads = [1, 0, 8, 3, -1, -2, 4, 3, 1, 1, -9, -1, -1, -1, -1, -2, -15]
In pattern: SUPERPATTERN
Frequency: 3
Non-data size: 12
Instances
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_span_np_merges
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_heads
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_span_np_merges
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_children