mirror of
https://github.com/explosion/spaCy.git
synced 2025-03-03 19:08:06 +03:00
* Add test for reading in POS tags
This commit is contained in:
parent
224bdae996
commit
077885637d
15
tests/test_read_pos.py
Normal file
15
tests/test_read_pos.py
Normal file
|
@ -0,0 +1,15 @@
|
||||||
|
import py.test
|
||||||
|
from spacy.pos_util import realign_tagged
|
||||||
|
from spacy.pos_util import _parse_line
|
||||||
|
|
||||||
|
def test_realign():
|
||||||
|
rules = ["<SEP>,", "ca<SEP>n't", "``<SEP>"]
|
||||||
|
tagged = "``/`` I/PRP ca/MD n't/RB"
|
||||||
|
assert realign_tagged(rules, tagged) == "``<SEP>I/``_PRP ca<SEP>n't/MD_RB"
|
||||||
|
|
||||||
|
|
||||||
|
def test_parse_line():
|
||||||
|
line = "Pierre/NNP Vinken,/NNP_, isn't/VBZ_RB 61/CD years/NNS old./RB_.\n"
|
||||||
|
tokens, tags = _parse_line(line, '/')
|
||||||
|
assert len(tokens) == len(tags)
|
||||||
|
assert len(tokens) == 9
|
Loading…
Reference in New Issue
Block a user