sclass EnglishNumberAttractor > PartialAttractor { S value; // number as string, e.g. "22" public bool find() { for (int i = 1; i < l(tok); i += 2) { int j = i+1; S s; while (j < l(tok) && nempty(s = parseEnglishNumbers(joinSubList(tok, i, j+1)))) { value = s; j += 2; } if (j > i+1) ret true with matchedRange = intRange(i, j-2); } false; } }
Began life as a copy of #1022879
download show line numbers debug dex old transpilations
Travelled to 7 computer(s): bhatertpkbcr, cfunsshuasjs, mqqgnosmbjvj, pyentgdyhuwx, pzhvpgtvlbxg, tvejysmllsmz, vouqrxazstgt
No comments. add comment
Snippet ID: | #1022880 |
Snippet name: | EnglishNumberAttractor - finds stuff like "twenty two" |
Eternal ID of this version: | #1022880/5 |
Text MD5: | cf9fa53d06f1bf869c164d23496b3e4d |
Author: | stefan |
Category: | javax / a.i. |
Type: | JavaX fragment (include) |
Public (visible to everyone): | Yes |
Archived (hidden from active list): | No |
Created/modified: | 2019-04-12 17:30:40 |
Source code size: | 434 bytes / 17 lines |
Pitched / IR pitched: | No / No |
Views / Downloads: | 260 / 695 |
Version history: | 4 change(s) |
Referenced in: | [show references] |