!759 sS input = "the dog barked and ran away"; static record SplitTo(L l) {} static record GroupAs(S s) {} p { ai_independentSmartBot(); temp ParseEnv env = parse_start(input); // Split at and? int i = indexOfIC_fullWord(env.input, "and"); if (i >= 0) post("Suggest", "splitting at indices", struct(ll(i, i + l("and")))); // Split after noun phrase L tok = defaultTok(env.input); i = tokenIndexToCharIndex(tok, ai_endOfNounPhrase(tok)); if (i >= 0) post("Suggest", "grouping starting at index", str(i)); // Suggestions -> Executions L suggestions = ai_triplesWithA("Suggest"); pnl(suggestions); new L executions; for (TripleWeb suggestion : suggestions) { S idx = ai_text_onTriple(suggestion, "Suggest", "splitting at indices", "$X"); if (idx != null) { L indices = safeUnstructureList(idx); executions.add(SplitTo(splitStringAtIndices(env.input, indices))); } idx = ai_text_onTriple(suggestion, "Suggest", "grouping starting at index", "$X"); if (idx != null) { i = parseInt(idx); executions.add(GroupAs(curlyGroupFromIndex(env.input, i))); } } print("Have " + n2(executions, "execution", "executions")); pnlStruct(executions); O execution = random(executions); print("Choosing: " + structure(execution)); }