I have been addressing this problem head on aggressively;
https://github.com/emberian/whatember is the toplevel index. Things like arithmetizing parser/other automata to write semantic predicates (incl graph rewrites!) over training sets, inference requests, etc.