mirror of
https://github.com/explosion/spaCy.git
synced 2024-12-24 17:06:29 +03:00
* Test for Issue #43: TAG attribute not working in array export
This commit is contained in:
parent
f9e510a893
commit
6674d719a5
|
@ -7,11 +7,9 @@ from spacy.en import English
|
||||||
from spacy.en import attrs
|
from spacy.en import attrs
|
||||||
|
|
||||||
|
|
||||||
@pytest.fixture
|
EN = English()
|
||||||
def EN():
|
|
||||||
return English()
|
|
||||||
|
|
||||||
def test_attr_of_token(EN):
|
def test_attr_of_token():
|
||||||
text = u'An example sentence.'
|
text = u'An example sentence.'
|
||||||
tokens = EN(text)
|
tokens = EN(text)
|
||||||
example = EN.vocab[u'example']
|
example = EN.vocab[u'example']
|
||||||
|
@ -20,3 +18,14 @@ def test_attr_of_token(EN):
|
||||||
assert feats_array[0][0] != feats_array[0][1]
|
assert feats_array[0][0] != feats_array[0][1]
|
||||||
|
|
||||||
|
|
||||||
|
def test_tag():
|
||||||
|
text = u'A nice sentence.'
|
||||||
|
tokens = EN(text)
|
||||||
|
assert tokens[0].tag != tokens[1].tag != tokens[2].tag != tokens[3].tag
|
||||||
|
feats_array = tokens.to_array((attrs.ORTH, attrs.TAG))
|
||||||
|
assert feats_array[0][1] == tokens[0].tag
|
||||||
|
assert feats_array[1][1] == tokens[1].tag
|
||||||
|
assert feats_array[2][1] == tokens[2].tag
|
||||||
|
assert feats_array[3][1] == tokens[3].tag
|
||||||
|
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue
Block a user