!7 sclass BottomUpParser > DynSCPWithInput { transient S lastOutput; transient PTElement root; visualize { ret withCenteredButtons(super.visualize(), "Good Parse", rThread { addToMechList_noUniq("Good english parses", "\n" + ai_renderCulledParseTree(root)) }); } start { set flag DynModule. // for transpilation dm_useLocallyCopiedMechLists(); set flag NoFancyMechParsing. ai_parser_activateStandardFunctions(); doEvery(5000, r { if (dm_isShowingAndOSInForeground()) update(inputChooser.input()) }); } void update(S s) { temp enter(); if (!isShowing()) { inputChooser.forgetInput(); ret; } root = ai_parseToTreeWithGuessing(s); S rendered = ai_renderParseTree(root); bool shouldVis = neq(rendered, lastOutput); lastOutput = rendered; if (shouldVis) { JTree tree = jDynamicTree(root, func(final PTElement e) -> L { e == null ? null : e.children }); setComponent(tree); ai_openMainParseInJTree(tree); } } }