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).

1  
!752
2  
3  
!include #1004810 // Concepts etc.
4  
5  
sclass UserBelief extends Concept {
6  
  S beliefText; // Text renderding of belief
7  
  new Ref<Concept> beliefConcept; // Concept of belief
8  
  new Ref<UserLine> userLine; // When he said that
9  
  bool negative; // User does NOT believe this
10  
  
11  
  bool invalidated; // true = we rejected this stuff later
12  
  
13  
  *() {}
14  
  *(UserLine ul) { userLine.set(ul); }
15  
}
16  
17  
p {
18  
  persistConcepts();
19  
  action();
20  
}
21  
22  
static void processNewUserLine(UserLine ul) {
23  
  S s = ul.text();
24  
  UserBelief belief = findBackRef(ul, UserBelief.class);
25  
  if (belief == null)
26  
    parseBeliefUtterance(ul);
27  
}
28  
29  
static void parseBeliefUtterance(UserLine ul) {
30  
  S s = ul.s();
31  
  new Matches m;
32  
  if (jmatchStart("I think that", s, m)) {
33  
    UserBelief ub = new UserBelief(ul);
34  
    ub.beliefText = m.rest();
35  
  } else if (jmatchStart("I don't think that", s, m)) {
36  
    UserBelief ub = new UserBelief(ul);
37  
    ub.negative = true;
38  
    ub.beliefText = m.rest();
39  
  }
40  
}
41  
42  
static void dbActions {
43  
}

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: 536 / 833
Referenced in: [show references]