开发者

Python NLTK figure out tense

开发者 https://www.devze.com 2022-12-25 13:52 出处:网络
I have a web application that tran开发者_运维技巧slates sentences into English; the user chooses options from drop downs that basically provide the context. Now I want to turn the word and the context

I have a web application that tran开发者_运维技巧slates sentences into English; the user chooses options from drop downs that basically provide the context. Now I want to turn the word and the context into an English sentence.

One case is that the user chooses 'who' and 'when', 'who' could be: I, you, you two, he, she, we, they. 'When' could be: 'did it', 'will do it', 'might do it', 'does it', 'do it!'. So in the end I would have the word that the user put in, as well as who and when. ex. 'sing', 'you', 'did it' would get the English sentence "You sang".

Another case is with transitive verbs like "chase", there would still be 'who' and 'when' but also another option of 'done to' which is basically another 'who' menu. ex. 'chase', 'I', 'will do it', 'they' would get the English sentence "I am going to chase them".

I'm new to the NLTK so I don't really know where to start with this problem. Can anyone point me in the general direction of where to start with this?


NLTK is a fairly large project containing a lot of useful tools. I'd suggest starting out by reading the NLTK Book, which is very well done. You can probably skim the first few chapters.

The stuff you're looking for is in chapters 7 and beyond.

0

精彩评论

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