Dominique
Dominique

Reputation: 414

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?

Upvotes: 4

Views: 806

Answers (2)

Edward Loper
Edward Loper

Reputation: 15944

Solving this in the general case is most likely AI complete -- just getting the correct syntactic analysis for a single sentence is a very difficult problem. But if there's a limited set of sentence forms you're considering, then it's possible that within that limited domain it will be easier.

Upvotes: 3

dhg
dhg

Reputation: 52691

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.

Upvotes: 4

Related Questions