From c1039fa4b41fc0586de6401b347d2712355faba9 Mon Sep 17 00:00:00 2001 From: Matthew Honnibal Date: Sat, 16 Jan 2016 15:37:47 +0100 Subject: [PATCH] * Add test for Issue #214. Resolved in change to Span.root --- spacy/tests/tokens/test_merge.py | 14 ++++++++++++++ 1 file changed, 14 insertions(+) create mode 100644 spacy/tests/tokens/test_merge.py diff --git a/spacy/tests/tokens/test_merge.py b/spacy/tests/tokens/test_merge.py new file mode 100644 index 000000000..944a62d0a --- /dev/null +++ b/spacy/tests/tokens/test_merge.py @@ -0,0 +1,14 @@ +from __future__ import unicode_literals +from spacy.en import English +import numpy as np +from spacy.attrs import HEAD + + +def test_merge_hang(): + text = 'through North and South Carolina' + EN = English(parser=False) + doc = EN(text, tag=True) + heads = np.asarray([[0, 3, -1, -2, -4]], dtype='int32') + doc.from_array([HEAD], heads.T) + doc.merge(18, 32, '', '', 'ORG') + doc.merge(8, 32, '', '', 'ORG')