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

40
LINES

< > BotCompany Repo | #1016789 // Correlate Speak & Hear Log Spike

JavaX source code (desktop) [tags: use-pretranspiled] - run with: x30.jar

Download Jar. Uses 3874K of libraries. Click here for Pure Java version (8168L/59K).

1  
!7
2  
3  
p-experiment {
4  
  L<S> voiceLog = scanLog(cereprocLog());
5  
  L<S> earLog = scanLog(speechRecognitionLog());
6  
  
7  
  new L<S> lines;
8  
  for (S s : earLog) {
9  
    S timestamp = beforeSpace(s);
10  
    if (!isInteger(timestamp)) continue;
11  
    if (!cic(s, "[Chrome Speech]")) continue;
12  
    int i = -Collections.binarySearch(voiceLog, timestamp)-2;
13  
    while (i > 0 && !eq(safeUnstructMap(dropUntilSpace(get(voiceLog, i))).get("action"), "End talking")) --i;
14  
    S said = get(voiceLog, i);
15  
    S timestamp2 = beforeSpace(said);
16  
    if (!isInteger(timestamp2)) continue; // huh?
17  
    long diff = parseLong(timestamp)-parseLong(timestamp2);
18  
    if (diff >= 10000) continue;
19  
    
20  
    Map map = safeUnstructMap(dropUntilSpace(said));
21  
    S textSaid = (S) map.get("text");
22  
    
23  
    long talkLength = 0;
24  
    S prev = get(voiceLog, i-1);
25  
    Map prevMap = safeUnstructMap(dropUntilSpace(prev));
26  
    if (eq(mapGet(prevMap, "action"), "Begin talking")
27  
      && eq(mapGet(prevMap, "text"), textSaid))
28  
      talkLength = parseLong(timestamp2)-parseLong(beforeSpace(prev));
29  
    if (talkLength == 0) continue;
30  
31  
    //print(s + " => " + i + ", " + diff + " ms " + dropUntilSpace(said));
32  
    S heard = afterSquareBracketStuff(s);
33  
    int ratio = intPercentRatio(diff, talkLength);
34  
    //lines.add(pad(diff, 5) + " ms/" + pad(talkLength, 5) + " ms: " + textSaid + " => " + heard);
35  
    lines.add(pad(diff, 5) + " ms/" + pad(ratio, 5) + " %: " + textSaid + " => " + heard);
36  
    //lines.add(pad(ratio, 5) + " % (" + pad(talkLength, 5) + " ms): " + textSaid + " => " + heard);
37  
  }
38  
  
39  
  printLines(sorted(lines));
40  
}

Author comment

Began life as a copy of #1016787

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: #1016789
Snippet name: Correlate Speak & Hear Log Spike
Eternal ID of this version: #1016789/23
Text MD5: 1960ab0a5cb5853f8a314ce4fd5ab75d
Transpilation MD5: a5d413e042b9d51db99cb3bbe07e9042
Author: stefan
Category: javax / speech
Type: JavaX source code (desktop)
Public (visible to everyone): Yes
Archived (hidden from active list): No
Created/modified: 2018-07-02 16:34:15
Source code size: 1620 bytes / 40 lines
Pitched / IR pitched: No / No
Views / Downloads: 478 / 1214
Version history: 22 change(s)
Referenced in: [show references]