Python NLTK 计算时态

发布于 2024-08-26 23:56:49 字数 426 浏览 8 评论 0原文

我有一个可以将句子翻译成英语的网络应用程序;用户从基本上提供上下文的下拉菜单中选择选项。现在我想把这个单词和上下文变成一个英语句子。

一种情况是用户选择“谁”和“何时”,“谁”可以是:我、你、你们两个、他、她、我们、他们。 “何时”可以是:“做了”、“将做”、“可能做”、“做”、“做!”。所以最后我会得到用户输入的单词,以及用户输入的内容和时间。前任。 'sing'、'you'、'did it' 会得到英语句子“You sang”。

另一种情况是像“chase”这样的及物动词,仍然会有“who”和“when”,但还有另一个“done to”选项,这基本上是另一个“who”菜单。前任。 'chase', 'I', 'will do it', 'they' 会得到英语句子“我要追他们”。

我是 NLTK 的新手,所以我真的不知道从哪里开始解决这个问题。谁能指出我从哪里开始的大致方向?

I have a web application that translates 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?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

娇纵 2024-09-02 23:56:49

NLTK 是一个相当大的项目,包含许多有用的工具。我建议首先阅读NLTK Book,这本书做得非常好。您或许可以浏览一下前几章。

您要查找的内容位于第 7 章及后续章节中。

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.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文