BlogSpeech-to-Text

Speaker turns in a Thai call transcript

A call transcript with two voices in one column is a puzzle. How diarization numbers the speakers, how a pipeline turns the numbers into roles, and what the numbers never claim.

· 4 min read

A recorded call has two voices and one audio track. A transcript of it in one column reads as a monologue, and every question a QA reviewer asks starts with who said that. Did the agent give the required notice, or did the customer read it back? Who mentioned the refund first? Diarization answers the first question, and the pipeline built on it answers the rest.

This post covers what Paxa STT Lite returns when diarization is on, how to map its speaker numbers to the roles on a call, and where the numbers stop. It ends with the shape of a QA check that runs on every call, with no sampling.

What comes back#

Send the recording with diarization set to true. The response carries the transcript as before, and a segments array beside it. Each segment is one turn with a speaker number, its text, and its start and end in seconds. Speakers are numbered from 0 in order of first appearance, and the numbers hold for the whole recording.

curl
AUDIO=$(base64 < meeting.m4a | tr -d '\n')
curl -X POST https://api.paxalabs.com/v1/stt \
  --max-time 300 \
  -H "Authorization: Bearer $PAXA_API_KEY" \
  -H "Content-Type: application/json" \
  -d "{\"audio\": \"$AUDIO\", \"model\": \"paxa-stt-lite-v1-preview\", \"diarization\": true}"
Response
{
  "text": "สวัสดีค่ะคุณสมชายยอดชำระของท่านจำนวน พันสองร้อยห้าสิบ บาทครบกำหนดวันที่ สิบห้า สิงหาคมนี้ชำระผ่านแอปได้ตลอด ยี่สิบสี่ ชั่วโมงค่ะ",
  "segments": [
    {
      "speaker": 0,
      "text": "สวัสดีค่ะคุณสมชายยอดชำระของท่านจำนวน พันสองร้อยห้าสิบ บาทครบกำหนดวันที่ สิบห้า สิงหาคมนี้ชำระผ่านแอปได้ตลอด ยี่สิบสี่ ชั่วโมงค่ะ",
      "start": 0.12,
      "end": 10.06
    }
  ],
  "usage": {
    "seconds": 10.25,
    "credits": 1.43
  }
}

Ask for word timestamps in the same request and every word carries its speaker number too. The turns give you the shape of the conversation, and the words give you the second inside a turn where a phrase was said.

four turns of a two-party call
speaker 0   0.0s   สวัสดีค่ะ ฝ่ายบริการลูกค้า ยินดีให้บริการค่ะ
speaker 1   3.2s   สวัสดีครับ โทรมาเรื่องบิลเดือนนี้ครับ
speaker 0   6.1s   ขอทราบเลขที่บัญชีสี่ตัวท้ายด้วยค่ะ
speaker 1   8.9s   สี่ห้าหกเจ็ดครับ

From numbers to roles#

The model numbers voices. It attaches no name, no role, and no identity. On a two-party call the mapping from number to role is yours, and three rules cover most contact centres.

  • The first voice is the agent. An inbound call opens with the greeting the agent is scripted to say. Speaker 0 is the agent whenever the first turn matches the greeting.
  • The greeting names the role. When the first turn fails to match, search the first three turns for the scripted phrase and take that speaker as the agent.
  • Two channels make it certain. A telephony system that records the agent and the customer on separate channels can send each channel as its own file. The role is then the file, and diarization within each file catches a transfer or a supervisor joining.

A call with a third voice, a supervisor or a transfer, arrives as speaker 2. A rule that expects two speakers should treat a third as a flag for review, since the conversation changed shape.

A QA check on every call#

With roles assigned, a script check is a set of string matches on the agent's turns. The greeting, the identity check, the hold notice, and the closing line each become a phrase the agent's turns must contain, with the second it was said. A call that misses one is the call a reviewer listens to.

Keyword alerts run on the customer's turns. The words for refund, cancel, and complaint, and the names of competitors, raise a call within minutes of it ending. A vocabulary of up to 50 product and plan names keeps their spelling the same across thousands of calls, which is what a string match needs.

Talk ratio is the third figure the turns give for free. Sum the seconds of each speaker's turns. An agent who speaks for eighty percent of a complaint call is a coaching conversation, and the figure comes from the segments array with no listening at all.

Where the numbers stop#

A diarized recording is read whole before the response returns, and a long call takes longer than a short one. Plan for the response to take tens of seconds on a long recording and send calls in parallel. The concurrency your plan allows is the number of calls in flight at once.

That one pass is also where the length stops. A diarized request takes a call under 9 minutes, well below the 60 minutes a plain transcript accepts, and a longer one answers 400 diarization_audio_too_long before any charge. Split it at a silence and send the parts in parallel. Speaker numbers restart in each part. Map roles per part with the same rules. Diarization changes no charge. The recording bills by its length, and the turns ride along.

Next steps#