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).

!7

p-experiment {
  L<S> voiceLog = scanLog(cereprocLog());
  L<S> earLog = scanLog(speechRecognitionLog());
  
  new L<S> lines;
  for (S s : earLog) {
    S timestamp = beforeSpace(s);
    if (!isInteger(timestamp)) continue;
    if (!cic(s, "[Chrome Speech]")) continue;
    int i = -Collections.binarySearch(voiceLog, timestamp)-2;
    while (i > 0 && !eq(safeUnstructMap(dropUntilSpace(get(voiceLog, i))).get("action"), "End talking")) --i;
    S said = get(voiceLog, i);
    S timestamp2 = beforeSpace(said);
    if (!isInteger(timestamp2)) continue; // huh?
    long diff = parseLong(timestamp)-parseLong(timestamp2);
    if (diff >= 10000) continue;
    
    Map map = safeUnstructMap(dropUntilSpace(said));
    S textSaid = (S) map.get("text");
    
    long talkLength = 0;
    S prev = get(voiceLog, i-1);
    Map prevMap = safeUnstructMap(dropUntilSpace(prev));
    if (eq(mapGet(prevMap, "action"), "Begin talking")
      && eq(mapGet(prevMap, "text"), textSaid))
      talkLength = parseLong(timestamp2)-parseLong(beforeSpace(prev));
    if (talkLength == 0) continue;

    //print(s + " => " + i + ", " + diff + " ms " + dropUntilSpace(said));
    S heard = afterSquareBracketStuff(s);
    int ratio = intPercentRatio(diff, talkLength);
    //lines.add(pad(diff, 5) + " ms/" + pad(talkLength, 5) + " ms: " + textSaid + " => " + heard);
    lines.add(pad(diff, 5) + " ms/" + pad(ratio, 5) + " %: " + textSaid + " => " + heard);
    //lines.add(pad(ratio, 5) + " % (" + pad(talkLength, 5) + " ms): " + textSaid + " => " + heard);
  }
  
  printLines(sorted(lines));
}

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: 476 / 1208
Version history: 22 change(s)
Referenced in: [show references]