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

9
LINES

< > BotCompany Repo | #1018131 // ai_findTrailingPhrases - assumes phrases in list don't have punctuation

JavaX fragment (include)

static ItIt<PairS> ai_findTrailingPhrases(S s, Collection<S> phrases) {
  final Set<S> set = asCISet(phrases);
  L<S> tok = javaTokNPunctuation(s);
  ret notNulls_iterator(
    mapIterator(allTokSplits_nOnRight_iterator(tok),
      func(Pair<LS> p) -> PairS {
        set.contains(trimJoin(simpleSpaces(p.b))) ? pair(join(p.a), join(p.b)) : null
      }));
}

Author comment

Began life as a copy of #1018115

download  show line numbers  debug dex  old transpilations   

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

No comments. add comment

Snippet ID: #1018131
Snippet name: ai_findTrailingPhrases - assumes phrases in list don't have punctuation
Eternal ID of this version: #1018131/1
Text MD5: fc2582ecde36c67cdf763b5a1fa535e7
Author: stefan
Category: javax / a.i.
Type: JavaX fragment (include)
Public (visible to everyone): Yes
Archived (hidden from active list): No
Created/modified: 2018-09-02 17:09:35
Source code size: 366 bytes / 9 lines
Pitched / IR pitched: No / No
Views / Downloads: 341 / 366
Referenced in: #1006654 - Standard functions list 2 (LIVE, continuation of #761)