2015-10-10 05:03:13 +00:00
|
|
|
from __future__ import unicode_literals
|
|
|
|
|
|
|
|
import pytest
|
2016-01-18 22:04:38 +00:00
|
|
|
import numpy
|
|
|
|
from spacy.attrs import HEAD
|
|
|
|
|
2015-10-10 05:03:13 +00:00
|
|
|
|
|
|
|
@pytest.mark.models
|
|
|
|
def test_space_attachment(EN):
|
|
|
|
sentence = 'This is a test.\nTo ensure spaces are attached well.'
|
|
|
|
doc = EN(sentence)
|
|
|
|
|
2015-10-14 16:20:51 +00:00
|
|
|
for sent in doc.sents:
|
2015-10-14 16:24:57 +00:00
|
|
|
if len(sent) == 1:
|
|
|
|
assert not sent[-1].is_space
|
2016-01-18 22:04:38 +00:00
|
|
|
|
|
|
|
|
|
|
|
def test_sentence_space(EN):
|
|
|
|
text = ('''I look forward to using Thingamajig. I've been told it will '''
|
|
|
|
'''make my life easier...''')
|
|
|
|
doc = EN(text)
|
|
|
|
assert len(list(doc.sents)) == 2
|
|
|
|
|