Stanford NLP Tagger via NLTK - tag_sents splits everything into chars

前端 未结 2 1512
爱一瞬间的悲伤
爱一瞬间的悲伤 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 10:57

    Another variation of what alvas said, which worked for me: tagger.tag_sents([[text]]).

    0 讨论(0)
  • 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.

    0 讨论(0)
提交回复
热议问题