| 1 | scope isItMyUtterance. | 
| 2 | |
| 3 | static int #magicInterval = 2000; | 
| 4 | static int #reallyLongDelay = 10000; | 
| 5 | |
| 6 | // returns (bool result, assumptions) | 
| 7 | static Pair<Bool, S> isItMyUtterance(long timestamp, S heard) {
 | 
| 8 | Pair<Long, S> said = lastVoiceOutputEndBeforeTimestamp(timestamp); | 
| 9 |   if (said != null && said.a <= reallyLongDelay) {
 | 
| 10 | S info = "this (delay=" + said.a + " ms): " + heard | 
| 11 | + (match(heard, said.b) ? "" : " (said: " + said.b + ")"); | 
| 12 | |
| 13 |     if (said.a <= magicInterval) {
 | 
| 14 | ret pair(true, "Assuming I said " + info); | 
| 15 | } else | 
| 16 | ret pair(false, "Assuming I did not say " + info); | 
| 17 | } else ret pair(false, ""); | 
| 18 | } | 
| 19 | |
| 20 | static Pair<Bool, S> isItMyUtterance(S s) {
 | 
| 21 | S heard = afterSquareBracketStuff(s); | 
| 22 | long timestamp = parseFirstLong(s); | 
| 23 | ret isItMyUtterance(timestamp, heard); | 
| 24 | } | 
| 25 | |
| 26 | end scope | 
Began life as a copy of #1016794
download show line numbers debug dex old transpilations
Travelled to 14 computer(s): aoiabmzegqzx, bhatertpkbcr, cbybwowwnfue, cfunsshuasjs, gwrvuhgaqvyk, irmadwmeruwu, ishqpsrjomds, lpdgvwnxivlt, mqqgnosmbjvj, pyentgdyhuwx, pzhvpgtvlbxg, tslmcundralx, tvejysmllsmz, vouqrxazstgt
No comments. add comment
| Snippet ID: | #1016835 | 
| Snippet name: | isItMyUtterance | 
| Eternal ID of this version: | #1016835/4 | 
| Text MD5: | d326796264afe568fade9b3667245f6a | 
| Author: | stefan | 
| Category: | javax / speech | 
| Type: | JavaX fragment (include) | 
| Public (visible to everyone): | Yes | 
| Archived (hidden from active list): | No | 
| Created/modified: | 2018-07-06 17:46:16 | 
| Source code size: | 831 bytes / 26 lines | 
| Pitched / IR pitched: | No / No | 
| Views / Downloads: | 603 / 655 | 
| Version history: | 3 change(s) | 
| Referenced in: | [show references] |