Uses 911K of libraries. Click here for Pure Java version (3430L/18K).
1 | !7 |
2 | |
3 | sclass Prop { |
4 | S text, module; |
5 | long date = now(); |
6 | |
7 | [stdEq] |
8 | } |
9 | |
10 | cmodule ProposedVoiceOutput > DynObjectTable<Prop> { |
11 | transient int expiryTime = 10000; |
12 | transient long timer; // When we began thinking |
13 | transient int thinkTime = 2000; |
14 | |
15 | start { |
16 | // now default: |
17 | // itemToMap = func(Prop p) -> Map { humanizeKeys(objectToMap(p)) }; |
18 | doEvery(1000, r cleanList); |
19 | } |
20 | |
21 | void addProposition(S text, S module) { |
22 | syncRemoveWhereFields(data, +text, +module); |
23 | add(nu(Prop, +text, +module)); |
24 | } |
25 | |
26 | void cleanList { |
27 | setField(data := objectsWhereFieldGreaterThan(cloneList(data), date := now()-expiryTime)); |
28 | if (syncNempty(data)) { |
29 | if (timer == 0) timer = now(); |
30 | if (now() >= timer+thinkTime) { |
31 | S out = getString(random(data), 'text); |
32 | clear(); |
33 | timer = 0; |
34 | if (ai_shouldAnswerAtLeastSometimes()) |
35 | dm_say(out); |
36 | else |
37 | print("Would say: " + out); |
38 | } |
39 | } |
40 | } |
41 | } |
download show line numbers debug dex old transpilations
Travelled to 16 computer(s): aoiabmzegqzx, bhatertpkbcr, cbybwowwnfue, cfunsshuasjs, gwrvuhgaqvyk, irmadwmeruwu, ishqpsrjomds, lpdgvwnxivlt, mqqgnosmbjvj, onxytkatvevr, pyentgdyhuwx, pzhvpgtvlbxg, tslmcundralx, tvejysmllsmz, vouqrxazstgt, xrpafgyirdlv
No comments. add comment
Snippet ID: | #1016982 |
Snippet name: | Proposed Voice Output |
Eternal ID of this version: | #1016982/20 |
Text MD5: | 2e7180ece0e5ad38e7a3a4e441d9c531 |
Transpilation MD5: | f8d0a4e109c2af0962f6b4a7d2e9bcc2 |
Author: | stefan |
Category: | javax / dynamic modules |
Type: | JavaX source code (Dynamic Module) |
Public (visible to everyone): | Yes |
Archived (hidden from active list): | No |
Created/modified: | 2020-02-17 17:46:12 |
Source code size: | 1005 bytes / 41 lines |
Pitched / IR pitched: | No / No |
Views / Downloads: | 549 / 8158 |
Version history: | 19 change(s) |
Referenced in: | [show references] |