talkTime
#12
by paiheng - opened
No description provided.
Talk time: frontend usage
The endpoint now returns talk metrics measured in seconds, alongside the existing word-count metrics. I didn't change how any existing field behaves, so frontend needs to link the new time-based fields.
Input
Each item in inputs can be a row from the transcript CSV as-is:
{"utterance_index": 7, "speaker_uid": "7b90bc03…", "start_time": 151.283, "end_time": 151.646,
"utterance_text": "Thank you.", "speaker_id_confidence": 0.9568}
The old format (uid, speaker, text, starttime, endtime) still works. Set parameters.uptake_speaker to the teacher's speaker_uid.
Session-level fields
| Field | Use it for | Example |
|---|---|---|
talkTimeDistribution |
Teacher vs student share of talk time, in % (adds up to 100) | {"teacher": 93, "student": 7} |
talkTimeTotal |
Total seconds spoken per role | {"teacher": 2012.75, "student": 149.24} |
talkTimeLength |
Average seconds per utterance | {"teacher": 10.65, "student": 1.3} |
sessionDuration |
Seconds from first start to last end of the timed utterances. Use as the denominator for "share of class time" (includes silence) | 3941.88 |
talkTimeUntimedUtterances |
Number of utterances skipped because they have no timestamps | 0 |
talkTimeBySpeaker |
Per-speaker breakdown, keyed by speaker_uid |
see below |
"talkTimeBySpeaker": {
"7b90bc03…": {"role": "teacher", "seconds": 2012.75, "timedUtterances": 189, "untimedUtterances": 0, "avgConfidence": 0.9358},
"57466d42…": {"role": "student", "seconds": 92.06, "timedUtterances": 80, "untimedUtterances": 0, "avgConfidence": 0.2946},
"unknown": {"role": "student", "seconds": 39.0, "timedUtterances": 72, "untimedUtterances": 0, "avgConfidence": 0.4938}
}
To compute per-speaker shares, use seconds. Decide whether to leave out the unknown entry before dividing.
When data is missing:
- Utterances without timestamps are skipped in all time fields and counted in
talkTimeUntimedUtterancesand in each speaker'suntimedUtterances. If those counts are non-zero, the seconds are an undercount for that speaker. Consider showing a warning rather than hiding the numbers. - No
uptake_speaker:talkTimeDistribution,talkTimeTotalandtalkTimeLengtharenull, because they need to know who the teacher is.sessionDurationandtalkTimeBySpeakerare still returned, withrole: nullfor every speaker. - No timestamps at all: every time field is
null. Show "not available" rather than falling back to words.
Timeline (talkMoments) fields
| Field | Unit |
|---|---|
duration (new) |
Always seconds, or null without timestamps |
wordCount |
Always words |
timestamp |
[start, end] in seconds |
unitMeasure / aggregateUnitMeasure |
Existing behavior, unchanged: seconds (duration / end time) when every utterance has timestamps, word counts (count / running total) otherwise |
For new work, use duration and wordCount so the unit is always clear.
Unchanged fields
talkDistribution and talkLength are still based on word counts, exactly as before.
Notes
- One teacher per session. Only one speaker (
uptake_speaker) can be the teacher. Support for multiple teachers would be a separate implementation. - Unknown speaker.
unknownrows ([crosstalk]placeholders) are left out oftalkTimeDistribution,talkTimeTotalandtalkTimeLength. They are listed intalkTimeBySpeaker. The word-based fields still count them as student talk, as before. - Duplicate rows. Exact duplicates (same speaker, times and text) count once in the time fields. Untimed utterances are never treated as duplicates, since repeated short turns like "Yeah." are common. Other measures are unaffected.
- Overlapping speech. When two people talk at the same time, each is credited with the overlap.
- Speaker-ID confidence. Reported as
avgConfidencebut not used to filter. Student confidence is often low. Per-student numbers are approximate. - Rounding. New fields are rounded to 2 decimals.
unitMeasure/aggregateUnitMeasureare not rounded. - Fixes. The handler no longer crashes when
uptake_speakeris missing; before this change, a request without it failed entirely. The word-basedtalkDistribution/talkLengthstill need a teacher and arenullwithout one. String timestamps (e.g."151.283") are now converted to numbers instead of raising an error.
paiheng changed pull request status to open