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

1  
!7
2  
3  
concept Translation {
4  
  S english, conceptLanguage;
5  
}
6  
7  
concept FAQ {
8  
  S question, answer;
9  
}
10  
11  
concept UnansweredQuestion {
12  
  S question;
13  
  long lastSeen;
14  
}
15  
16  
static Concepts translations, faqs;
17  
18  
p {
19  
  db();
20  
  translations = new Concepts(#1007165).load();
21  
  faqs = new Concepts(#1007182).load();
22  
  bot();
23  
}
24  
25  
static S englishToConceptLanguage(S s) {
26  
  for (Translation t : list(translations, Translation))
27  
    if (match(t.english, s))
28  
      ret t.conceptLanguage;
29  
  ret s;
30  
}
31  
32  
answer {
33  
  s = englishToConceptLanguage(s);
34  
  for (FAQ faq : list(faqs, FAQ))
35  
    if (match(faq.question, s))
36  
      ret faq.answer;
37  
  cset(uniq(UnansweredQuestion, question := s), lastSeen := now());
38  
}

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: 524 / 624
Version history: 1 change(s)
Referenced in: [show references]