How Can I Parse a Document and Replace the Content to Change Context from 1st or 2nd Person to 3rd Person?
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?
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.
精彩评论