1 | static MultiSet<S> ai_allPrefixesWithWordCount_cleaned(S input) { |
2 | MultiSet<S> ms = ai_allPrefixesWithWordCount(input); |
3 | new MultiSet<S> cleaned; |
4 | S last = null; |
5 | for (S s : reversed(ms.highestFirst())) { |
6 | int count = ms.get(s); |
7 | if (count == 1) continue; |
8 | if (!(startsWith(last, s) && ms.get(last) == count)) |
9 | cleaned.add(s, count); |
10 | last = s; |
11 | } |
12 | ret cleaned; |
13 | } |
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: | 285 / 319 |
Version history: | 3 change(s) |
Referenced in: | [show references] |