mirror of
https://github.com/explosion/spaCy.git
synced 2025-02-05 14:10:34 +03:00
d99a9cbce9
space tokens are now always attached to the previous non-space token there are two exceptions: leading space tokens are attached to the first following non-space token in input that consists exclusively of space tokens, the last space token is the head of all others.
22 lines
434 B
Python
22 lines
434 B
Python
from __future__ import unicode_literals
|
|
|
|
import pytest
|
|
|
|
|
|
@pytest.mark.models
|
|
def test_root(EN):
|
|
tokens = EN(u"i don't have other assistance")
|
|
for t in tokens:
|
|
assert t.dep != 0, t.orth_
|
|
|
|
|
|
@pytest.mark.models
|
|
def test_one_word_sentence(EN):
|
|
# one word sentence
|
|
doc = EN.tokenizer.tokens_from_list(['Hello'])
|
|
EN.tagger(doc)
|
|
assert len(doc) == 1
|
|
with EN.parser.step_through(doc) as _:
|
|
pass
|
|
assert doc[0].dep != 0
|