Download Jar. Libraryless. Click here for Pure Java version (23867L/184K).
1 | !759 |
2 | |
3 | !include #1011665 // WebNode v3 |
4 | //!include #1011668 // WebNode v2.5 |
5 | //!include #1007689 // WebNode v2 |
6 | |
7 | sbool greetCookies, theoryOn; |
8 | |
9 | static new L thoughtBots; |
10 | static long started; |
11 | static Class theoryModule; |
12 | static Lock theoryLock = lock(); |
13 | static double delay = 0; |
14 | static S selectedWord; |
15 | static int myPort = 4678; |
16 | static double speculationTimeoutForHttp = 5.0; // 5 seconds |
17 | static Queue<S> speculationQueue = new ConcurrentLinkedQueue; |
18 | |
19 | // save space |
20 | sclass E {} |
21 | set flag noCLParse. |
22 | |
23 | p { |
24 | started = sysNow(); |
25 | db(); |
26 | load('selectedWord); |
27 | autoRestart(5); |
28 | typicalDownload(); |
29 | serveHttp(myPort); |
30 | bot("Smart Bot."); |
31 | loadPage_forcedTimeout = 70000; |
32 | thoughtBots.add(mc()); |
33 | //loadBots(#1010753, #1010821, #1010825, #1001951); |
34 | loadBots(#1010825, #1001951); |
35 | |
36 | stefansChat_n_onChange(r { |
37 | clearTransientWebs(); |
38 | addTransientWeb(webFromTriple("Latest chat line", "is", "Chat line " + stefansChat_n_value)); |
39 | }); |
40 | |
41 | stefansChat_onLine_lookback = 2; |
42 | stefansChat_onLine_onHistoryRead.set(f onHistoryRead); |
43 | stefansChat_onLine_safe(voidfunc(S text) { |
44 | sleepSeconds(delay); |
45 | |
46 | pcall { |
47 | int nr = toInt(mapGet(stefansChat_onLine_fullParams!, "nr")); |
48 | print("> [" + nr + "] " + text); |
49 | if (nr != 0) { |
50 | S x = "Chat line " + nr; |
51 | ai_postTriple(x, "is", quote(text)); |
52 | ai_postTriple(x, "is", "recent"); |
53 | stefansChat_n_notify(nr); |
54 | ai_speculate(x); |
55 | } |
56 | } |
57 | |
58 | S answer = scanMultipleBots(thoughtBots, text); |
59 | if (nempty(answer)) |
60 | postToStefansChat(answer); |
61 | }); |
62 | //stefansChat_post("Smart Bot Upgraded! Boot took: " + formatDouble(fromMS(sysNow()-started), 1) + " s"); |
63 | |
64 | if (greetCookies) runInNewThread(#1010793); // Post on UAIP |
65 | |
66 | // Do the slow stuff |
67 | |
68 | addVirtualNodeIndex(hugeEnglishDictionary_virtualNodeIndex()); |
69 | loadTheory(); |
70 | |
71 | cachedNodeIndex(); // make index |
72 | ai_onNewIndexedText_do(func(S s) { speculationQueue.add(s) }); |
73 | thread "Speculator" { speculatorLoop(); } |
74 | } |
75 | |
76 | svoid loadTheory { |
77 | lock theoryLock; |
78 | cleanUp(theoryModule); |
79 | theoryModule = null; |
80 | if (!theoryOn) ret; |
81 | theoryModule = run(#1010963); |
82 | setOpt(theoryModule, 'onUpdate, r { call(theoryModule, 'react) }); |
83 | call(theoryModule, 'react); |
84 | print("Theory module loaded."); |
85 | } |
86 | |
87 | static int lineCount; |
88 | |
89 | sbool authed() { |
90 | ret isTrue(mapGet(stefansChat_onLine_fullParams!, 'auth)); |
91 | } |
92 | |
93 | sbool byBot() { |
94 | ret isTrue(mapGet(stefansChat_onLine_fullParams!, 'botMark)); |
95 | } |
96 | |
97 | |
98 | answer { |
99 | try { |
100 | ++lineCount; |
101 | bool authed = authed(); |
102 | lock dbLock(); |
103 | |
104 | s = ai_dropDroppableStuff(s); |
105 | |
106 | int safety = 0; |
107 | replaceloop: while (safety++ < 10) { |
108 | s = trim(s); |
109 | |
110 | try answer answer_inner(s, lineCount); |
111 | |
112 | for (WebNode node : indexedNodes(s)) { |
113 | S x = web_operandText(node, "replace with"); |
114 | if (x != null && neq(s, x)) { |
115 | print("Replacing with " + x); |
116 | s = x; |
117 | continue replaceloop; |
118 | } |
119 | } |
120 | |
121 | break; |
122 | } |
123 | |
124 | //if (ai_isQuestion_1(s)) ret "No idea"; |
125 | } catch print e { |
126 | ret exceptionToStringShort(e); |
127 | } |
128 | } |
129 | |
130 | sS answer_inner(S s, int lineCount) { |
131 | final new Matches m; |
132 | if (authed()) { |
133 | if (lineCount >= stefansChat_onLine_lookback) { |
134 | if (eqic(s, "!restart")) { restart(); ret "Yo"; } |
135 | if (eqic(s, "!theory")) ret "OK" with loadTheory(); |
136 | if (swic_trim(s, "!theory ", m)) |
137 | ret callAnswerFunction(theoryModule, m.rest()); |
138 | if (eqic(s, "!peep")) { |
139 | runAndCleanUp(#1010980); |
140 | ret "OK, got " + fileLength(ai_chatAnalysis_peepHoleFile()) + " bytes"; |
141 | } |
142 | |
143 | if (swic_trim(s, "!subst-web ", m)) { |
144 | L<S> tok = javaTokC(m.rest()); |
145 | if (l(tok) == 2) |
146 | ret ai_subst_web_charBasedReplace(first(tok), selectWord(unquote(last(tok)))); |
147 | else |
148 | ret ai_subst_web(m.rest()); |
149 | } |
150 | |
151 | if (eqic(s, "!idle-patterns")) { |
152 | time2 { |
153 | Either<Int, Thread> e = (Either) evalWithTimeoutReleasingDBLock(60.0, f ai_idle_matchPatterns); |
154 | } |
155 | ret e.isA() ? "Made " + nWebs(e.a()) + " in " + toSeconds(lastTiming(), 1) + "s" : "Timeout"; |
156 | } |
157 | |
158 | if (swic_trim(s, "!experiment ", m)) { |
159 | File outFile = directNohupJavax(m.rest()); |
160 | ret "OK, " + f2s(outFile); |
161 | } |
162 | |
163 | if (eqic(s, "!rotate")) { |
164 | rotateSoftwareMadeWebs(); |
165 | ret "OK"; |
166 | } |
167 | |
168 | if (swic_trim(s, "!speculate-all ", m)) { |
169 | time2 { |
170 | Either<Int, Thread> e = (Either) evalWithTimeoutReleasingDBLock(10.0, r { ai_speculate_all(m.rest()) }); |
171 | } |
172 | int n = 0; |
173 | |
174 | pcall { n = e.isA() ? e.a() : websMadeInThread(e.b()); } |
175 | |
176 | ret "Made " + nWebs(n) + " in " + toSeconds(lastTiming(), 1) + "s"; |
177 | } |
178 | |
179 | if (eqic(s, "!quick-transpile yourself")) ret transpileMyself('quick); |
180 | |
181 | if (eqic(s, "!medium-transpile yourself")) ret transpileMyself('medium); |
182 | } |
183 | |
184 | if "unlearn * *" |
185 | ret "OK, was: " + uniq(MatchLearner, pattern := $1).examples.put($2, 'rejected); |
186 | } |
187 | |
188 | if (ai_isQuestion_1(s) && !byBot()) { |
189 | selectWord(s); |
190 | ai_postTriple(s, "should be", "answered in the chat"); |
191 | } |
192 | |
193 | if "Are you online?" ret "Yes"; |
194 | if (eqicOneOf(s, "!question", "!gac")) |
195 | ret random_gac36k(); |
196 | |
197 | if (swic_trim(s, "!word ", m)) { |
198 | selectWord(m.rest()); |
199 | ret "OK " + unicode_rightPointingTriangle() + unicode_rightPointingTriangle(); |
200 | } |
201 | |
202 | if (swic_trim(s, "!search ", m)) { |
203 | selectWord("[search] " + m.rest()); |
204 | ret "OK " + unicode_rightPointingTriangle() + unicode_rightPointingTriangle(); |
205 | } |
206 | |
207 | |
208 | if (swic_trim(s, "!bench-search", m)) { |
209 | T3<S> t = ai_parseArrowTriple(m.rest()); |
210 | time2 { |
211 | int n = l(ai_search_dollarX(t)); |
212 | } |
213 | ret n(n, "result") + ", " + lastTiming() + " ms"; |
214 | } |
215 | |
216 | if (swic_trim(s, "!google ", m)) |
217 | ret join(" - ", swapPair(first(quickGoogle($1)))); |
218 | |
219 | if (swic_trim(s, "!has-triple ", m)) { |
220 | Triple<S> t = ai_parseArrowTriple(m.rest()); |
221 | ret yn(ai_cache_hasTriple(t)); |
222 | } |
223 | |
224 | if (swic_trim(s, "!triple ", m) || swic_trim(s, "!triples ", m)) { |
225 | L<S> elements = trimAll(splitAt(m.rest(), "->")); |
226 | if (l(elements) != 3) ret "3 parts please"; |
227 | ret "[IMAGE] " + "http://ai1.lol/1007546?triples=" + urlencode(lines(elements)); |
228 | } |
229 | |
230 | if (swic_trim(s, "!web ", m)) { |
231 | S id = $1; |
232 | Web web = indexedWebWithGlobalID(id); |
233 | if (web == null) ret "Not found"; |
234 | ret "[IMAGE] http://ai1.lol:" + myPort + "/diagram?id=" + id; |
235 | } |
236 | |
237 | if (swic_trim(s, "!parse ", m)) |
238 | ret ai_renderTriple(ai_tripelize(m.rest())); |
239 | |
240 | if (eqic(s, "!uptime")) |
241 | ret n(secondsSinceSysTime(started), "second"); |
242 | |
243 | if (eqic(s, "!typical-set")) |
244 | ret sfu(diagramServer_typicalSet()); |
245 | |
246 | if (eqic(s, "!num-unverified")) |
247 | ret lstr(ai_unverifiedWebs()); |
248 | |
249 | if (eqic(s, "!num-true")) |
250 | ret lstr(ai_trueWebs()); |
251 | |
252 | if (eqic(s, "!version")) |
253 | ret autoRestart_localMD5(); |
254 | |
255 | if (swic_trim(s, "!blob ", m)) { |
256 | S a = postNodeFromInput(m.rest(), s); |
257 | selectWord(m.rest()); |
258 | ret a; |
259 | } |
260 | |
261 | if (swic_trim(s, "!store ", m)) |
262 | ret postTripleFromInput(ai_tripelize(m.rest()), s); |
263 | |
264 | if (swic_trim(s, "!store-triple ", m)) |
265 | ret postTripleFromInput(ai_parseArrowTriple(m.rest()), s); |
266 | |
267 | if (swic(s, "!nodes ", m)) { |
268 | if (dropSuffixTrim("...", m.rest(), m)) |
269 | ret lstr(indexedNodesStartingWith(m.rest())); |
270 | ret lstr(indexedNodes(m.rest())); |
271 | } |
272 | |
273 | if (eqic(s, "!webs")) |
274 | ret lstr(allIndexedWebs()); |
275 | |
276 | if (swic(s, "!webs ", m)) |
277 | ret joinWithSpace(collect(indexedWebs($1), 'globalID)); |
278 | |
279 | if (swic(s, "!splitAtBaseFormVerb ", m)) |
280 | ret sfu(splitAtBaseFormVerb($1)); |
281 | |
282 | if (swic(s, "!maxRunlengthOfRepeatingChars ", m)) |
283 | ret str(maxRunlengthOfRepeatingChars($1)); |
284 | |
285 | if (swic(s, "!collapseWord ", m)) |
286 | ret collapseWord($1); |
287 | |
288 | if (swic(s, "!gac ", m)) |
289 | ret or2(first(scoredSearch(m.get(0), keys(gac36k()))), "-"); |
290 | |
291 | if (eqic(s, "!vms")) |
292 | ret computerVMs_text(); |
293 | |
294 | if (swic_trim(s, "!count-triple ", m)) { |
295 | T3<S> t = ai_parseArrowTriple(m.rest()); |
296 | print("Searching: " + sfu(t)); |
297 | Pair<Int> p = ai_countBoth_dollarX(t); |
298 | ret eq(p.a, p.b) ? str(p.a) |
299 | : p.a + " (+" + (p.b-p.a) + " unverified)"; |
300 | } |
301 | |
302 | pcall { try answer ai_sfCommands(s); } |
303 | |
304 | if (swic_trim(s, "!macmillan ", m)) try { |
305 | Pair<S, L<S>> p = macmillanDefinitions3(m.rest()); |
306 | ret toUpper(p.a) + "\n" + lines(prependAll("-", p.b)); |
307 | } catch e { |
308 | printShortException(e); |
309 | ret "Macmillan is quiet today."; |
310 | } |
311 | |
312 | try answer ai_answerFromCache(s); |
313 | |
314 | S _s = s; |
315 | s = ai_dropLeadingAdditions(s); |
316 | |
317 | if (neq(_s, s)) |
318 | try answer ai_answerFromCache(s); |
319 | |
320 | if "cache size" |
321 | ret n(keys(cachedNodeIndex()), "different term") |
322 | + ", " + n(web_countNodes(allWebs_cached()), "node") |
323 | + ", " + n(allWebs_cached(), "web"); |
324 | |
325 | if "give me subtypes of ..." |
326 | ret ai_renderList(ai_subtypesOf(m.rest())); |
327 | |
328 | if "give me a third person verb" |
329 | ret random(thirdPersonVerbs()); |
330 | |
331 | if (learnedFlexMatch("give me some *", s, m)) { |
332 | S query = singular($1); |
333 | ret ai_renderNodesList(concatLists( |
334 | ai_index_search_dollarX("$X", "is a", query), |
335 | ai_index_search_dollarX("$X", "is", a(query)))); |
336 | } |
337 | |
338 | if "authed?" |
339 | ret authed() ? "You are authed." : "You are not authed."; |
340 | |
341 | if "what is the singular of *" |
342 | ret or2(getSingularFromWordHippo($1), singular($1)); |
343 | |
344 | if (learnedFlexMatch("what is the relation between * and *", s, m)) { |
345 | L<S> l = ai_getRelation($1, $2); |
346 | //ret ai_renderList(l); |
347 | if (nempty(l)) ret $1 + " " + first(l) + " " + $2; |
348 | } |
349 | |
350 | if "what unix day is it" |
351 | ret str(unixDay()); |
352 | |
353 | if "show me the ..." |
354 | ret "What " + $1 + "?"; |
355 | |
356 | if (learnedFlexMatch("What do * have?", s, m)) |
357 | ret ai_renderNodesList(ai_index_search_dollarX($1, "have", "$X")); |
358 | |
359 | if (learnedFlexMatch("What does * do?", s, m)) |
360 | ret ai_renderList(map(f web_nodePairToText, webs_search_dollarXY(webFromTriples($1, "$X", "$Y"), indexedWebs($1)))); |
361 | |
362 | if (learnedFlexMatch_multi(s, m, "What is *", "Who is *", "Was ist *", "Wer ist *")) |
363 | try answer ai_renderNodesList(ai_whatIs(selectWord($1)), ""); |
364 | |
365 | S sf = web_text(first(ai_search_dollarX_verified("$X", "implements", quote(s)))); |
366 | if (startsWith(sf, "sf ", m)) |
367 | ret str(makeAndCall($1)); |
368 | |
369 | if (learnedFlexMatch("* how many visitors *", s) || match("how many visitors", s)) |
370 | ret str(ai1_cookiesToday_int()); |
371 | |
372 | // Once more with generated webs (replacing $ vars) |
373 | |
374 | if (learnedFlexMatch("What is *", s, m)) { |
375 | L<Web> extendedWebs = indexedWebsAfterVariableSubstitution($1); |
376 | print("Have " + n(extendedWebs, "extended web") + " for " + quote($1)); |
377 | ret ai_renderNodesList(webs_search_dollarX(webFromTriples($1, "is", "$X"), extendedWebs), "I don't know"); |
378 | } |
379 | |
380 | if (!ai_isQuestion_1(s) |
381 | && learnedFlexMatch_multi(s, m, "* is *", "* ist *")) |
382 | try answer postTripleFromInput(triple(m.get(0), "is", m.get(1)), s); |
383 | |
384 | null; |
385 | } |
386 | |
387 | svoid loadBots(S... botIDs) { |
388 | for (S id : botIDs) pcall { |
389 | thoughtBots.add(runSubBot(id)); |
390 | } |
391 | } |
392 | |
393 | static O html(S uri, SS params) { |
394 | time { |
395 | ret html_2(uri, params); |
396 | } |
397 | } |
398 | |
399 | static O html_2(S s, SS params) { |
400 | if (eqic(s, "/favicon.ico")) ret serve404(); |
401 | |
402 | if "thoughts" |
403 | ret serveHTML(html_thoughts()); |
404 | |
405 | if "diagram" { |
406 | S id = params.get("id"); |
407 | Web web = indexedWebWithGlobalID(id); |
408 | ret serveJPEG(webToCAL(web).makeImage(600, 400)); |
409 | } |
410 | |
411 | if "log" |
412 | ret serveText_direct(printLog()); |
413 | |
414 | if "learners" |
415 | ret serveText_direct(renderConcepts(list(MatchLearner))); |
416 | |
417 | // Serve Web With Global ID |
418 | |
419 | s = dropPrefix("/", s); |
420 | if (possibleGlobalID(s)) { |
421 | L<Web> webs = allWebsByID().get(s); |
422 | if (nempty(webs)) { |
423 | ret h2_title("Web " + s) |
424 | + pre(htmlencode(renderWeb_multiLine(first(webs)))) |
425 | + p(himg(ai_webImage_link(s), title := "Web " + s)) |
426 | + (l(webs) > 1 ? p("Warning: Multiple webs") : ""); |
427 | } |
428 | |
429 | /*if (theoryOn && theoryModule == null) ret serveHTML("Loading theory module"); |
430 | Map<S, O> map = (Map) getOpt(theoryModule, 'theoryForLineMap); |
431 | if (map.containsKey(toLower(s))) |
432 | ret serveHTML("A line in the chat.");*/ |
433 | ret serveHTML("Unknown: " + s); |
434 | } |
435 | |
436 | new Matches m; |
437 | if (swic(s, "e/", m)) { |
438 | S topic = urldecode(m.rest()); |
439 | time2 { |
440 | bool timeout = ai_speculateWithTimeout(topic, speculationTimeoutForHttp); |
441 | } |
442 | long time = lastTiming(); |
443 | ret h1_title(htmlencode_noQuote("Topic: " + topic)) |
444 | //+ p("Have " + n(indexedWebs(topic), "web"))) |
445 | + ai_html_wordThoughts(topic) |
446 | + p("Speculated for " + time + " ms" + (timeout ? " (TIMED OUT)" : "")); |
447 | } |
448 | |
449 | if (eqic(s, "alphabetical")) |
450 | ret html_alphabetical(); |
451 | |
452 | if (eqic(s, "latest-webs")) { |
453 | int n = toInt(params.get('n)); |
454 | ret html_latestWebs(min(1000, max(n, 10))); |
455 | } |
456 | |
457 | // Home Page |
458 | |
459 | Collection<S> keys = multiMapKeysByPopularity(cachedNodeIndex()); |
460 | |
461 | ret h1_title("Smart Bot's Encyclopedia (" + n_fancy(keys, "entry") + ")") |
462 | + p("Most occurring | " |
463 | + ahref("/alphabetical", "Alphabetical") + " | " |
464 | + ahref("/latest-webs", "Latest")) |
465 | + ul(map(func(S s) { |
466 | ahref(smartBot_encyclopediaLink(s), htmlencode(or2(s, "-"))) |
467 | + " [" + ai_approximateIndexedNodesCount(s) + "]" |
468 | }, keys)); |
469 | } |
470 | |
471 | static S html_alphabetical() { |
472 | ret h1_title("Smart Bot's Encyclopedia :)") |
473 | + ul(map(func(S s) { |
474 | ahref(smartBot_encyclopediaLink(s), htmlencode(or2(s, "-"))) |
475 | }, keys(cachedNodeIndex()))); |
476 | } |
477 | |
478 | static S html_latestWebs(int n) { |
479 | ret h1_title("Smart Bot's Encyclopedia - Latest Webs") |
480 | + ul(map(func(Web web) { ai_html_linkedWeb(web) + htmlencode(" [" + web.created + " - " + renderGMTDate(web.created) + "] " + web.source + ": ") + ai_html_renderWebShort(web) }, |
481 | takeFirst(n, sortByFieldDesc('created, allWebsFromCachedNodeIndex())))); |
482 | } |
483 | |
484 | sS html_thoughts() { |
485 | S html = /*hrefresh(5) +*/ hGoogleFontOswald(); |
486 | S status = ""; |
487 | Pair<Int> p = evalWithTimeout_numberOfCalculations(); |
488 | if (p.a > 0) status = p(n(p.a, "calculation") |
489 | + (p.b == 0 ? "" : ", " + p.b + " timed out")); |
490 | ret html + wordThoughts() + status; |
491 | |
492 | /* |
493 | if (theoryModule == null) |
494 | ret html + "Loading theory module..."; |
495 | S thoughts = (S) call(theoryModule, 'html_thoughts); |
496 | if (nempty(selectedWord)) |
497 | ret html + tag('table, tr(td_top(thoughts, style := "background: #CCC") + td_top(wordThoughts(), style := "padding-left: 20px"))); |
498 | ret html + thoughts; |
499 | */ |
500 | } |
501 | |
502 | sS wordThoughts() { |
503 | try { |
504 | if (empty(selectedWord)) ret ""; |
505 | ret html_addTargetBlank(ai_html_wordThoughts(selectedWord)); |
506 | } catch e { |
507 | printStackTrace(e); |
508 | ret "Erreur"; |
509 | } |
510 | } |
511 | |
512 | sS postTripleFromInput(T3<S> triple, S input) { |
513 | if (swic(input, "OK, stored")) null; |
514 | if (!ai_tripleAllowedToPost(triple)) null; |
515 | selectWord(triple.a); |
516 | if (ai_cache_hasTriple(triple)) |
517 | ret "I know"; |
518 | else { |
519 | Web web = webFromTriple(triple); |
520 | web.unverified = !authed(); |
521 | postSoftwareMadeWeb(web, +input); |
522 | ret "OK, stored" + (web.unverified ? " (unverified)" : "") + ": " + ai_renderTriple(triple); |
523 | } |
524 | } |
525 | |
526 | sS postNodeFromInput(S node, S input) { |
527 | if (!ai_nodeNameAllowedToPost(node)) null; |
528 | if (hasIndexedNode(node)) |
529 | ret "I know"; |
530 | else { |
531 | Web web = oneNodeWeb(node); |
532 | web.unverified = !authed(); |
533 | postSoftwareMadeWeb(web, +input); |
534 | ret "OK, stored" + (web.unverified ? " (unverified)" : "") + ": " + node; |
535 | } |
536 | } |
537 | |
538 | svoid processSelectedWord { |
539 | fS word = selectedWord; |
540 | if (empty(word)) ret; |
541 | ai_withMaker('processSelectedWord, r { |
542 | //ai_speculate(word); |
543 | pcall { |
544 | ai_greetingRule1(word); |
545 | if (ai_hasTriple(word, "should be", "answered by me") |
546 | && ai_postTriple(word, "was", "answered by me") != null) { |
547 | S text = firstQuoted(web_texts(ai_search_dollarX(word, "is", "$X"))); |
548 | postToStefansChat((nempty(text) ? text + " << " : "") + "Greetings back to you!"); |
549 | } |
550 | } |
551 | }); |
552 | } |
553 | |
554 | svoid makeChatLinesUnrecent { |
555 | new Matches m; |
556 | for (WebNode node : ai_search_dollarX("$X", "is", "recent")) |
557 | if (web_match("Chat line *", node, m)) pcall { |
558 | int n = parseInt($1); |
559 | if (n <= stefansChat_n_value-100) { |
560 | print("Unrecenting " + n); |
561 | ai_invalidateWeb(node.web); |
562 | } |
563 | } |
564 | } |
565 | |
566 | svoid onHistoryRead { |
567 | lock dbLock(); |
568 | print("History read."); |
569 | processSelectedWord(); |
570 | pcall { makeChatLinesUnrecent(); } |
571 | } |
572 | |
573 | sS selectWord(S word) { |
574 | if (nempty(word)) { |
575 | selectedWord = word; |
576 | save('selectedWord); |
577 | processSelectedWord(); |
578 | } |
579 | ret word; |
580 | } |
581 | |
582 | sS transpileMyself(S mode) { |
583 | postToStefansChat("Transpiling..."); |
584 | Pair<Bool, S> p = transpileOnServer(programID(), 'medium); |
585 | ret p.a ? "OK" : "Not OK"; |
586 | } |
587 | |
588 | svoid speculatorLoop { |
589 | repeat with sleep 1 { |
590 | ai_speculate(selectedWord); |
591 | ai_speculate(randomIndexedTerm()); |
592 | ai_activeSpec(selectedWord); |
593 | S s; |
594 | while ((s = speculationQueue.poll()) != null) { |
595 | long time = sysNow(); |
596 | ai_speculateWithActive(s); |
597 | done2_always(time, "Speculation Queue > " + s); |
598 | } |
599 | } |
600 | } |
Began life as a copy of #1010745
download show line numbers debug dex old transpilations
Travelled to 14 computer(s): aoiabmzegqzx, bhatertpkbcr, cbybwowwnfue, cfunsshuasjs, gwrvuhgaqvyk, ishqpsrjomds, lpdgvwnxivlt, mqqgnosmbjvj, onxytkatvevr, pyentgdyhuwx, pzhvpgtvlbxg, tslmcundralx, tvejysmllsmz, vouqrxazstgt
No comments. add comment
Snippet ID: | #1011666 |
Snippet name: | Smart Bot with WebNode v3 (dev.) |
Eternal ID of this version: | #1011666/7 |
Text MD5: | 8e627093042613a3de72f05a4f92f677 |
Transpilation MD5: | 71f2fb7d788d93efce76c6de4d82871d |
Author: | stefan |
Category: | javax / chat |
Type: | JavaX source code (desktop) |
Public (visible to everyone): | Yes |
Archived (hidden from active list): | No |
Created/modified: | 2017-11-02 03:33:48 |
Source code size: | 17687 bytes / 600 lines |
Pitched / IR pitched: | No / No |
Views / Downloads: | 566 / 1088 |
Version history: | 6 change(s) |
Referenced in: | [show references] |