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

13
LINES

< > BotCompany Repo | #1020576 // ai_verbalizeAnalysisMultiMap (dev.)

JavaX fragment (include)

1  
sS ai_verbalizeAnalysisMultiMap(Map<O, MultiSet<S>> map) {
2  
  if (map == null) null;
3  
  if (empty(map)) ret "Map empty";
4  
  if (l(map) == 1) ret "Only a single feature value (" + firstKey(map) + ")";
5  
  bool disjoint = allMultiSetsDisjoint(values(map));
6  
  if (allMultiSetsAreSingleKey(values(map)))
7  
    ret "Feature success! " + sfu(mapValues(f first, map));
8  
  new Map<O, S> singletons;
9  
  for (O key, MultiSet<S> value : map) { if (value.uniqueSize() == 1) singletons.put(key, first(keys(value))); }
10  
  if (nempty(singletons)) ret "Clear feature values: " + sfu(singletons);
11  
  if (disjoint) ret "No feature overlap";
12  
  ret "Feature results inconclusive";
13  
}

Author comment

Began life as a copy of #1020570

download  show line numbers  debug dex  old transpilations   

Travelled to 8 computer(s): bhatertpkbcr, cfunsshuasjs, gwrvuhgaqvyk, mqqgnosmbjvj, pyentgdyhuwx, pzhvpgtvlbxg, tvejysmllsmz, vouqrxazstgt

No comments. add comment

Snippet ID: #1020576
Snippet name: ai_verbalizeAnalysisMultiMap (dev.)
Eternal ID of this version: #1020576/5
Text MD5: 66af62c6f91e67964ee447f4f288bdf4
Author: stefan
Category: javax
Type: JavaX fragment (include)
Public (visible to everyone): Yes
Archived (hidden from active list): No
Created/modified: 2018-12-27 02:25:27
Source code size: 663 bytes / 13 lines
Pitched / IR pitched: No / No
Views / Downloads: 289 / 342
Version history: 4 change(s)
Referenced in: [show references]