!7 concept Sentence { S text; S action; } concept Example { L tok; IntRange subjectTokens; } abstract sclass Guesser { abstract IntRange getSubjectTokens(L tok); } Guesser > G1 { IntRange getSubjectTokens(L tok) { ret new IntRange(0, 1); } } p { loadConceptsFrom(#1008607); L material = learningMaterial(); pnlStruct(material); checkGuesser(material, new G1); } svoid checkGuesser(L testMaterial, Guesser g) { int score = 0, n = 0; for (Example e : testMaterial) { IntRange r = pcall(g, "getSubjectTokens", e.tok); if (eq(e.subjectTokens, r)) ++score; ++n; } printScore(struct(g), score, n); } static L learningMaterial() { L> out = new L; for (Sentence s) { if (s.action == null) continue; IntRange r = ai_parseSubjectAction(s.action); if (r != null) { L tok = nlTok5(s.text); out.add(Example(tok, tokenRangeToCharRange(tok, r))); } } ret out; }