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

86
LINES

< > BotCompany Repo | #1004997 // Identifying Persons AI [dev.]

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

Uses 13052K of libraries. Click here for Pure Java version (6995L/48K/157K).

!759

concepts.

!include #1004972 // Text AI Include

// application-specific interpretations
sconcept NewPerson extends Interpretation {}

sconcept PersonIs extends Interpretation {
  S x; // text of what person is
  new Ref concept; // optional concept for x
  bool neg; // neg = person is not that thing
}

sconcept PictureIs extends Interpretation {
  S imageID;
  bool neg; // neg = person is not on the picture
}

sconcept ThatsTheOne extends Interpretation {}
sconcept ThatsNotTheOne extends Interpretation {}

// application database

sconcept Person {
  bool current;
  new RefL<Interpretation> guesses;
}

static Person person;

static Map<Class, S> initialLines() {
  ret lithashmap(
    Hello.class, "Hello AI!",
    Praise.class, "Nicely done, AI.",
    NotForMe.class, "[Statement not meant for me]",
    Unclear.class, "[Unclear statement]",
    ByeBye.class, "Bye AI!",
    
    NewPerson.class, "Let's discuss another person.",
    ThatsTheOne.class, "That's the one!",
    ThatsNotTheOne.class, "No, that's not the one.");
}

static ImageSurface imageSurface;
static S dbName = "Identify Persons DB.";

p-substance {
  loadAndAutoSaveConcepts();
  initialUnaryConcepts(initialLines());
  concepts_quietSave = true;
  
  print("Lines: " + l(conceptsOfType("Line")));
  makeBot("Identify Persons.");
  methodsBot(dbName, listPlus(
    exposedDBMethods, "xfindLine"));
  initConsole();
  print("AI ready to rock. Go \"Admin\" to see my commands.");
  kevin("Hello");
  print();
}

static S answerInterpreted(S s, Interpretation ip) {
  if (ip instanceof Praise) ret kevin("Thank you :)");
  if (ip instanceof Hello) ret kevin("Hello! :)");
  if (ip instanceof ByeBye) {
    kevin("Bye user! :)");
    sleepSeconds(1);
    cleanKillVM();
  }
  if (ip instanceof NotForMe) ret kevin("Talk to the hand");
  if (ip instanceof Unclear) ret "[Unclear statement]";
  
  null;
}

svoid admin {
  thread "Admin" {
    O o = hotwire("#1004926");
    set(o, "dbName", dbName);
    set(o, "interpretations", splitAtSpace(
      "Praise NotForMe Hello ByeBye Unclear NewPerson ThatsTheOne ThatsNotTheOne"));
    callMain(o);
  }
}

Author comment

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: 609 / 770
Referenced in: