From 08e29519a62900d6ed6efe52f73476606aab163d Mon Sep 17 00:00:00 2001 From: Matthew Honnibal Date: Sat, 10 Oct 2015 16:03:13 +1100 Subject: [PATCH] * Add test for how spaces are attached by the parser. --- tests/parser/test_space_attachment.py | 12 ++++++++++++ 1 file changed, 12 insertions(+) create mode 100644 tests/parser/test_space_attachment.py diff --git a/tests/parser/test_space_attachment.py b/tests/parser/test_space_attachment.py new file mode 100644 index 000000000..73cf22cea --- /dev/null +++ b/tests/parser/test_space_attachment.py @@ -0,0 +1,12 @@ +from __future__ import unicode_literals + +import pytest + +@pytest.mark.models +def test_space_attachment(EN): + sentence = 'This is a test.\nTo ensure spaces are attached well.' + doc = EN(sentence) + + for word in doc: + if word.is_space: + assert word.head.i == (word.i - 1)