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

53
LINES

< > BotCompany Repo | #1012724 // Parsing in thought space v1 [OK with Smart Bot DB]

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

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

!7

sS input = "lalalalala please give me the number yo la la";

p {
  ai_alternativeSmartBot();
  
  while licensed {
    temp ActualThoughtSpace myTS = newThoughtSpace();
    
    myTS.blockedA = litsymbolset("We", "Suggest");
    
    input = trim(input);
    print("Have input: " + input);
    post("We", "are parsing", quote(input));
    
    for (S tail : ai_texts_verified_quoted("$X", "is", "a droppable tail")) {
      //print("Have tail: " + tail);
      if (nempty(tail) && ewic(input, tail))
        post("Suggest", "splitting off after index", l(rtrim(dropLast(l(tail), input))));
    }
        
    for (S prefix : ai_texts_verified_quoted("$X", "is", "a droppable prefix")) {
      //print("Have prefix: " + prefix);
      if (nempty(prefix) && swic(input, prefix))
        post("Suggest", "splitting off before index", smartIndexOf(input, ' ', l(prefix)));
    }
    
    S idx = random(ai_texts("Suggest", "splitting off after index", "$X"));
    if (idx != null) {
      int i = parseInt(idx);
      print("Splitting off: " + substring(input, i));
      continue with input = takeFirst(i, input);
    }
    
    idx = random(ai_texts("Suggest", "splitting off before index", "$X"));
    if (idx != null) {
      int i = parseInt(idx);
      print("Splitting off: " + takeFirst(i, input));
      continue with input = substring(input, i);
    }
    
    // Nothing to do
    break;
    
    // end of thought space
  }
  
  print("Final input: " + input);
  assertEqualsIC("give me the number", input);
  print("OK");
  //printThoughtSpace();
}

Author comment

Began life as a copy of #1012716

download  show line numbers  debug dex  old transpilations   

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

No comments. add comment

Snippet ID: #1012724
Snippet name: Parsing in thought space v1 [OK with Smart Bot DB]
Eternal ID of this version: #1012724/22
Text MD5: 883a318b73c629f71a587d653d69b932
Transpilation MD5: 199f63686b5ea0bcc0b5b9f630646be3
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-13 18:32:01
Source code size: 1613 bytes / 53 lines
Pitched / IR pitched: No / No
Views / Downloads: 514 / 1151
Version history: 21 change(s)
Referenced in: [show references]