Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

NLP library for determining if a sentence is equivalent to another sentence?

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?

like image 241
Dominique Avatar asked Feb 20 '23 10:02

Dominique


1 Answers

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.

like image 132
dhg Avatar answered Feb 22 '23 23:02

dhg