!7 sS text1 = [[ Player A rolled a 5. The second player rolled a 3. Player A won. The second player cried a lot. ]]; static L> actions1 = ll( pair("Player A", "rolled a 5"), pair("The second player", "rolled a 3"), pair("Player A", "won"), pair("The second player", "cried a lot")); p { L> actions = ai_findActionsInText(text1); print("Actions found:\n" + indentx(structureLines(actions))); assertContainsAll(actions, actions1); print("Yo!"); } static L> ai_findActionsInText(S text) { L sentences = map(f dropPunctuationAtEnd, splitIntoSentences_v3(text)); new L> actions; new Matches m; Set verbs = knownVerbs(); for (S s : sentences) { L tok = javaTok(s); int i = indexOfAny(allToLower(tok), verbs); if (i >= 0) actions.add(pair(trimJoinSubList(tok, 0, i), trimJoinSubList(tok, i))); } ret actions; }