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

44
LINES

< > BotCompany Repo | #1012746 // Parsing in thought space v4 [OK]

JavaX source code (desktop) [tags: use-pretranspiled] - run with: x30.jar

Download Jar. Libraryless. Click here for Pure Java version (19360L/137K).

!7

sS input = "the dog barked and ran away";

srecord SplitTo(L<S> l) {}

p {
  ai_independentSmartBot();
  
  temp ParseEnv env = parse_start(input);
  
  // Split at and?
  
  int i = indexOfIC_fullWord(env.input, "and");
  if (i >= 0)
    post("Suggest", "splitting at indices", struct(ll(i, i + l("and"))));
    
  // Split after noun phrase
  
  L<S> tok = defaultTok(env.input);
  i = tokenIndexToCharIndex(tok, ai_endOfNounPhrase(tok));
  if (i >= 0)
    post("Suggest", "splitting at indices", sfu(ll(i)));
    
  // Suggestions -> Executions
  
  L<TripleWeb> suggestions = ai_triplesWithA("Suggest");
  pnl(suggestions);
  new LinkedHashSet executions;
  
  for (TripleWeb suggestion : suggestions) {
    S idx = ai_text_onTriple(suggestion, "Suggest", "splitting at indices", "$X");
    if (idx != null) {
      L<Int> indices = safeUnstructureList(idx);
      executions.add(SplitTo(splitStringAtIndices(env.input, indices)));
    }
  }

  print("Have " + n2(executions, "execution", "executions"));
  pnlStruct(executions);
  
  O execution = random(executions);
  print("Choosing: " + structure(execution));
}

Author comment

Began life as a copy of #1012743

download  show line numbers  debug dex  old transpilations   

Travelled to 13 computer(s): aoiabmzegqzx, bhatertpkbcr, cbybwowwnfue, cfunsshuasjs, gwrvuhgaqvyk, ishqpsrjomds, lpdgvwnxivlt, mqqgnosmbjvj, pyentgdyhuwx, pzhvpgtvlbxg, tslmcundralx, tvejysmllsmz, vouqrxazstgt

No comments. add comment

Snippet ID: #1012746
Snippet name: Parsing in thought space v4 [OK]
Eternal ID of this version: #1012746/4
Text MD5: 7a5307abc3e8c2f9b9c390693947de34
Transpilation MD5: f1994edce37f41cbd87be50632853724
Author: stefan
Category: javax / a.i.
Type: JavaX source code (desktop)
Public (visible to everyone): Yes
Archived (hidden from active list): No
Created/modified: 2017-12-11 16:50:30
Source code size: 1167 bytes / 44 lines
Pitched / IR pitched: No / No
Views / Downloads: 323 / 927
Version history: 3 change(s)
Referenced in: [show references]