1 | static IterableIterator<S> ngrams_iterator(final int n, fS s) {
|
2 | final int max = l(s)-n; |
3 | ret iteratorFromFunction(new F0<S> {
|
4 | int i; |
5 | |
6 | S get() {
|
7 | if (i > max) null; |
8 | S x = substring(s, i, i+n); |
9 | ++i; |
10 | ret x; |
11 | } |
12 | }); |
13 | } |
download show line numbers debug dex old transpilations
Travelled to 13 computer(s): aoiabmzegqzx, bhatertpkbcr, cbybwowwnfue, cfunsshuasjs, gwrvuhgaqvyk, ishqpsrjomds, lpdgvwnxivlt, mqqgnosmbjvj, pyentgdyhuwx, pzhvpgtvlbxg, tslmcundralx, tvejysmllsmz, vouqrxazstgt
No comments. add comment
| Snippet ID: | #1014304 |
| Snippet name: | ngrams_iterator - get all n-grams from a text |
| Eternal ID of this version: | #1014304/5 |
| Text MD5: | 76647b757477e654ddc441684537c89a |
| Author: | stefan |
| Category: | javax |
| Type: | JavaX fragment (include) |
| Public (visible to everyone): | Yes |
| Archived (hidden from active list): | No |
| Created/modified: | 2018-04-20 01:32:55 |
| Source code size: | 267 bytes / 13 lines |
| Pitched / IR pitched: | No / No |
| Views / Downloads: | 685 / 719 |
| Version history: | 4 change(s) |
| Referenced in: | [show references] |