1 | sclass EnglishNumberAttractor > PartialAttractor {
|
2 | S value; // number as string, e.g. "22" |
3 | |
4 | public bool find() {
|
5 | for (int i = 1; i < l(tok); i += 2) {
|
6 | int j = i+1; |
7 | S s; |
8 | while (j < l(tok) && nempty(s = parseEnglishNumbers(joinSubList(tok, i, j+1)))) {
|
9 | value = s; |
10 | j += 2; |
11 | } |
12 | if (j > i+1) |
13 | ret true with matchedRange = intRange(i, j-2); |
14 | } |
15 | false; |
16 | } |
17 | } |
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: | 474 / 921 |
| Version history: | 4 change(s) |
| Referenced in: | [show references] |