!752 concepts. concept Imperative { new Ref v; // verb new Ref o; // object } concept Measurement { new Ref x; // e.g. "all" new Ref y; // e.g. "programs" } concept Addition { new Ref x; // e.g. "programs" new Ref prep; // preposition, e.g. "with" new Ref z; // e.g. "a large number of files" } static Map rules = litorderedmap( "(find) *" := Imperative, "(all|a) *" := Measurement, "* (called|with) *" := Addition ); p { testParse([[Find all programs with a file called "concepts.structure"]]); } sbool properSentence(Concept c) { if (!c << Imperative || neq(c/Imperative.v, cstr("find"))) false; c = c/Imperative.o!; ret matchCstr("all programs with a file called *", c); //if (!c << Measurement || neq(c/Measurement.x, cstr("all"))) false; //c = c/Measurement.y; } !include #1005497 // testParse + parseToOptions using unrollOptions static void parse(S s, Collector out) { new Matches m; for (S pattern : keys(rules)) if (flexMatchIC2(pattern, s, m)) ret if out.add(conceptFromMatches(rules.get(pattern), m)); out.add(cstr(s)); // default }