Stanford NLP Tagger via NLTK - tag_sents splits everything into chars

前端 未结 2 1511
爱一瞬间的悲伤
爱一瞬间的悲伤 2021-01-21 10:23

I\'m hoping someone has experience with this as I\'m unable to find any comments online besides a bug report from 2015 regarding the NERtagger which is probably the same.

<
2条回答
  •  北海茫月
    2021-01-21 11:11

    The tag_sents function takes a list of list of strings.

    tagger.tag_sents(word_tokenize("The quick brown fox jumps over the lazy dog."))
    

    Here's a useful idiom:

     tagger.tag_sents(word_tokenize(sent) for sent in sent_tokenize(text))
    

    where text is a string.

提交回复
热议问题