Download Jar. Uses 3874K of libraries. Click here for Pure Java version (10868L/76K).
!7 static int maxWords = 100000, topTenSize = 10; static int maxWordLength = 100; static MultiSetAndTopTen<S> 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<S> 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) })))); }
Began life as a copy of #1009450
download show line numbers debug dex old transpilations
Travelled to 13 computer(s): aoiabmzegqzx, bhatertpkbcr, cbybwowwnfue, cfunsshuasjs, gwrvuhgaqvyk, ishqpsrjomds, lpdgvwnxivlt, mqqgnosmbjvj, pyentgdyhuwx, pzhvpgtvlbxg, tslmcundralx, tvejysmllsmz, vouqrxazstgt
No comments. add comment
| Snippet ID: | #1009456 |
| Snippet name: | Word Collector with new MultiSetAndTopTen |
| Eternal ID of this version: | #1009456/9 |
| Text MD5: | 47f5502a4cceab4e9cbda132e25fad94 |
| Transpilation MD5: | 9da949d74c6eede317ccf029d16323a7 |
| Author: | stefan |
| Category: | javax |
| Type: | JavaX source code (desktop) |
| Public (visible to everyone): | Yes |
| Archived (hidden from active list): | No |
| Created/modified: | 2017-09-27 16:34:51 |
| Source code size: | 1252 bytes / 42 lines |
| Pitched / IR pitched: | No / No |
| Views / Downloads: | 815 / 1687 |
| Version history: | 8 change(s) |
| Referenced in: | -