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"
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"
def make_sentence(text, typed_parse): pos, words = make_pos_tokens(typed_parse) return AnnotatedSentence.from_tokens(text, words, pos)