!747 !multi-line strings m { !include #1001509 // rules & statements !include #1001512 // Synonyms static new Synonyms syn; p { statements.add("one is a synonym of 1."); statements.add("\"eins\" is a synonym of 1."); statements.add("two is a synonym of 2."); makeSynMap(); ask([[what are the synonyms of 1?]]); ask([[what are the synonyms of 2?]]); } static void makeSynMap() { for (Map m : matchStatements("$1 is a synonym of $2")) syn.addSynonym(unquote(m.get("$1")), unquote(m.get("$2"))); } static void ask(S q) { print("? " + q); new Map map; if (match4("what are the synonyms of $1?", q, map)) print(" => " + structure(syn.getSynonyms(map.get("$1")))); else print("dunno."); } }