Not logged in.  Login/Logout/Register | List snippets | | Create snippet | Upload image | Upload data

15
LINES

< > BotCompany Repo | #1028878 // ai_findNounPlusVar

JavaX fragment (include) [tags: use-pretranspiled]

Libraryless. Click here for Pure Java version (7643L/51K).

1  
// e.g. "if a snippet contains token X, it also contains token Y";
2  
static L<ParsedWithTokens<PairS>> ai_findNounPlusVar(S s) {
3  
  Set<S> vars = ai_mostLikelyVariables(s);
4  
5  
  replace P with ParsedWithTokens.
6  
  new L<P<PairS>> out;
7  
8  
  L<P<S>> nouns = pwt_filter isNoun(pwt_initial(s, 2));
9  
  print(+nouns);
10  
  for (P<S> noun : nouns)
11  
    for (P<S> var : pwt_stepRight_filter(1, x -> contains(vars, x), noun))
12  
      out.add(pwt_combine(pair(noun!, var!), noun, var));
13  
  
14  
  ret out;
15  
}

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: 190 / 269
Version history: 1 change(s)
Referenced in: [show references]