Stanford parser Python : Combine NER and POS tags
-
22-10-2019 - |
Question
Hi I am experimenting with stanford parser and NER with python
Input = "Rami Eid is studying at Stony Brook University in NY"
Parser Output:
NER Output :
[(u'Rami', u'PERSON'), (u'Eid', u'PERSON'), (u'is', u'O'), (u'studying', u'O'), (u'at', u'O'), (u'Stony', u'ORGANIZATION'), (u'Brook', u'ORGANIZATION'), (u'University', u'ORGANIZATION'), (u'in', u'O'), (u'NY', u'O')]
Now can I combine NER results with Parser result ?
So that
(u'Rami', u'NNP'), (u'Eid', u'NNP') ==> u('Rami EID', u'PERSON')
(u'Stony', u'NNP'), (u'Brook', u'NNP'), (u'University', u'NNP') ==> (u'Stony Brook University',u'ORGANIZATION')
will get replaced in the graph
How this can be done ?
Solution
This question has already been answered. See Alexis' answer at https://stackoverflow.com/questions/30664677/extract-list-of-persons-and-organizations-using-stanford-ner-tagger-in-nltk
If you want to use chunking NER without the Stanford library see alvas' answer at https://stackoverflow.com/questions/31836058/nltk-named-entity-recognition-to-a-python-list
Licensed under: CC-BY-SA with attribution
Not affiliated with datascience.stackexchange