!7 p-experiment { L voiceLog = scanLog(cereprocLog()); L earLog = scanLog(speechRecognitionLog()); new L 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)); }