Download Jar. Uses 3874K of libraries. Click here for Pure Java version (6712L/47K).
!7 p-exp { S sentence = "Are atomic bombs powerful devices ?"; S pat = "Are <noun> <noun>?"; L<S> tokPat = javaTokWithAngularBracketsC(pat); L<S> tokS = javaTokWithAngularBracketsC(sentence); printStruct(tokPat); printStruct(tokS); int extra = l(tokS)-l(tokPat); L<Int> indices = indicesOfAngleBracketVars(tokPat); if (extra <= 0 || empty(indices)) ret with print("Not applicable"); for (L<Int> spread : allSpreads(extra, l(indices))) { new L<S> tok; int pos = 0, iSpread = 0; for i over tokPat: if (!isAngleBracketed(tokPat.get(i))) tok.add(tokS.get(pos++)); else { int take = spread.get(iSpread++); tok.add(joinWithSpace(subList(tokS, pos, pos+take+1))); pos += take+1; } printStruct(tok); print(joinWithSpace(map curlyBraceOptIfMoreThanOneToken(tok))); } }
download show line numbers debug dex old transpilations
Travelled to 14 computer(s): aoiabmzegqzx, bhatertpkbcr, cbybwowwnfue, cfunsshuasjs, gwrvuhgaqvyk, irmadwmeruwu, ishqpsrjomds, lpdgvwnxivlt, mqqgnosmbjvj, pyentgdyhuwx, pzhvpgtvlbxg, tslmcundralx, tvejysmllsmz, vouqrxazstgt
No comments. add comment
| Snippet ID: | #1017269 |
| Snippet name: | 3 words in pattern, 5 in sentence Spike [OK] |
| Eternal ID of this version: | #1017269/18 |
| Text MD5: | 3136236e3168c5eedec507a14646eda9 |
| Transpilation MD5: | 310fbe555e7852d23aaa6dd9c51550e9 |
| Author: | stefan |
| Category: | javax / parsing |
| Type: | JavaX source code (desktop) |
| Public (visible to everyone): | Yes |
| Archived (hidden from active list): | No |
| Created/modified: | 2018-07-16 14:24:06 |
| Source code size: | 892 bytes / 31 lines |
| Pitched / IR pitched: | No / No |
| Views / Downloads: | 745 / 1840 |
| Version history: | 17 change(s) |
| Referenced in: | [show references] |