如何解析文档并替换内容以将上下文从第一人称或第二人称更改为第三人称?
基本上我需要一些文字,例如:
- 我有一个蛋卷冰淇淋。
- 你有麻烦了。
- 你需要洗澡。
并将其从第一人或第二人更改为第三人。
- 他有一个蛋卷冰淇淋。
- 他有麻烦了。
- 他需要洗澡。
我已经启动了一个 js 应用程序,但目前它非常简单。
在我浪费时间重新发明轮子之前,我想我应该问:有人知道有任何第三方库可以做这种事情吗?如果没有,有人可以提供任何建议或指导来帮助我开展工作吗?
Basically I need some text like:
- I have an ice cream cone.
- You are in trouble.
- You need a bath.
And change it from 1st or 2nd person to 3rd person.
- He has an ice cream cone.
- He is in trouble.
- He needs a bath.
I've started a js app, but it's super simple at the moment.
Before I waste time reinventing the wheel, I figured I'd ask: Is anyone aware of any 3rd party libraries that do this sort of thing? If not, does anyone have any advice or guidance to offer to help me get something going?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
我不知道有任何库可以开箱即用,但我使用过 Nodebox Linguistics,它有一个动词变形模块,可以自己实现其中一些功能。为了扩展伯努瓦的评论,英语动词变位大部分很简单,但也有很多微妙的例外,特别是在改变时态时。
I don't know of any libraries that do this out-of-the-box, but I've used Nodebox Linguistics, which has a verb conjugation module, to implement some of this functionality myself. To expand on Benoit's comment, English verb conjugation is mostly simple, but there are a lot of nuanced exceptions, especially when changing tense.