BanglaEComIntent / README.md
Badhon's picture
Update README.md
97b80c6 verified
|
Raw
History Blame Contribute Delete
13.8 kB
---
language:
- bn
- en
license: cc-by-nc-sa-4.0
annotations_creators:
- machine-generated
language_creators:
- machine-generated
- expert-generated
multilinguality:
- multilingual
size_categories:
- 1K<n<10K
source_datasets:
- original
task_categories:
- text-classification
task_ids:
- intent-classification
- multi-class-classification
pretty_name: Badhon/BanglaEComIntent
tags:
- bangla
- bengali
- banglish
- code-mixing
- transliteration
- low-resource
- intent-detection
- out-of-scope-detection
- customer-support
- e-commerce
- synthetic
configs:
- config_name: default
data_files:
- split: train
path: train.csv
- split: validation
path: val.csv
- split: test
path: test.csv
dataset_info:
features:
- name: text
dtype: string
- name: intent
dtype:
class_label:
names:
'0': greeting
'1': goodbye
'2': thanks
'3': product_search
'4': product_availability
'5': price_inquiry
'6': order_status
'7': order_cancel
'8': return_refund
'9': shipping_delivery
'10': payment_issue
'11': discount_offer
'12': complaint
'13': agent_request
'14': out_of_scope
- name: script
dtype: string
splits:
- name: train
num_examples: 5404
- name: validation
num_examples: 817
- name: test
num_examples: 806
---
# Bangla / English / Banglish E-commerce Intent Classification
A 15-intent classification dataset for a Bangladeshi e-commerce chat/search box,
covering the three ways customers actually write:
| script | example | rows |
|---|---|---|
| `bn` Bengali script | `আমার অর্ডার কোথায়` | 2,227 |
| `en` English | `where is my order` | 2,245 |
| `bl` Banglish (romanized Bangla) | `amar order kothay` | 2,137 |
| `mx` code-mixed mid-sentence | `taka katlo kintu confirmation ashe নাই` | 418 |
**7,027 rows, 1,566 distinct templates, 15 intents** — including an explicit
`out_of_scope` reject class.
> ⚠️ **This is synthetic data.** It is a bootstrap for getting a CPU intent
> classifier off the ground when you have no logs yet, not a substitute for real
> ones. See [Limitations](#limitations-and-bias) before you rely on a number
> measured here. The companion hand-written holdout is the honest signal.
## Dataset structure
### Fields
| field | type | description |
|---|---|---|
| `text` | `string` | the user message, 1–16 words |
| `intent` | `class_label` | one of 15 labels (below) |
| `script` | `string` | `bn` \| `en` \| `bl` \| `mx` — writing system, useful for per-script error analysis |
`script` is metadata, not a training feature. It exists so you can report
accuracy per writing system, which is where the interesting failures hide —
Banglish and code-mixed rows are consistently harder than either monolingual
form.
### Splits
```python
from datasets import load_dataset
ds = load_dataset("Badhon/BanglaEComIntent")
# DatasetDict({train: 5404, validation: 817, test: 806})
```
| split | rows | templates |
|---|---|---|
| `train` | 5,404 | 1,200 |
| `validation` | 817 | 183 |
| `test` | 806 | 183 |
**The splits are disjoint at template level, not row level.** This is the most
important property of the dataset and the thing most synthetic intent corpora
get wrong. Each template is assigned to exactly one split *before* it expands
into surface rows, so no test row is a respelling, recasing, code-mixing or
politeness-affixed variant of a training row. Leakage is also blocked on a
punctuation/case/affix-insensitive canonical form, so `coupon` in train does not
permit `Coupon??` in test.
A dataset built the naive way — expand first, split rows randomly — reports
~99.9% test accuracy that is pure memorization. Under template-level splitting
the same fastText model scores **0.754**, which matches its score on unseen
hand-written sentences (0.730). Those two numbers agreeing is what tells you the
benchmark is measuring generalization.
### Label distribution
| intent | train | val | test | total | description |
|---|---|---|---|---|---|
| `product_search` | 629 | 77 | 86 | 792 | discovery — "what do you have" |
| `product_availability` | 428 | 67 | 74 | 569 | a specific item/size/colour in stock? |
| `shipping_delivery` | 393 | 60 | 48 | 501 | delivery policy, charge, coverage, timing |
| `price_inquiry` | 393 | 51 | 48 | 492 | what does it cost |
| `order_status` | 364 | 49 | 51 | 464 | where is *my* order |
| `complaint` | 349 | 52 | 52 | 453 | grievance with no specific remedy asked |
| `payment_issue` | 357 | 43 | 48 | 448 | failed/duplicate/pending transaction |
| `order_cancel` | 330 | 67 | 51 | 448 | cancel before receipt |
| `return_refund` | 331 | 47 | 52 | 430 | return/exchange/refund after receipt |
| `out_of_scope` | 311 | 62 | 56 | 429 | chitchat, other domains, noise |
| `agent_request` | 327 | 51 | 51 | 429 | escalate to a human |
| `discount_offer` | 321 | 54 | 52 | 427 | does a discount mechanism exist |
| `goodbye` | 303 | 46 | 43 | 392 | sign-off |
| `greeting` | 297 | 44 | 46 | 387 | opener, whole message |
| `thanks` | 271 | 47 | 48 | 366 | gratitude, whole message |
Roughly balanced by design (per-intent row caps during generation). Several of
these boundaries genuinely overlap — `order_status`/`shipping_delivery`,
`complaint`/`return_refund`, `price_inquiry`/`discount_offer`,
`product_search`/`product_availability` — and the tie-break rules used to label
consistently are documented in `LABELING.md`. Read it before adding data or
disputing a label.
### `out_of_scope`
The reject class, and the reason to prefer this dataset over a 14-intent one. A
closed-set softmax must put ~1.0 of its probability mass on *some* label, so a
model without a reject class answers `tomar basa kothay?` ("where do you live?")
as a confident `complaint`. No confidence threshold fixes that, because the
model was never given a way to express "none of the above".
Coverage spans four distinct kinds of off-domain input, because a model trained
only on chitchat negatives still answers confidently on gibberish:
- **Bot-directed chitchat**`tumi ki manush`, `tomake ke baniyeche`, `what model are you`
- **Other domains** — weather, cricket, prayer times, exchange rates, politics, jobs
- **General-assistant requests** — write a poem, tell a joke, teach me English, do this maths
- **Meta and noise**`test test`, `sent by mistake`, keyboard mash, emoji-only, digit-only, `hmm`
Deliberately **not** `out_of_scope`: profanity aimed at the shop (that is
`complaint` — actionable, route to a human), and vague-but-commercial fragments
(`ache?` is `product_availability`).
The class is capped at the same size as the others on purpose. An oversized
reject class raises the false-fallback rate — real customers routed to "I don't
understand" — which costs more in production than a missed rejection.
## Evaluation
**Do not report the `test` split alone.** It is template-disjoint from train,
which makes it honest, but it still only answers "can you generalize across our
own templates". Pair it with the hand-written holdout in `shared/holdout.py`
(330 items, not shipped as a split because it must never be trained on):
- `DEV_HOLDOUT` (165) — tune against this: thresholds, hyperparameters, model selection
- `TEST_HOLDOUT` (165) — read once, when you are done
Every holdout item is written by hand to share no template with the generated
data, and the generator enforces this: any generated row matching a holdout item
is dropped at source, so promoting a good holdout sentence into a template
cannot silently contaminate training.
Reference numbers, quantized fastText (6 MB, ~0.1 ms/input on CPU), with
hyperparameters *not* retuned for this version of the data:
| metric | value |
|---|---|
| `test` accuracy | 0.754 |
| holdout accuracy (330) | 0.730 |
| macro F1 (test) | 0.749 |
| `out_of_scope` recall | 0.455 |
| false-fallback rate | 3–4 / 154 |
For a reject class, accuracy is the wrong headline. Track the two numbers that
trade off against each other:
- **OOS recall** — off-domain inputs correctly routed to fallback
- **false-fallback rate** — in-scope inputs wrongly sent to fallback (the real
cost; this is what annoys customers)
A model at 99% on the 14 business intents with 0% OOS recall is worse in
production than one a point lower with 85%.
## How it was built
Templates → bounded slot fills → sampled surface variants, with the split
assigned at step one. Stages that exist because real messages have properties
templates don't:
- **Code-mixing** — a Banglish→Bengali lexicon flips a random 40–80% subset of
words mid-sentence (`ei t-shirt tar price koto``এই t-shirt tar price koto`).
Latin loanwords (`order`, `delivery`, `payment`, `stock`, `discount`) are
deliberately excluded from the lexicon: Bangladeshi users type those in Latin
even inside an otherwise-Bengali sentence, and that asymmetry is the pattern
worth learning.
- **Phonetic noise** — Banglish misspelling is sound-level substitution
(`bh↔v`, `sh↔s`, `ph↔f`), dropped vowels (`kemon``kmon`) and word-boundary
drift (`koto dam``kotodam`), not random character swaps.
- **Fragments** — context-free follow-up turns (`koto?`, `ache?`, `kothay`)
where the intent rides on 1–4 words with no product noun present.
- **Glued social openers**`assalamu alaikum vai ei saree tar dam koto`, labelled
`price_inquiry`. The label always follows the actionable request, never the greeting.
- **Rambling preambles** — a sentence of context before the actual question, so
the model sees inputs longer than 8 words.
Reproduce with `python generate_data.py` (seeded, deterministic). Adding a
template to one intent does not reshuffle any other intent's split assignment.
## Limitations and bias
Please read this section before using the dataset as a benchmark.
- **Synthetic.** Generated from ~1,570 hand-written templates, not collected
from users. It encodes one author's model of how customers write, including
its blind spots. A model at 0.75 here is not a model at 0.75 in production.
- **Vocabulary ceiling.** ~2,400 unique tokens. Product nouns come from a
10-item list; brand names, regional dialect, and domain-specific jargon are
absent. Expect degradation on any catalogue that isn't generic apparel and
electronics.
- **Short inputs.** Mean 4.7 words, 95th percentile 8, max 16. Models trained
here will be poorly calibrated on long multi-paragraph messages.
- **Under-represented code-mixing.** 418 `mx` rows (6%) versus a real inbox
where code-mixing is far more common than that. It is seasoning here, not a
first-class script.
- **Bangladesh-specific.** Payment wallets (bKash, Nagad, Rocket), couriers,
cities, festivals (Eid, Puja), and honorifics (`vai`, `apu`) are all local.
West Bengal Bangla differs in vocabulary and register; Indian payment and
courier vocabulary is absent entirely.
- **Romanization is not standardized.** Banglish has no orthography. The
phonetic-variant generator covers a fraction of real spelling space, and its
substitution rules are hand-picked rather than learned from data.
- **Label noise on the overlapping boundaries.** The `LABELING.md` tie-breaks are
applied consistently by construction, but they are one defensible reading of
genuinely ambiguous cases. Your product may want them drawn elsewhere.
- **No inter-annotator agreement figure**, because there was one annotator.
- **No PII** — no real order IDs, names, phone numbers or addresses. Order IDs
are made-up strings from a fixed list.
### Intended and out-of-scope uses
**Intended:** bootstrapping a Bangla/Banglish intent classifier before you have
logs; benchmarking small CPU models (fastText, distilled transformers) on
code-mixed short text; a worked example of template-level splitting and
out-of-scope class construction.
**Not intended:** as evidence of production accuracy; as a general Bangla NLP
benchmark; for any high-stakes routing (payments, disputes, legal) without a
human in the loop and a calibrated reject threshold.
## Citation
```bibtex
@misc{banglaecomintent,
title = {BanglaEComIntent: Bangla / English / Banglish E-commerce Intent Classification},
year = {2026},
note = {Synthetic dataset, 15 intents, template-disjoint splits},
howpublished = {\url{https://huggingface.co/datasets/Badhon/BanglaEComIntent}}
}
```
## Licensing
**CC BY-NC-SA 4.0** ([Creative Commons Attribution-NonCommercial-ShareAlike
4.0](https://creativecommons.org/licenses/by-nc-sa/4.0/)).
The content is wholly generated from templates written for this repository, so
there is no upstream corpus license to inherit. What the terms mean in practice:
- **BY** — attribute the source when you use or redistribute it.
- **NC****no commercial use.** This is the clause to notice: training a
classifier that serves a commercial storefront is a commercial use. If this
dataset is meant to be deployable inside a business, `cc-by-sa-4.0` or
`apache-2.0` is the licence you want instead.
- **SA** — derivatives, including modified or extended versions of the data,
must carry the same licence. Whether a *model* trained on it counts as a
derivative work is legally unsettled and jurisdiction-dependent.
Add a `LICENSE` file containing the full CC BY-NC-SA 4.0 text alongside this
card; HuggingFace renders the tag either way, but the file is what makes the
grant explicit to anyone who downloads the CSVs on their own.