import dateparser import helpers, induce with induce.grammar() as g: lines = helpers.slurplstriparg() for l in lines: print l with induce.Tracer(l, g): dt = dateparser.parse(l)
import selectsql import helpers, induce with induce.grammar() as g: for t in helpers.slurplstriparg(): print "<%s>" % t with induce.Tracer(t, g): selectsql.select_stmt.parseString(t)
import romannumerals import induce, helpers with induce.grammar() as g: for rn in helpers.slurplstriparg(): with induce.Tracer(rn, g): romannumerals.romanNumeral.parseString(rn)
import mathexpr import induce, helpers with induce.grammar() as g: exprs = helpers.slurplstriparg() for e in exprs: with induce.Tracer(e, g): mathexpr.Parser(e, {})
from datetime import datetime import deltatime import induce, helpers # test grammar tests = helpers.slurplstriparg() with induce.grammar() as g: print("(relative to %s)" % datetime.now()) for t in tests: with induce.Tracer(t, g): print deltatime.nlTimeExpression.parseString(t)