开发者

Is there an algorithm of identifying different forms of "You" in a sentence AKA How to parse an English sentence

How do I tell if "You" is used as a subject 开发者_JAVA百科or an object in a sentence?


You should use a Natural Language Processing tool or library. There are a wide range mentioned in http://en.wikipedia.org/wiki/List_of_natural_language_processing_toolkits and you can use the one most suitable to your problem or language.

Most of these will carry out Part-of-Speech tagging (POSTagging) which identifies nouns, prepostions, etc. Then they will group the POS into NounPhrase, verbPhrase, etc. In simple terms:

You see the cat

is parsed as

NP (PP you) VP (VB see DT the NN cat)

while

the cat sees you

is parsed as

NP (DT the NN cat) VP (VB sees PP you)

(schemes of POS vary)

The "you" is a personal pronoun (PP) and if it occurs in the VP it's an object.

It gets more complicated than this, but this is a start


NLP. See http://nlp.stanford.edu:8080/parser/


An engine you might want to try (I don't have the rep to comment being new to SE), the Attribute Logic Engine (ALE). Came across it in a grammar class in college. It's written in Prolog, which is a good language to understand if you're into Natural Language Processing, albeit a bit (read VERY) confusing.

ALE: http://www.cs.toronto.edu/~gpenn/ale.html

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜