mirror of
https://github.com/explosion/spaCy.git
synced 2024-12-26 01:46:28 +03:00
* Test that whitespace is not assigned a tag
This commit is contained in:
parent
b5223c4824
commit
7d2964f673
26
tests/tagger/test_spaces.py
Normal file
26
tests/tagger/test_spaces.py
Normal file
|
@ -0,0 +1,26 @@
|
|||
"""Ensure spaces are assigned the POS tag SPACE"""
|
||||
|
||||
|
||||
from __future__ import unicode_literals
|
||||
from spacy.parts_of_speech import SPACE
|
||||
|
||||
import pytest
|
||||
|
||||
|
||||
|
||||
@pytest.fixture
|
||||
def tagged(EN):
|
||||
string = u'Some\nspaces are\tnecessary.'
|
||||
tokens = EN(string, tag=True, parse=False)
|
||||
return tokens
|
||||
|
||||
def test_spaces(tagged):
|
||||
assert tagged[0].pos != SPACE
|
||||
assert tagged[0].pos_ != 'SPACE'
|
||||
assert tagged[1].pos == SPACE
|
||||
assert tagged[1].pos_ == 'SPACE'
|
||||
assert tagged[1].tag_ == 'SP'
|
||||
assert tagged[2].pos != SPACE
|
||||
assert tagged[3].pos != SPACE
|
||||
assert tagged[4].pos == SPACE
|
||||
|
Loading…
Reference in New Issue
Block a user