filler-classifier
Thai filler word classifier 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-classifier
Usage
from filler_classifier 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 already have a SentenceTransformer instance loaded (e.g., for other tasks), pass it in to avoid loading twice:
from sentence_transformers import SentenceTransformer
from filler_classifier import FillerClassifier
model = SentenceTransformer("intfloat/multilingual-e5-small")
clf = FillerClassifier(model=model)
Customizing Fillers
Override CATEGORY_FILLERS to use your own phrases:
import filler_classifier
filler_classifier.CATEGORY_FILLERS["complaint"] = ["ขออภัยค่ะ", "เข้าใจค่ะ"]
filler_classifier.CATEGORY_FILLERS["question"] = ["รอสักครู่นะคะ"]
License
MIT
Metadata
Release files for filler-classifier 0.2.6
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_classifier-0.2.6.tar.gz | 10.0 kB | Without provenance | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| filler_classifier-0.2.6-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 18.8 kB
Release files / filler_classifier-0.2.6.tar.gz
| Download URL | filler_classifier-0.2.6.tar.gz |
|---|---|
| Size | 10.0 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
182d8a8c52ed573a91b534a3173f26f0d5fee82110b3618d4f9e6873b18717fe
|
|
BLAKE2b-256 checksum How to use checksums |
3d256f89467d0890db432ddd039ca691c90e1ecd9cbf799be7c1403783c138af
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.14.3
|
Release files / filler_classifier-0.2.6-py3-none-any.whl
| Download URL | filler_classifier-0.2.6-py3-none-any.whl |
|---|---|
| Size | 8.8 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
f02a943e339ba2bd625f122d7df08903498f108d55180cc98c0659e11764eaf7
|
|
BLAKE2b-256 checksum How to use checksums |
585b49f115a6ee92de9c18c1551d0562cc2240301825c95dc81981ae843e02e7
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.14.3
|
Security for filler-classifier 0.2.6
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.