Ejemplo n.º 1
0
    def test_from_tokens(self):
        text = "This is a test."
        tokens = "This is a test .".split()
        pos = "DT VBZ DT NN .".split()
        sentence = AnnotatedSentence.from_tokens(text, tokens)
        assert sentence.text == text
        assert len(sentence) == 5
        assert sentence[1].word == "is"

        sentence = AnnotatedSentence.from_tokens(text, tokens, pos)
        assert sentence.text == text
        assert len(sentence) == 5
        assert sentence[1].word == "is"
        assert sentence[1].pos == "VBZ"
Ejemplo n.º 2
0
 def test_from_tokens(self):
     text = "This is a test."
     tokens = "This is a test .".split()
     sentence = AnnotatedSentence.from_tokens(text, tokens)
     assert sentence.text == text
     assert len(sentence) == 5
     assert sentence[1].word == "is"
Ejemplo n.º 3
0
def make_sentence(text, typed_parse):
    pos, words = make_pos_tokens(typed_parse)
    return AnnotatedSentence.from_tokens(text, words, pos)