Warning: session_start(): open(/var/lib/php/sessions/sess_c2oor6egm5ndi6pofsur0s4gct, O_RDWR) failed: No space left on device (28) in /var/www/tb-usercake/models/config.php on line 51
Warning: session_start(): Failed to read session data: files (path: /var/lib/php/sessions) in /var/www/tb-usercake/models/config.php on line 51
!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" { showTable(keys(mstt.ms)); }
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) }))));
}