Iām playing with NLTK. I need NER but it's not fast with many sentences. Now my code is below:
from nltk.tag import StanfordNERTagger
st = StanfordNERTagger(...)
for s in sents:
w_tokens = word_tokenize(s.strip())
ner_tags =st_ner.tag(w_tokens)
One sentence is pretty.
Input:
Barack H. Obama is the 44th President of the United States.
output:
[('Barack', 'PERSON'), ('H.', 'PERSON'), ('Obama', 'PERSON'), ('is', 'O'), ('the', 'O'), ('44th', 'O'), ('President', 'O'), ('of', 'O'), ('the', 'O'), ('United', 'LOCATION'), ('States', 'LOCATION')
But, I need handle many sentences. Do I have any method like chunk
to make me finish the job faster?