Libraryless. Click here for Pure Java version (7163L/48K).
// for ai_language() // Uses mech list "All $language word categories" and sublists scope ai_wordToCategories. static TimedCache<Map<S, Map<S, Set<S>>>> #cache = new TimedCache(f ciMap, 10.0); // language -> word -> categories static Map<S, Set<S>> ai_wordToCategories() { Map<S, Map<S, Set<S>>> languages = cache!; Map<S, Set<S>> map = languages.get(ai_language()); if (map == null) languages.put(ai_language(), map = make()); ret map; } static Map<S, Set<S>> #make() { Map<S, Set<S>> catMap = ai_wordCategoriesWithElements(); final Map<S, Set<S>> map = ciMap(); for (S cat : keys(catMap)) for (S word : catMap.get(cat)) { Set<S> set = map.get(word); if (set == null) map.put(word, set = new LinkedHashSet); set.add(cat); } ret map; } static Set<S> ai_wordToCategories(S word) { ret ai_wordToCategories().get(word); } end scope
Began life as a copy of #1017360
download show line numbers debug dex old transpilations
Travelled to 15 computer(s): aoiabmzegqzx, bhatertpkbcr, cbybwowwnfue, cfunsshuasjs, gwrvuhgaqvyk, irmadwmeruwu, ishqpsrjomds, lpdgvwnxivlt, mqqgnosmbjvj, pyentgdyhuwx, pzhvpgtvlbxg, tslmcundralx, tvejysmllsmz, vouqrxazstgt, xrpafgyirdlv
No comments. add comment
Snippet ID: | #1017446 |
Snippet name: | ai_wordToCategories |
Eternal ID of this version: | #1017446/6 |
Text MD5: | 365aee1c266fc748894a6bf8fdab8573 |
Transpilation MD5: | 0d6d83a76df44697a23db269d7b70310 |
Author: | stefan |
Category: | javax / a.i. |
Type: | JavaX fragment (include) |
Public (visible to everyone): | Yes |
Archived (hidden from active list): | No |
Created/modified: | 2020-04-16 13:38:40 |
Source code size: | 915 bytes / 32 lines |
Pitched / IR pitched: | No / No |
Views / Downloads: | 413 / 550 |
Version history: | 5 change(s) |
Referenced in: | #1006654 - Standard functions list 2 (LIVE, continuation of #761) #1017447 - ai_uncategorizedWordsInSentence |