How is Stanford NER different from other tools? How to implement Stanford NER in Python?

890    Asked by MatsudaHara in Data Science , Asked on Dec 18, 2019
Answered by Matsuda Hara

Stanford NER is fully implemented by JAVA and it uses the concept of linear chain conditional random fields sequence models. Since it uses such advanced statistical extraction features, hence it is slightly expensive and less used compared to other NER classifiers such as Nltk and Spacy.



The above figure shows how the algorithm of Stanford NER works.

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