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

38
LINES

< > BotCompany Repo | #1007183 // Answer FAQs [dev.]

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

Libraryless. Click here for Pure Java version (6923L/45K/154K).

!7

concept Translation {
  S english, conceptLanguage;
}

concept FAQ {
  S question, answer;
}

concept UnansweredQuestion {
  S question;
  long lastSeen;
}

static Concepts translations, faqs;

p {
  db();
  translations = new Concepts(#1007165).load();
  faqs = new Concepts(#1007182).load();
  bot();
}

static S englishToConceptLanguage(S s) {
  for (Translation t : list(translations, Translation))
    if (match(t.english, s))
      ret t.conceptLanguage;
  ret s;
}

answer {
  s = englishToConceptLanguage(s);
  for (FAQ faq : list(faqs, FAQ))
    if (match(faq.question, s))
      ret faq.answer;
  cset(uniq(UnansweredQuestion, question := s), lastSeen := now());
}

download  show line numbers  debug dex  old transpilations   

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

No comments. add comment

Snippet ID: #1007183
Snippet name: Answer FAQs [dev.]
Eternal ID of this version: #1007183/2
Text MD5: dcb8ff771e405903f0db78d1af0bc832
Transpilation MD5: 4e6c01f2ec6e93c4475fb073ae8ec41d
Author: stefan
Category: javax / a.i.
Type: JavaX source code
Public (visible to everyone): Yes
Archived (hidden from active list): No
Created/modified: 2017-03-10 17:40:00
Source code size: 715 bytes / 38 lines
Pitched / IR pitched: No / No
Views / Downloads: 456 / 534
Version history: 1 change(s)
Referenced in: [show references]