简体   繁体   中英

text-mining: Determine to which noun a verb refers?

I'm trying to find a package/library which enables me to determine to which noun a verb refers (in Python):

The man was walking down the street

That this will give me a result like walking refers to man.
I tried to use nltk however as far as I could find out I can only tag the wordst as nouns/verbs etc. but cannot infer any references from this.

Question
Are there any packages which are capable to do the above?

I think what you want to do is explore the syntactic dependencies among words. For that, you need to parse your text with a syntactic parser.

Since you want to know the references between nouns and verbs you will need to do two things.

You need to get the part-of-speech tags associated to each words (ie the morphology associated to each word, wether it's a ADJ, DET, VERB, NOUN, etc.) then you want to select the ones tagged as verbs and nouns.

Then, you want to look at which other words they connect with, I think mostly you will want to explore the 'nsubj' dependency.

spaCy is a NLP library for Python that performs syntactic parsing, and also has a on-line demo, if you want to try it out, check:

https://demos.explosion.ai/displacy/

Here is the output for the example you gave:

在此处输入图片说明

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM