!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" } 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; if (flexMatchStartIC(ll("find"), s, m)) ret if out.add(quick(Imperative, m)); if (flexMatchStartIC(ll("all", "a"), s, m)) ret if out.add(quick(Measurement, m)); if (flexMatchIC2("* (called|with) *", s, m)) ret if out.add(quick(Addition, m)); out.add(cstr(s)); // default } static Concept quick(Class cClass, Matches m) { Concept c = cnew(cClass); S order = toStringOpt(getOpt(cClass, "_fieldOrder")); L fields; if (order != null) fields = splitAtSpace(order); else fields = asList(asTreeSet(conceptFields(c))); if (l(fields) != l(m.m)) fail(struct(fields) + " / " + struct(m.m)); for i over fields: cset(c, fields.get(i), parseToOptions(m.unq(i))); ret c; }