Not logged in.  Login/Logout/Register | List snippets | | Create snippet | Upload image | Upload data

26
LINES

< > BotCompany Repo | #1016794 // onSpeechRecognized_withoutMyUtterances

JavaX fragment (include)

1  
please include function onSpeechRecognized.
2  
3  
static int onSpeechRecognized_withoutMyUtterances_magicInterval = 2000;
4  
static int onSpeechRecognized_withoutMyUtterances_reallyLongDelay = 10000;
5  
6  
// f : voidfunc(S) - gets only the utterance
7  
static TailFile onSpeechRecognized_withoutMyUtterances(fO f) {
8  
  ret watchQuotedLog_future(speechRecognitionLog(), onSpeechRecognized_interval, voidfunc(S s) {
9  
    S heard = afterSquareBracketStuff(s);
10  
    long timestamp = parseFirstLong(s);
11  
    
12  
    Pair<Long, S> said = lastVoiceOutputEndBeforeTimestamp(timestamp);
13  
    if (said != null && said.a <= onSpeechRecognized_withoutMyUtterances_reallyLongDelay) {
14  
      S info = "this (delay=" + said.a + " ms): " + heard
15  
        + (match(heard, said.b) ? "" : " (said: " + said.b + ")");
16  
        
17  
      if (said.a <= onSpeechRecognized_withoutMyUtterances_magicInterval) {
18  
        print("Assuming I said " + info);
19  
        ret;
20  
      } else
21  
        print("Assuming I did not say " + info);
22  
    }
23  
    
24  
    pcallF(f, heard);
25  
  });
26  
}

Author comment

Began life as a copy of #1014810

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: #1016794
Snippet name: onSpeechRecognized_withoutMyUtterances
Eternal ID of this version: #1016794/9
Text MD5: 1f5c92041a28a345857815f0935d0b6d
Author: stefan
Category: javax / speech
Type: JavaX fragment (include)
Public (visible to everyone): Yes
Archived (hidden from active list): No
Created/modified: 2018-07-02 17:03:02
Source code size: 1040 bytes / 26 lines
Pitched / IR pitched: No / No
Views / Downloads: 435 / 476
Version history: 8 change(s)
Referenced in: [show references]