!7 static int maxWords = 100000, topTenSize = 10; static int maxWordLength = 100; static MultiSetAndTopTen mstt; p-subst { tt(); centerHigherConsole(); saveConceptsQuietly(); load('topTenSize); mstt = new MultiSetAndTopTen( l_persistentTreeMap("Words + count"), l_persistentList("Top Ten")); mstt.maxEntries = maxWords; mstt.topTenTargetLength = topTenSize; mstt.printTopTen(); showControls(jcenteredline(jbutton("Show Text Area", f showTextArea))); botIfMain(); } svoid addWordHits(Collection words) { lock dbLock(); for (S word : words) mstt.add(shorten(word, maxWordLength)); } svoid processText(S s) { logQuoted("texts-posted.log", now() + " | " + s); addWordHits(words2(s)); mstt.printTopTen(); } answer { if "top *" { topTenSize = parseInt($1); save('topTenSize); mstt.newTopTen(topTenSize); mstt.printTopTen(); ret "OK"; } if "all alphabetic" { showTableWithSearcher(mstt.ms, "Alphabetic with count"); ret "OK"; } processText(s); try answer "OK"; } svoid showTextArea swing { final JTextArea ta = jwordwraptextarea(); showFrame(centerAndSouth(ta, jcenteredline(jbutton("Save words", r { processText(getText(ta)); disposeFrame(ta) })))); }