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

13
LINES

< > BotCompany Repo | #1021694 // ai_allPrefixesWithWordCount_cleaned

JavaX fragment (include)

static MultiSet<S> ai_allPrefixesWithWordCount_cleaned(S input) {
  MultiSet<S> ms = ai_allPrefixesWithWordCount(input);
  new MultiSet<S> cleaned;
  S last = null;
  for (S s : reversed(ms.highestFirst())) {
    int count = ms.get(s); 
    if (count == 1) continue;
    if (!(startsWith(last, s) && ms.get(last) == count))
      cleaned.add(s, count);
    last = s;
  }
  ret cleaned;
}

Author comment

Began life as a copy of #1021692

download  show line numbers  debug dex  old transpilations   

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

No comments. add comment

Snippet ID: #1021694
Snippet name: ai_allPrefixesWithWordCount_cleaned
Eternal ID of this version: #1021694/4
Text MD5: 9536c532348809da53f8e58ec66fa5a4
Author: stefan
Category: javax / a.i.
Type: JavaX fragment (include)
Public (visible to everyone): Yes
Archived (hidden from active list): No
Created/modified: 2019-02-24 15:29:41
Source code size: 399 bytes / 13 lines
Pitched / IR pitched: No / No
Views / Downloads: 283 / 317
Version history: 3 change(s)
Referenced in: [show references]