Uses 13052K of libraries. Click here for Pure Java version (6995L/48K/157K).
1 | !759 |
2 | |
3 | concepts. |
4 | |
5 | !include #1004972 // Text AI Include |
6 | |
7 | // application-specific interpretations |
8 | sconcept NewPerson extends Interpretation {} |
9 | |
10 | sconcept PersonIs extends Interpretation { |
11 | S x; // text of what person is |
12 | new Ref concept; // optional concept for x |
13 | bool neg; // neg = person is not that thing |
14 | } |
15 | |
16 | sconcept PictureIs extends Interpretation { |
17 | S imageID; |
18 | bool neg; // neg = person is not on the picture |
19 | } |
20 | |
21 | sconcept ThatsTheOne extends Interpretation {} |
22 | sconcept ThatsNotTheOne extends Interpretation {} |
23 | |
24 | // application database |
25 | |
26 | sconcept Person { |
27 | bool current; |
28 | new RefL<Interpretation> guesses; |
29 | } |
30 | |
31 | static Person person; |
32 | |
33 | static Map<Class, S> initialLines() { |
34 | ret lithashmap( |
35 | Hello.class, "Hello AI!", |
36 | Praise.class, "Nicely done, AI.", |
37 | NotForMe.class, "[Statement not meant for me]", |
38 | Unclear.class, "[Unclear statement]", |
39 | ByeBye.class, "Bye AI!", |
40 | |
41 | NewPerson.class, "Let's discuss another person.", |
42 | ThatsTheOne.class, "That's the one!", |
43 | ThatsNotTheOne.class, "No, that's not the one."); |
44 | } |
45 | |
46 | static ImageSurface imageSurface; |
47 | static S dbName = "Identify Persons DB."; |
48 | |
49 | p-substance { |
50 | loadAndAutoSaveConcepts(); |
51 | initialUnaryConcepts(initialLines()); |
52 | concepts_quietSave = true; |
53 | |
54 | print("Lines: " + l(conceptsOfType("Line"))); |
55 | makeBot("Identify Persons."); |
56 | methodsBot(dbName, listPlus( |
57 | exposedDBMethods, "xfindLine")); |
58 | initConsole(); |
59 | print("AI ready to rock. Go \"Admin\" to see my commands."); |
60 | kevin("Hello"); |
61 | print(); |
62 | } |
63 | |
64 | static S answerInterpreted(S s, Interpretation ip) { |
65 | if (ip instanceof Praise) ret kevin("Thank you :)"); |
66 | if (ip instanceof Hello) ret kevin("Hello! :)"); |
67 | if (ip instanceof ByeBye) { |
68 | kevin("Bye user! :)"); |
69 | sleepSeconds(1); |
70 | cleanKillVM(); |
71 | } |
72 | if (ip instanceof NotForMe) ret kevin("Talk to the hand"); |
73 | if (ip instanceof Unclear) ret "[Unclear statement]"; |
74 | |
75 | null; |
76 | } |
77 | |
78 | svoid admin { |
79 | thread "Admin" { |
80 | O o = hotwire("#1004926"); |
81 | set(o, "dbName", dbName); |
82 | set(o, "interpretations", splitAtSpace( |
83 | "Praise NotForMe Hello ByeBye Unclear NewPerson ThatsTheOne ThatsNotTheOne")); |
84 | callMain(o); |
85 | } |
86 | } |
Began life as a copy of #1004973
download show line numbers debug dex old transpilations
Travelled to 15 computer(s): aoiabmzegqzx, bhatertpkbcr, cbybwowwnfue, cfunsshuasjs, ddnzoavkxhuk, gwrvuhgaqvyk, ishqpsrjomds, lpdgvwnxivlt, mqqgnosmbjvj, onxytkatvevr, pyentgdyhuwx, pzhvpgtvlbxg, tslmcundralx, tvejysmllsmz, vouqrxazstgt
No comments. add comment
Snippet ID: | #1004997 |
Snippet name: | Identifying Persons AI [dev.] |
Eternal ID of this version: | #1004997/1 |
Text MD5: | 12f67ad25fed72b405b25bed0d65677f |
Transpilation MD5: | ac6e6bf84562ff537904f45010fb0d8a |
Author: | stefan |
Category: | javax / a.i. |
Type: | JavaX source code |
Public (visible to everyone): | Yes |
Archived (hidden from active list): | No |
Created/modified: | 2016-09-23 19:30:11 |
Source code size: | 2220 bytes / 86 lines |
Pitched / IR pitched: | No / No |
Views / Downloads: | 610 / 772 |
Referenced in: | [show references] |