stanford ner model colab code example

Example: stanford ner model colab python

from nltk.tag import StanfordNERTagger
from nltk.tokenize import word_tokenize



st = StanfordNERTagger('/content/english.muc.7class.distsim.crf.ser.gz',
                   '/content/stanford-ner.jar',
                   encoding='utf-8')

text = 'While in France, Christine Lagarde discussed short-term stimulus efforts in a recent interview with the Wall Street Journal.'

tokenized_text = word_tokenize(text)
classified_text = st.tag(tokenized_text)

print(classified_text)