spaCy/tests/spans/test_span.py

22 lines
410 B
Python
Raw Normal View History

2015-04-07 02:52:25 +00:00
from __future__ import unicode_literals
from spacy.en import English
import pytest
@pytest.fixture
def doc():
2015-06-07 14:55:11 +00:00
EN = English()
2015-04-07 02:52:25 +00:00
return EN('This is a sentence. This is another sentence. And a third.')
def test_sent_spans(doc):
sents = list(doc.sents)
assert sents[0].start == 0
assert sents[0].end == 5
assert len(sents) == 3
assert sum(len(sent) for sent in sents) == len(doc)