Not logged in.  Login/Logout/Register | List snippets | | Create snippet | Upload image | Upload data

18
LINES

< > BotCompany Repo | #1017299 // ai_mechListNamesForAngleBracketCategory

JavaX fragment (include)

scope ai_mechListNamesForAngleBracketCategory.

// TODO: clean on language change
static TimedCache<Map<S, Set<S>>> #cache = TimedCache(5.0);

static Set<S> ai_mechListNamesForAngleBracketCategory(S s) {
  if (!isAngleBracketed(s)) null;
  Map<S, Set<S>> map = cache.get(f newHashMap);
  s = dropTrailingNumberFromAngleBracketCategory(s);
  if (map.containsKey(s)) ret map.get(s);
  // Derive from the category name - use LinkedHashSet to keep first
  Set<S> set = litorderedset(mechLanguagePrefix() + firstToUpper(plural_mech(replace(deAngleBracket(s), "_", " "))));
  set.addAll(mechMultiMapCI(mechLanguagePrefix() + "Word category => List").get(s));
  map.put(s, set);
  ret set;
}

end scope

download  show line numbers  debug dex  old transpilations   

Travelled to 14 computer(s): aoiabmzegqzx, bhatertpkbcr, cbybwowwnfue, cfunsshuasjs, gwrvuhgaqvyk, irmadwmeruwu, ishqpsrjomds, lpdgvwnxivlt, mqqgnosmbjvj, pyentgdyhuwx, pzhvpgtvlbxg, tslmcundralx, tvejysmllsmz, vouqrxazstgt

No comments. add comment

Snippet ID: #1017299
Snippet name: ai_mechListNamesForAngleBracketCategory
Eternal ID of this version: #1017299/12
Text MD5: 077e4612cd072a6b36c929e81a338874
Author: stefan
Category: javax / a.i.
Type: JavaX fragment (include)
Public (visible to everyone): Yes
Archived (hidden from active list): No
Created/modified: 2018-07-18 13:03:49
Source code size: 712 bytes / 18 lines
Pitched / IR pitched: No / No
Views / Downloads: 364 / 418
Version history: 11 change(s)
Referenced in: [show references]