static S ai_specReturn_answerToExternalQuestion(S q, Var<S> answer) { answer.set("[Calculating...]"); q = switcheroo(q); print("Switcheroo to: " + q); T3<S> t = ai_tripelize(q); print("Have triple: " + t); if (t == null) ret "[Couldn't tripelize]"; /*t = ai_switcherooTriple(t); print("Have switched triple: " + t);*/ T3 tFact = ai_tripleWithoutQuestionMark(t); if (has_verbose(tFact)) ret "Yes"; T3 tNot = ai_negateTriple(t); if (has_verbose(tNot)) ret "No"; try answer ai_answerIsQuestion(t); try answer ai_answerWhatQuestion(t); S unknown = ai_findUnknownThingInTriple(t); if (unknown != null) ret "What is " + unknown + "?"; ret "[No answer found for: " + ai_renderTriple(t) + "]"; } static double ai_specReturn_answerToExternalQuestion_defaultTimeout = 10.0; static S ai_specReturn_answerToExternalQuestion(fS q) { ret ai_specReturn_answerToExternalQuestion(ai_specReturn_answerToExternalQuestion_defaultTimeout, q); } static S ai_specReturn_answerToExternalQuestion(double timeout, fS q) { final new Var<S> answer; evalWithTimeout(timeout, r { setVarUnlessNull(answer, ai_specReturn_answerToExternalQuestion(q, answer)) }); ret answer!; }
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: | #1012294 |
Snippet name: | ai_specReturn_answerToExternalQuestion |
Eternal ID of this version: | #1012294/14 |
Text MD5: | 9a769f54022e8f7e74dff90680df8e47 |
Author: | stefan |
Category: | javax / a.i. |
Type: | JavaX fragment (include) |
Public (visible to everyone): | Yes |
Archived (hidden from active list): | No |
Created/modified: | 2017-12-13 16:46:32 |
Source code size: | 1245 bytes / 38 lines |
Pitched / IR pitched: | No / No |
Views / Downloads: | 575 / 571 |
Version history: | 13 change(s) |
Referenced in: | [show references] |