# NLP Library or routine for Quantitative relationships

I'm searching for generalized methods and libraries to extract quantitative relationships between concepts in natural language. For instance

Exam score greater than 90%
Exam scores of 90% or greater


Should extract to a structure like

Exam Score,>=,90%


I began with a simple regexp / dictionary method, but it feels very primitive.

• Isn't SQL close enough? – Emre Aug 18 '17 at 16:49

It depends on how "generalized" you want your methods. If you have known and fixed set of quantitative relationships (=, <=, >=, …), then you can consider it a classification problem. Given some input string, which category does it most likely belong to? The same goes for entities. Are you assuming it will always be two entities?

If the system should handle an unlimited number of entities with unknown and possibly infinite number of relationships than the problem quickly becomes intractable.

If you assume there will always two entities, then you can apply Resource Description Framework (RDF). RDF goal is to find semantic entities and their relationships. RDF finds triples: a subject, a predicate, and an object. The predicate is "quantitative relationship" between the subject and object. There are a variety of frameworks for extracting RDF from a sentence. The most effective ones depend on building a parse tree of the natural language.