Name Entity Resolution NLTK

100 views
Skip to first unread message

Richard Parker

unread,
Mar 3, 2016, 12:55:46 PM3/3/16
to nltk-users
Dear Group,

NLTK has a good solution for Name Entity Recognition. We can also do by using PoS Tagger.
I am trying to solve name entity resolution. May I use NLTK for the same?

Please suggest.

Regards,
Richard Parker

14250...@qq.com

unread,
Mar 15, 2016, 4:56:30 AM3/15/16
to nltk-users
#here is an example:
sent="Deletion of the ADH6 gene has no significant effect on the expression of the ADH7 gene."
words=nltk.word_tokenize(sent)
tags=nltk.pos_tag(words)
chunks=nltk.ne_chunk(tags,binary=True)
NE=[]
for a in chunks.subtrees():
    if a.label()=="NE":
        NE.append(a[0][0])
print(NE)
#we can get three named entity:['Deletion', 'ADH6', 'ADH7']

I hope this can help you.

在 2016年3月4日星期五 UTC+8上午1:55:46,Richard Parker写道:

Alexis

unread,
Mar 15, 2016, 5:58:11 AM3/15/16
to nltk-...@googlegroups.com
Note that named entities can consist of more than one word, but this command will extract only the first one:

    if a.label()=="NE":
        NE.append(a[0][0])

To make a "flat" list of the named entities, it is better to use join() to make a single string from the words of each NE (also works for one-word NEs)
 
    if a.label()=="NE":
        NE.append(" ".join(wrd for wrd, tag in a))


Alexis

--
You received this message because you are subscribed to the Google Groups "nltk-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to nltk-users+...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply all
Reply to author
Forward
0 new messages