Named Entity Recognition for NLTK in Python. Identifying the NE

前端 未结 5 493
野趣味
野趣味 2021-01-30 18:25

I need to classify words into their parts of speech. Like a verb, a noun, an adverb etc.. I used the

nltk.word_tokenize() #to identify word in a sentence 
nltk.         


        
5条回答
  •  夕颜
    夕颜 (楼主)
    2021-01-30 18:42

    This will work

    for sent in chunked_sentences:
      for chunk in sent:
        if hasattr(chunk, "label"):
            print(chunk.label())
    

提交回复
热议问题