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

41
LINES

< > BotCompany Repo | #1023476 // Ontology Helper Bot

JavaX source code (Dynamic Module) [tags: use-pretranspiled] - run with: Stefan's OS

Uses 911K of libraries. Click here for Pure Java version (13137L/68K).

!7

cmodule OntologyHelperBot > DynAttractorBot {
  AttractorBot makeBot() {
    ret new SingleAttractorBot {
      void process(S s) {
        s = trim(s);
        
        if "ontology size" ret with emitAnswer(
          nStatements((L) dm_call(dm_ontologyBot(), 'concepts)) + ": " +
            l((L) dm_call(dm_ontologyBot(), 'conceptsWithUsefulness, true)) 
            + " useful, " +
    l((L) dm_call(dm_ontologyBot(), 'conceptsWithUsefulness, false))
            + " not useful, "
            + l((L) dm_call(dm_ontologyBot(), 'unclassifiedConcepts)) + " unclassified");

        if (eqic(s, "!random"))
          ret with emitAnswer(call(dm_randomOntologyEntry(), 'render));
        
        if (eqic(s, "!homepage"))
          ret with emitAnswer("http://monkey.botcompany.de");
          
        if (eqic(s, "!classify")) {
          virtual Is entry = dm_randomUnclassifiedOntologyEntry();
          if (entry == null) ret with emitAnswer("Nothing to classify!");
          tempAttractor(new YesAttractor(r {
            print("Got yes");
            call(entry, 'setUseful, true);
            emitAnswer("Yo, stored");
          }));
          tempAttractor(new NoAttractor(r {
            print("Got no");
            call(entry, 'setUseful, false);
            emitAnswer("Yo, stored");
          }));
          ret with emitAnswer("Is this an acceptable general truth? " + simpleQuote((S) rcall render(entry)));
        }
      }
    };
  }
}

download  show line numbers  debug dex  old transpilations   

Travelled to 7 computer(s): bhatertpkbcr, cfunsshuasjs, mqqgnosmbjvj, pyentgdyhuwx, pzhvpgtvlbxg, tvejysmllsmz, vouqrxazstgt

No comments. add comment

Snippet ID: #1023476
Snippet name: Ontology Helper Bot
Eternal ID of this version: #1023476/13
Text MD5: 681b250df58804329c1fab8d76e609fd
Transpilation MD5: 6476395aa3e339223f9608d98ff6abba
Author: stefan
Category: javax / a.i.
Type: JavaX source code (Dynamic Module)
Public (visible to everyone): Yes
Archived (hidden from active list): No
Created/modified: 2019-06-25 15:45:26
Source code size: 1501 bytes / 41 lines
Pitched / IR pitched: No / No
Views / Downloads: 250 / 768
Version history: 12 change(s)
Referenced in: [show references]