Created
April 10, 2018 11:59
-
-
Save charlesBochet/c6761f93fa77c2578ee45d3296c281b0 to your computer and use it in GitHub Desktop.
This file contains 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
# coding: utf-8 | |
import nltk | |
from nltk.tag.stanford import StanfordNERTagger | |
# Optional | |
import os | |
java_path = "/usr/lib/jvm/java-8-oracle" | |
os.environ['JAVA_HOME'] = java_path | |
sentence = u"En 2017, une intelligence artificielle est en mesure de développer par elle-même Super Mario Bros. " \ | |
"Sans avoir eu accès au code du jeu, elle a récrée ce hit des consoles Nintendo. Des chercheurs de l'Institut " \ | |
"de Technologie de Géorgie, aux Etats-Unis, viennent de la mettre à l'épreuve." | |
jar = './stanford-ner-tagger/stanford-ner.jar' | |
model = './stanford-ner-tagger/my-ner-model-french.ser.gz' | |
ner_tagger = StanfordNERTagger(model, jar, encoding='utf8') | |
words = nltk.word_tokenize(sentence) | |
print(ner_tagger.tag(words)) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment