Libraryless. Click here for Pure Java version (5086L/33K/112K).
!752 concepts. concept Language { S name; } concept Word { S text; } concept ProbablyInLanguage { new Ref<Word> word; new Ref<Language> language; } p { loadAndAutoSaveConcepts(); print("Have " + n(countConcepts(Language), "languages") + ", " + n(countConcepts(Word), "words")); makeBot(); } synchronized answer { if "add to * *" { S langName = toLowerCase($1), text = $2; if (!hasConcept(Language, langName)) print("New language: " + langName); Language language = uniq(Language, langName); int newWords = countConcepts(ProbablyInLanguage); for (S word : codeTokens(javaTok(text))) uniq(ProbablyInLanguage, +language, word := uniq(Word, toLowerCase(word))); newWords = countConcepts(ProbablyInLanguage)-newWords; ret "Thanks. " + (newWords == 0 ? "I knew all these words already :)" : n(newWords, "new words") + " learned!"); } }
download show line numbers debug dex old transpilations
Travelled to 14 computer(s): aoiabmzegqzx, bhatertpkbcr, cbybwowwnfue, cfunsshuasjs, ddnzoavkxhuk, gwrvuhgaqvyk, ishqpsrjomds, lpdgvwnxivlt, mqqgnosmbjvj, pyentgdyhuwx, pzhvpgtvlbxg, tslmcundralx, tvejysmllsmz, vouqrxazstgt
No comments. add comment
Snippet ID: | #1005260 |
Snippet name: | Collect Words [works] |
Eternal ID of this version: | #1005260/1 |
Text MD5: | b81d67bc3f1146cff4fa4398c1454168 |
Transpilation MD5: | 1efec228e86e624eee609939d8bb1ea3 |
Author: | stefan |
Category: | javax |
Type: | JavaX source code |
Public (visible to everyone): | Yes |
Archived (hidden from active list): | No |
Created/modified: | 2016-11-16 00:24:54 |
Source code size: | 949 bytes / 39 lines |
Pitched / IR pitched: | No / No |
Views / Downloads: | 600 / 855 |
Referenced in: | #1005262 - Show concept classes as tabs [works, but not very useful :)] |