Libraryless. Click here for Pure Java version (7643L/51K).
// e.g. "if a snippet contains token X, it also contains token Y"; static L<ParsedWithTokens<PairS>> ai_findNounPlusVar(S s) { Set<S> vars = ai_mostLikelyVariables(s); replace P with ParsedWithTokens. new L<P<PairS>> out; L<P<S>> nouns = pwt_filter isNoun(pwt_initial(s, 2)); print(+nouns); for (P<S> noun : nouns) for (P<S> var : pwt_stepRight_filter(1, x -> contains(vars, x), noun)) out.add(pwt_combine(pair(noun!, var!), noun, var)); ret out; }
download show line numbers debug dex old transpilations
Travelled to 7 computer(s): bhatertpkbcr, mqqgnosmbjvj, pyentgdyhuwx, pzhvpgtvlbxg, tvejysmllsmz, vouqrxazstgt, xrpafgyirdlv
No comments. add comment
| Snippet ID: | #1028878 | 
| Snippet name: | ai_findNounPlusVar | 
| Eternal ID of this version: | #1028878/2 | 
| Text MD5: | d91b8fad4ae3aa7ba74814b1190a336d | 
| Transpilation MD5: | 88382939304f51d3ca3cb5bb3056334b | 
| Author: | stefan | 
| Category: | javax / parsing | 
| Type: | JavaX fragment (include) | 
| Public (visible to everyone): | Yes | 
| Archived (hidden from active list): | No | 
| Created/modified: | 2020-07-10 19:03:25 | 
| Source code size: | 491 bytes / 15 lines | 
| Pitched / IR pitched: | No / No | 
| Views / Downloads: | 407 / 523 | 
| Version history: | 1 change(s) | 
| Referenced in: | [show references] |