I would like to find an NLP library in Python, PHP or even JavaScript for determining whether a sentence in a string is equivalent to a differently structured sentence?
For example, the library would need to be able to determine whether these two sentences are equivalent:
"Would you like the order for here or to go?" "Do you want the order for here or to go?"
Is there such a thing? Or would it actually be easier for me to build something like this myself for the specific application I need it for?
What you are describing is the task of "paraphrase" (or bidirectional "textual entailment"). This is an extremely hard problem and an open research area. I doubt that there is a system available that would do well enough on this task for real-world, general use.
If you have a very narrow set of transformations in mind (such as the "would you like" <-> "do you want" alternation), you could try and construct a set of transformation rules that convert one sentence to the other. These rules could act directly on the sentence or on a parse tree produced from a statistical parser.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With