To parse a sentence, we run the Stanford dependency parser, match patterns and use combinators for translating.
import $ivy.`io.github.siddhartha-gadgil::provingground-nlp:0.1.0`
import $ivy.`edu.stanford.nlp:stanford-corenlp:3.7.0`
interp.load.ivy(coursier.Dependency(
coursier.Module("edu.stanford.nlp", "stanford-corenlp"),
"3.7.0",
attributes = coursier.Attributes(classifier = "models")
)
)
import edu.stanford._
import edu.stanford.nlp._
import trees.Tree
import simple._
val sent = new Sentence("if a prime number P divides MN, P divides one of M and N")
val tree= sent.parse
import provingground._, translation._
import TreePatterns._
import scala.collection.JavaConversions._
val st = tree.subTrees.toList
val matches = st.map(IfTree.unapply).flatten