static ItIt<PairS> ai_findLeadingPhrases(S s, Collection<S> phrases) { final Set<S> set = asCISet(phrases); L<S> tok = javaTokNPunctuation(s); ret notNulls_iterator( mapIterator(allTokSplits_nOnLeft_iterator(tok), func(Pair<LS> p) -> PairS { set.contains(trimJoin(simpleSpaces(p.a))) ? pair(join(p.a), join(p.b)) : null })); }
Began life as a copy of #1018119
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: | #1018126 |
| Snippet name: | ai_findLeadingPhrases - returns both parts of the split; assumes phrases in list don't have punctuation |
| Eternal ID of this version: | #1018126/1 |
| Text MD5: | 3643c4d14af89005974b81f92c92038d |
| 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 16:59:23 |
| Source code size: | 364 bytes / 9 lines |
| Pitched / IR pitched: | No / No |
| Views / Downloads: | 619 / 668 |
| Referenced in: | #1006654 - Standard functions list 2 (LIVE, continuation of #761) #1018134 - ai_findInfixPhrases - O(nWords^2) |