How to implement Stanford NER in Python?

897    Asked by NakanoHase in Data Science , Asked on Dec 12, 2019
Answered by Nakano Hase

To implement Stanford NER, we first need to implement proper tagger and word tokenizer to tokenize the words of a sentence.


from nltk.tag import StanfordNERTagger

from nltk.tokenize import word_tokenize

st = StanfordNERTagger()

text = ‘Put your text here’

tokenized_text = word_tokenize(text)

classified_text = st.tag(tokenized_text)

print(classified_text)

Here, classified_text will tag the words that are tokenized by using word tokenizer assigned to the variable ‘tokenized_text’.



Your Answer

Interviews

Parent Categories