Exemplo n.º 1
0
def check_tag_sentence(tokenize=False):
    """
    Check tag_sentence method with and without tokenization
    """
    from tests import tagger

    sentence = "I'm going to the market." if tokenize else "I 'm going to the market ."
    correct_output = "I/PRP 'm/VBP going/VBG to/TO the/DT market/NN ./."
    tagged_sentence = tagger.tag_sentence(sentence, tokenize=tokenize)

    assert_equal(tagged_sentence, correct_output)
Exemplo n.º 2
0
def check_tag_sentence(tokenize=False):
    """
    Check tag_sentence method with and without tokenization
    """
    from tests import tagger

    sentence = "I'm going to the market." if tokenize else "I 'm going to the market ."
    correct_output = "I/PRP 'm/VBP going/VBG to/TO the/DT market/NN ./."
    tagged_sentence = tagger.tag_sentence(sentence, tokenize=tokenize)

    assert_equal(tagged_sentence, correct_output)
Exemplo n.º 3
0
def test_zpar_bugfix_tags():
    from tests import tagger

    sentences = [
        'REBELLION', 'I am going away .',
        'The rebellion is just another word for change and change is necessary to live .',
        'REBELLION', 'REBELLION',
        'The rebellion is just another word for change and change is necessary to live .',
        'REBELLION', 'This is just another sentence .', 'REBELLION'
    ]

    # tag the above sentences
    tagged_sentences = [tagger.tag_sentence(s) for s in sentences]

    # get the tags for all of the all-caps single-word sentences
    # and make sure they are all NNP
    indices_to_check = [0, 3, 4, 6, 8]
    tags_to_check = [
        tagged_sentences[i].split('/')[1] for i in indices_to_check
    ]
    assert_equal(set(tags_to_check), {'NNP'})
Exemplo n.º 4
0
def test_zpar_bugfix_tags():
    from tests import tagger

    sentences = ['REBELLION',
                 'I am going away .',
                 'The rebellion is just another word for change and change is necessary to live .',
                 'REBELLION',
                 'REBELLION',
                 'The rebellion is just another word for change and change is necessary to live .',
                 'REBELLION',
                 'This is just another sentence .',
                 'REBELLION']

    # tag the above sentences
    tagged_sentences = [tagger.tag_sentence(s) for s in sentences]

    # get the tags for all of the all-caps single-word sentences
    # and make sure they are all NNP
    indices_to_check = [0, 3, 4, 6, 8]
    tags_to_check = [tagged_sentences[i].split('/')[1] for i in indices_to_check]
    assert_equal(set(tags_to_check), {'NNP'})