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

43
LINES

< > BotCompany Repo | #1004812 // User Belief Bot (dev.)

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

Libraryless. Click here for Pure Java version (3700L/25K/81K).

!752

!include #1004810 // Concepts etc.

sclass UserBelief extends Concept {
  S beliefText; // Text renderding of belief
  new Ref<Concept> beliefConcept; // Concept of belief
  new Ref<UserLine> userLine; // When he said that
  bool negative; // User does NOT believe this
  
  bool invalidated; // true = we rejected this stuff later
  
  *() {}
  *(UserLine ul) { userLine.set(ul); }
}

p {
  persistConcepts();
  action();
}

static void processNewUserLine(UserLine ul) {
  S s = ul.text();
  UserBelief belief = findBackRef(ul, UserBelief.class);
  if (belief == null)
    parseBeliefUtterance(ul);
}

static void parseBeliefUtterance(UserLine ul) {
  S s = ul.s();
  new Matches m;
  if (jmatchStart("I think that", s, m)) {
    UserBelief ub = new UserBelief(ul);
    ub.beliefText = m.rest();
  } else if (jmatchStart("I don't think that", s, m)) {
    UserBelief ub = new UserBelief(ul);
    ub.negative = true;
    ub.beliefText = m.rest();
  }
}

static void dbActions {
}

Author comment

Began life as a copy of #1004778

download  show line numbers  debug dex  old transpilations   

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

No comments. add comment

Snippet ID: #1004812
Snippet name: User Belief Bot (dev.)
Eternal ID of this version: #1004812/1
Text MD5: 9d69f9f2c1f0243db37ee94ca6a0de51
Transpilation MD5: 57e888fa9fd2a0256e249d299003db8a
Author: stefan
Category: javax / talking robots
Type: JavaX source code
Public (visible to everyone): Yes
Archived (hidden from active list): No
Created/modified: 2016-09-01 22:55:20
Source code size: 1029 bytes / 43 lines
Pitched / IR pitched: No / No
Views / Downloads: 552 / 855
Referenced in: [show references]