The problem:
- I want users to be able to write conditions in a simple syntax in a text editor, as in:
A?outcome1:(B?outcome2:outcome3)
A and B are boolean conditions. So the sentence above means: if A is true, then outcome1, else if B is true, then outcome 2, else outcome3.
In Java, I implement an interpreter of this syntax so that A, B, outcome1, outcome2,outcome3 get translated in values that are pre-stored somewhere (A and B will be functions returning a boolean, outcomes will be objects), and the condition is evaluated and a result is returned.
My question is, am I reinventing the wheel here? Are there Java packages or libraries that already provide neat implementations of “[constrained] natural language interpreted to Java code” kind of functions?
Thx!
I ended up writing a class in Java that reads a human-written rule and interprets it. Find it here:
https://github.com/seinecle/Umigon/blob/master/src/java/RuleInterpreter/Interpreter.java