filler-prediction
thai filler word prediction for voice bots. classifies customer input into categories and returns the appropriate filler phrase to play instantly while the llm generates a full response.
built for ingfah.ai voice bot but easily adaptable to any thai voice ai system.
why
voice bots have a latency problem: the user speaks, asr transcribes, then the llm takes 1-3 seconds to respond. dead silence feels broken. the solution is to play a short filler phrase ("สักครู่นะคะ", "ขออภัยด้วยน่ะคะ") immediately while the llm thinks.
but you can't play the same filler for everything. if someone is angry, "ได้เลยค่ะ" sounds dismissive. if someone asks a question, "ขออภัยด้วยน่ะคะ" makes no sense.
this classifier picks the right filler by category.
categories
| category | when | example fillers |
|---|---|---|
complaint |
angry, frustrated, profanity, threats | ขออภัยด้วยน่ะคะ |
question |
asking for info, pricing, how-to | สักครู่นะคะ, ตรวจสอบให้นะคะ |
default |
greetings, agreements, requests, everything else | รับทราบค่ะ, ได้เลยค่ะ |
default filler phrases
| category | fillers |
|---|---|
complaint |
ขออภัยด้วยน่ะคะ |
question |
สักครู่นะคะ, สักครู่ค่ะ, ตรวจสอบให้นะคะ |
default |
รับทราบค่ะ, ค่ะ ได้ค่ะ, ได้เลยค่ะ, ดีเลยค่ะ, ยินดีค่ะ |
a random filler is picked from the matching category each time. these are designed to be short (~0.3-0.5s when synthesized) for minimal latency.
how it works
uses intfloat/multilingual-e5-small embeddings with centroid-based cosine similarity:
- each category has ~30-60 anchor phrases (real thai customer service examples)
- on init, all anchors are embedded and averaged into category centroids
- at inference, the input is embedded and compared to centroids via cosine similarity
- the closest category wins, and a random filler from that category is returned
performance
- accuracy: 89.6% on 1,000 thai customer service sentences
- inference: <10ms per classification (after model load)
- init: ~200ms for centroid computation
- model size: ~118mb (multilingual-e5-small)
installation
pip install filler-prediction
usage
from filler_prediction import FillerClassifier
# loads model automatically on first init
clf = FillerClassifier()
# classify and get category + confidence + filler
category, confidence, filler = clf.classify("อยากถามเรื่องบิลครับ")
# ("question", 0.872, "สักครู่นะคะ")
category, confidence, filler = clf.classify("ใช้งานไม่ได้เลย")
# ("complaint", 0.891, "ขออภัยด้วยน่ะคะ")
category, confidence, filler = clf.classify("ได้ครับ ตกลง")
# ("default", 0.845, "ได้เลยค่ะ")
# or just get the filler phrase directly
filler = clf.get_filler("มีโปรอะไรบ้างครับ")
# "ตรวจสอบให้นะคะ"
sharing the model
if you alr have a SentenceTransformer instance loaded (e.g., for other tasks), pass it in to avoid loading twice:
from sentence_transformers import SentenceTransformer
from filler_prediction import FillerClassifier
model = SentenceTransformer("intfloat/multilingual-e5-small")
clf = FillerClassifier(model=model)
customizing fillers
override CATEGORY_FILLERS to use your own phrases:
import filler_prediction
filler_prediction.CATEGORY_FILLERS["complaint"] = ["ขออภัยค่ะ", "เข้าใจค่ะ"]
filler_prediction.CATEGORY_FILLERS["question"] = ["รอสักครู่นะคะ"]
license
mit
Metadata
Release files for filler-prediction 0.5.2
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | |
|---|---|---|---|---|
| filler_prediction-0.5.2.tar.gz | 15.1 kB | Without provenance | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| filler_prediction-0.5.2-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 26.8 kB
Release files / filler_prediction-0.5.2.tar.gz
| Download URL | filler_prediction-0.5.2.tar.gz |
|---|---|
| Size | 15.1 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
79a904b152de60579c6ecce80464dbfdb18b77fc8483d36ef66c6f1b7aaab893
|
|
BLAKE2b-256 checksum How to use checksums |
b17a523f221f6135412133d7a59fd2031a27346c228ebb6a0d3a4e70dd2f4863
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.14.3
|
Release files / filler_prediction-0.5.2-py3-none-any.whl
| Download URL | filler_prediction-0.5.2-py3-none-any.whl |
|---|---|
| Size | 11.7 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
70397532ce83db0aea8d3506bea13a7c7ae6ec7063b29d0545c7fa6e851a33ea
|
|
BLAKE2b-256 checksum How to use checksums |
adb5a1e0c4233fdbe78e46e819c0c35e7c29f1e7ac8858562beb33a5d0cacfca
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.14.3
|
Security for filler-prediction 0.5.2
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.