!7 enum EType { speakStart, speakEnd, heard, typed } sclass Event { long date; EType type; S text; S voice; *() {} *(long *date, EType *type, S *text) {} *(long *date, EType *type, S *text, S *voice) {} toString { ret date + ": " + toStringWithoutDate(); } S toStringWithoutDate() { ret type + ": " + text + (nempty(voice) ? " (" + voice + ")" : ""); } } static TailFile tail1, tail2; static Map events = synchroTreeMap(); p-experiment { tail1 = tailFileLinewiseFromStart(cereprocLog(), 100, voidfunc(S line) { if ((line = forceProperUnquote(line)) == null) ret; Pair p = splitAtFirstSpace(line); long date = parseLong(p.a); Map map = unstructureMap(p.b); print(date + ": " + sfu(map)); putLongUnique(events, date, new Event(date, swic(getString(map, 'action), "Begin") ? EType.speakStart : EType.speakEnd, getString(map, 'text), getString(map, 'voice))); }); tail2 = tailFileLinewiseFromStart(speechRecognitionLog(), 100, voidfunc(S line) { if ((line = forceProperUnquote(line)) == null) ret; int i = indexOf(line, '['); long date = parseLongOpt(trim(takeFirst(line, i))); if (date == 0) ret; Pair p = splitSquareBracketStuff(substring(line, i)); print("[heard at " + date + "]: " + p.a + ": " + p.b); putLongUnique(events, date, new Event(date, cic(p.a, "typed") ? EType.typed : EType.heard, p.b)); }); waitUntilAllTailsHaveIdled(tail1, tail2); print("\nHave " + n(events, "event") + "\n"); L l = valuesList(events); //pnlStruct(takeLast(10, l)); for i over l: { Event e = l.get(i); long diff = i == 0 ? 0 : e.date-l.get(i-1).date; print("[" + diff + " ms] " + e.toStringWithoutDate()); } print(); }