[(u'While', u'O'), (u'in', u'O'), (u'France', u'LOCATION'), (u',', u'O'), (u'Christine', u'PERSON'), (u'Lagarde', u'PERSON'), (u'discussed', u'O'), (u'short-term', u'O'), (u'stimulus', u'O'), (u'efforts', u'O'), (u'in', u'O'), (u'a', u'O'), (u'recent', u'O'), (u'interview', u'O'), (u'with', u'O'), (u'the', u'O'), (u'Wall', u'ORGANIZATION'), (u'Street', u'ORGANIZATION'), (u'Journal', u'ORGANIZATION'), (u'.', u'O')]
Last active
August 15, 2016 07:58
-
-
Save manashmandal/0ed7b7980433e8fec4ccc8eeaa981eb7 to your computer and use it in GitHub Desktop.
StanfordParser Test Code
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from nltk.tag import StanfordNERTagger | |
from nltk.tokenize import word_tokenize | |
# Change the path according to your system | |
stanford_classifier = 'D:\StanfordParser\stanford-ner-2015-12-09\classifiers\english.all.3class.distsim.crf.ser.gz' | |
stanford_ner_path = 'D:\StanfordParser\stanford-ner-2015-12-09\stanford-ner.jar' | |
# Creating Tagger Object | |
st = StanfordNERTagger(stanford_classifier, stanford_ner_path, 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 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment