# -*- coding: utf-8 -*-
"""
Tests for nltk.pos_tag
"""

import unittest

from nltk.tag import word_tokenize, pos_tag

    >>> from nltk import pos_tag, word_tokenize
    >>> pos_tag(word_tokenize("John's big idea isn't all that bad."))
    [('John', 'NNP'), ("'s", 'POS'), ('big', 'JJ'), ('idea', 'NN'), ('is', 'VBZ'),
    ("n't", 'RB'), ('all', 'PDT'), ('that', 'DT'), ('bad', 'JJ'), ('.', '.')]

A Russian tagger is also available if you specify lang="rus". It uses
the Russian National Corpus tagset:

    >>> pos_tag(word_tokenize("Илья оторопел и дважды перечитал бумажку."), lang='rus')



class TestPosTag(unittest.TestCase):
    def test_pos_tag_eng(self):
        text = "John's big idea isn't all that bad."
        expected_tagged = [('John', 'NNP'), ("'s", 'POS'), ('big', 'JJ'),
                           ('idea', 'NN'), ('is', 'VBZ'), ("n't", 'RB'),
                           ('all', 'PDT'), ('that', 'DT'), ('bad', 'JJ'),
                           ('.', '.')]
        assert pos_tag(word_tokenize(text)) == expected_tagged

    def test_pos_tag_eng_universal(self):
        text = "John's big idea isn't all that bad."
        expected_tagged = [('John', 'NOUN'), ("'s", 'PRT'), ('big', 'ADJ'),
                           ('idea', 'NOUN'), ('is', 'VERB'), ("n't", 'ADV'),
                           ('all', 'DET'), ('that', 'DET'), ('bad', 'ADJ'),
                           ('.', '.')]
        assert pos_tag(word_tokenize(text), tagset='universal') == expected_tagged

    def test_pos_tag_rus(self):
        text = u"Илья оторопел и дважды перечитал бумажку."
        expected_tagged = [('Илья', 'S'), ('оторопел', 'V'), ('и', 'CONJ'),
                           ('дважды', 'ADV'), ('перечитал', 'V'),
                           ('бумажку', 'S'), ('.', 'NONLEX')]
        assert pos_tag(word_tokenize(text), lang='rus') == expected_tagged

    def test_pos_tag_rus(self):
        text = u"Илья оторопел и дважды перечитал бумажку."
        expected_tagged = [('Илья', 'NOUN'), ('оторопел', 'VERB'),
                           ('и', 'SCONJ'), ('дважды', 'ADV'),
                           ('перечитал', 'VERB'), ('бумажку', 'NOUN'),
                           ('.', 'X')]
        assert pos_tag(word_tokenize(text),  tagset='universal', lang='rus') == expected_tagged

@@ -115,486 +115,8 @@
 ag%0A%0A
-    %3E%3E%3E from nltk import pos_tag, word_tokenize%0A    %3E%3E%3E pos_tag(word_tokenize(%22John's big idea isn't all that bad.%22))%0A    %5B('John', 'NNP'), (%22's%22, 'POS'), ('big', 'JJ'), ('idea', 'NN'), ('is', 'VBZ'),%0A    (%22n't%22, 'RB'), ('all', 'PDT'), ('that', 'DT'), ('bad', 'JJ'), ('.', '.')%5D%0A%0AA Russian tagger is also available if you specify lang=%22rus%22. It uses%0Athe Russian National Corpus tagset:%0A%0A    %3E%3E%3E pos_tag(word_tokenize(%22%D0%98%D0%BB%D1%8C%D1%8F %D0%BE%D1%82%D0%BE%D1%80%D0%BE%D0%BF%D0%B5%D0%BB %D0%B8 %D0%B4%D0%B2%D0%B0%D0%B6%D0%B4%D1%8B %D0%BF%D0%B5%D1%80%D0%B5%D1%87%D0%B8%D1%82%D0%B0%D0%BB %D0%B1%D1%83%D0%BC%D0%B0%D0%B6%D0%BA%D1%83.%22), lang='rus')%0A%0A%0A%0A
 clas

remove erronous text in test file