!7 sS data = [[ ---- Rules I ate pizza with a fork. => I used a fork to eat pizza. I used a fork to eat pizza. => I used a fork. I used a fork. => A fork is a tool. I ate pizza with pepperoni. => {I ate pizza} and {The pizza had pepperoni on it}. The pizza had pepperoni on it. => Pepperoni is edible. I ate pizza with Bob. => {I ate pizza} and {Bob was with me}. Bob was with me. => Bob is a person. A and B. => A. A and B => B. nicer wording for {is it true that {Mom is a person.}?} = {is Mom a person?} nicer wording for {is it true that {Mom is edible.}?} = {is Mom edible?} ---- Input I ate pizza with mom. I ate pizza with anchovis. I ate pizza with ducks. I ate pizza with my hands. ]]; p-exp { SS sections = asCIMap(minusSignsSections(data)); LS rulesRaw = splitAtEmptyLines(sections.get("Rules")); //pnl(rulesRaw); LPair rules = mapNonNulls splitAtDoubleArrow_pair(rulesRaw); pnlStruct(rules); LS inputs = tlft(sections.get("Input")); pnl(inputs); for (S input : inputs) { print(input); new Best rule; for (PairS rule : rules) best.put(rule, ai_countIdenticalWords(input, rule.a)); print(" Best rule: " + best!); } }