You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

31 lines
695 B
Python

4 years ago
# -*- coding: utf-8 -*-
from __future__ import absolute_import, unicode_literals
def test_basic():
from nltk.tag import pos_tag
from nltk.tokenize import word_tokenize
result = pos_tag(word_tokenize("John's big idea isn't all that bad."))
assert result == [
('John', 'NNP'),
("'s", 'POS'),
('big', 'JJ'),
('idea', 'NN'),
('is', 'VBZ'),
("n't", 'RB'),
('all', 'PDT'),
('that', 'DT'),
('bad', 'JJ'),
('.', '.'),
]
def setup_module(module):
from nose import SkipTest
try:
import numpy
except ImportError:
raise SkipTest("numpy is required for nltk.test.test_tag")