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

28
LINES

< > BotCompany Repo | #1010753 // Smart Thought Bot v2

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

Download Jar. Libraryless. Click here for Pure Java version (14106L/99K).

!7

p {
  botIfMain();
  consoleInputIfMain("What did you learn today?");
}

answer {
  if "What did you learn today?"
    ret search("I learned today:", "I learned today/", "I learned today/that");
  if "What's your name?|What is your name?"
    ret search("My name is", "My name/is", "My name is/");
    
  for (WebNode n : indexedNodes2("Standard answer"))
    if (match(web_operandText(n, "to"), s))
      try answer web_operandText(n, "is", "can be");
}

static S search(S text, S... stuff) {
  new LinkedHashSet<S> results;
  for (S s : stuff) {
    int i = smartIndexOf(s, '/');
    L<WebNode> l = indexedNodes2(takeFirst(i, s));
    results.addAll(web_uniqueOperandTexts(l, substring(s, i+1)));
  }
  
  ret addSpaceIfNempty(text) + or2(joinWithSpace(map addDotIfNoPunctuation(results)), "Nothing");
}

Author comment

Began life as a copy of #1010737

download  show line numbers  debug dex  old transpilations   

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

No comments. add comment

Snippet ID: #1010753
Snippet name: Smart Thought Bot v2
Eternal ID of this version: #1010753/7
Text MD5: 993da124b22bd4f19198001e9045fd51
Transpilation MD5: 2ac2b81d8591b02585c2a3e8878ce177
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-10-20 02:07:26
Source code size: 836 bytes / 28 lines
Pitched / IR pitched: No / No
Views / Downloads: 393 / 1390
Version history: 6 change(s)
Referenced in: [show references]