mudasir13cs commited on
Commit
f8e11ec
·
verified ·
1 Parent(s): df59d4c

Update README.md

Browse files
Files changed (1) hide show
  1. README.md +128 -196
README.md CHANGED
@@ -1,5 +1,7 @@
1
  ---
2
  license: cc-by-sa-4.0
 
 
3
  task_categories:
4
  - text-generation
5
  - question-answering
@@ -8,47 +10,67 @@ tags:
8
  - query-rewriting
9
  - context-aware
10
  - conversational-search
 
11
  - nlp
12
  - llm
13
  - fine-tuning
 
 
 
 
 
14
  size_categories:
15
- - 10K<n<100K
16
  ---
17
 
18
- # E-Commerce Query Rewriting Dataset
19
 
20
- A comprehensive dataset for fine-tuning context-aware query rewriting models in e-commerce conversational agents.
21
 
22
- ## Dataset Summary
23
 
24
- This dataset contains **10,000 examples** of ambiguous user queries and their context-aware rewritten versions for e-commerce product search. It is designed to train models that can resolve pronouns, ellipsis, ordinals, and other ambiguous references using conversation context.
 
 
 
 
 
 
 
 
 
 
 
25
 
26
- ### Key Features
27
 
28
- - **Real-world e-commerce data** from Flipkart, Amazon, and MyOnlineShop
29
- - ✅ **Multi-context information** including previous searches, product lists, and conversation state
30
- - ✅ **7 distinct query rewriting patterns** covering common ambiguity types
31
- - ✅ **Variable product counts** (1-10 products) for realistic scenarios
32
- - ✅ **Well-structured format** ready for fine-tuning LLMs
33
 
34
- ## Dataset Structure
35
 
36
- ### Fields
 
 
 
 
 
 
37
 
38
  Each example contains:
39
 
40
- - **`original_query`** (string): Ambiguous user query requiring context resolution
41
- - **`context`** (dict): Conversation context including:
42
- - `last_search_query` (string): Previous search category/term
43
- - `current_state` (string): Current UI state (SEARCH_RESULTS, PRODUCT_DETAIL, INITIAL)
44
- - `product_titles` (list): List of product names from last search (1-10 items)
45
- - `last_command` (string): Previous command executed
46
- - `product_count` (int): Number of products in context (1-10)
47
- - **`rewritten_query`** (string): Clear, unambiguous query with resolved references
48
- - **`intent`** (string): User intent (search, show_detail, go_back, close)
49
- - **`command`** (string): System command (show_list, show_item, go_back, close)
 
50
 
51
- ### Example
52
 
53
  ```json
54
  {
@@ -73,172 +95,74 @@ Each example contains:
73
  }
74
  ```
75
 
76
- ## Dataset Statistics
77
-
78
- ### Overall Statistics
79
-
80
- - **Total Examples**: 10,000
81
- - **Product Sources**: Flipkart, Amazon, MyOnlineShop
82
- - **Format**: JSON with instruction-input-output structure
83
-
84
- ### Intent Distribution
85
-
86
- - **show_detail**: 6,000 (60.0%)
87
- - **search**: 3,500 (35.0%)
88
- - **navigation**: 500 (5.0%)
89
-
90
- ### Command Distribution
91
-
92
- - **show_item**: 6,000 (60.0%)
93
- - **show_list**: 3,500 (35.0%)
94
- - **go_back**: 500 (5.0%)
95
-
96
- ### State Distribution
97
-
98
- - **SEARCH_RESULTS**: 8,024 (80.2%)
99
- - **PRODUCT_DETAIL**: 1,976 (19.8%)
100
-
101
- ## Query Rewriting Patterns
102
-
103
- The dataset covers 7 distinct patterns of query rewriting:
104
-
105
- ### 1. Pronoun Resolution (~30%)
106
-
107
- Resolves pronouns ("that", "it", "one") to specific product names using context.
108
 
109
- **Examples:**
110
- - `"show me that one"` → `"show me details of iPhone 15 Pro from Smartphones search"`
111
- - `"tell me about it"` → `"show me details of Samsung Galaxy S24 from Smartphones search"`
112
 
113
- ### 2. Ellipsis (~20%)
 
 
114
 
115
- Expands incomplete queries by adding missing information from context.
116
 
117
- **Examples:**
118
- - `"find cheaper"` → `"find Smartphones cheaper than 50000"`
119
- - `"with camera"` `"find Smartphones with camera"`
 
 
120
 
121
- ### 3. Ordinals (~15%)
122
 
123
- Converts ordinal references ("first", "second") to specific product names.
 
 
 
 
124
 
125
- **Examples:**
126
- - `"show me first"` → `"show me details of iPhone 15 Pro from Smartphones search"`
127
- - `"details of second"` → `"show me details of Samsung Galaxy S24 from Smartphones search"`
128
 
129
- ### 4. Product References (~15%)
 
 
 
130
 
131
- Resolves partial product names to full product names.
132
 
133
- **Examples:**
134
- - `"tell me about iPhone"` → `"show me details of iPhone 15 Pro from Smartphones search"`
135
- - `"show Samsung"` → `"show me details of Samsung Galaxy S24 from Smartphones search"`
 
 
 
 
 
 
136
 
137
- ### 5. Price/Category (~10%)
138
 
139
- Adds missing category or price information to queries.
140
-
141
- **Examples:**
142
- - `"show me under 50000"` → `"show me Smartphones under 50000"`
143
- - `"find below 30000"` → `"show me Smartphones below 30000"`
144
-
145
- ### 6. Navigation (~5%)
146
-
147
- Converts navigation commands to explicit queries.
148
-
149
- **Examples:**
150
- - `"go back"` → `"return to Smartphones search results"`
151
- - `"show list again"` → `"return to Smartphones search results"`
152
-
153
- ### 7. Refinements (~5%)
154
-
155
- Expands refinement queries with category information.
156
-
157
- **Examples:**
158
- - `"with better camera"` → `"find Smartphones with better camera"`
159
- - `"higher rating"` → `"find Smartphones higher rating"`
160
-
161
- ## Use Cases
162
-
163
- ### 1. Fine-tuning Query Rewriting Models
164
-
165
- Train LLMs to rewrite ambiguous queries using conversation context:
166
 
167
  ```python
168
  from datasets import load_dataset
169
 
170
- dataset = load_dataset("mudasir13cs/E-commerce-query-rewriting-dataset", private=True)
171
-
172
- # Format for training
173
- for example in dataset["train"]:
174
- input_text = f"Context: {example['context']}\nQuery: {example['original_query']}"
175
- target_text = example["rewritten_query"]
176
- # Train model...
177
- ```
178
-
179
- ### 2. Intent Classification
180
 
181
- Train models to classify user intent from queries and context:
182
-
183
- ```python
184
- # Use intent field for classification
185
- for example in dataset["train"]:
186
- input_text = f"Context: {example['context']}\nQuery: {example['original_query']}"
187
- intent = example["intent"] # search, show_detail, go_back, close
188
- # Train classifier...
189
- ```
190
-
191
- ### 3. Conversational Search Systems
192
-
193
- Build e-commerce conversational agents that understand context:
194
-
195
- ```python
196
- # Use in production systems
197
- def rewrite_query(query, context):
198
- # Use fine-tuned model to rewrite query
199
- rewritten = model.predict(query, context)
200
- return rewritten
201
- ```
202
-
203
- ### 4. Research and Evaluation
204
-
205
- - Benchmark query rewriting approaches
206
- - Evaluate context-aware search systems
207
- - Study ambiguity resolution in e-commerce
208
- - Analyze conversational patterns
209
-
210
- ## Loading the Dataset
211
-
212
- ### Using HuggingFace Datasets
213
-
214
- ```python
215
- from datasets import load_dataset
216
-
217
- # Load the dataset (requires authentication for private repos)
218
- dataset = load_dataset(
219
- "mudasir13cs/E-commerce-query-rewriting-dataset",
220
- private=True
221
- )
222
-
223
- # Access splits
224
  train_data = dataset["train"]
225
- val_data = dataset["validation"]
226
- test_data = dataset["test"]
227
  ```
228
 
229
- ### Direct JSON Loading
230
 
231
  ```python
232
  import json
233
 
234
- # Load from local file
235
  with open("dataset_complete.json", "r") as f:
236
  data = json.load(f)
237
  ```
238
 
239
- ## Dataset Format for Training
240
 
241
- ### Query Rewriter Format
242
 
243
  ```json
244
  {
@@ -248,7 +172,7 @@ with open("dataset_complete.json", "r") as f:
248
  }
249
  ```
250
 
251
- ### Intent Classifier Format
252
 
253
  ```json
254
  {
@@ -258,60 +182,68 @@ with open("dataset_complete.json", "r") as f:
258
  }
259
  ```
260
 
261
- ## Quality Assurance
 
 
 
 
 
 
 
 
 
 
 
 
 
262
 
263
- All examples are validated for:
264
 
265
- - Has original query
266
- - Has rewritten query
267
- - Has complete context
268
- - Rewritten query is longer/more specific
269
- - Has valid intent and command
270
- - ✅ Product count is within valid range (1-10)
271
 
272
- ## Citation
273
 
274
  If you use this dataset in your research, please cite:
275
 
276
  ```bibtex
277
- @dataset{ecommerce_query_rewriting_2025,
278
  title={E-Commerce Query Rewriting Dataset for Context-Aware Conversational Search},
279
  author={Syed Mudasir},
280
- year={2025},
281
- url={https://huggingface.co/datasets/mudasir13cs/E-commerce-query-rewriting-dataset},
282
  note={Dataset for fine-tuning context-aware query rewriting models in e-commerce}
283
  }
284
  ```
285
 
286
- ## License
287
-
288
- This dataset is released under the **Creative Commons Attribution-ShareAlike 4.0 International License (CC BY-SA 4.0)**.
289
 
290
- ### Terms of Use
291
 
292
- - ✅ **Commercial use** allowed
293
- - ✅ **Modification** allowed
294
- - ✅ **Distribution** allowed
295
- - ✅ **Private use** allowed
296
- - ⚠️ **Attribution** required
297
- - ⚠️ **ShareAlike** - derivatives must use same license
298
 
299
- ## Acknowledgments
300
 
301
- - **Product Data Sources**: Flipkart, Amazon, MyOnlineShop
302
- - **Open Source Community** for tools and frameworks
303
- - **HuggingFace** for dataset hosting infrastructure
304
 
305
- ## Contact
306
 
307
- For questions, issues, or contributions:
308
 
309
- - **HuggingFace**: [mudasir13cs](https://huggingface.co/mudasir13cs)
310
- - **GitHub**: [mudasir13cs](https://github.com/mudasir13cs)
 
311
 
312
  ---
313
 
314
- **Author**: Syed Mudasir
315
- **HuggingFace**: [mudasir13cs](https://huggingface.co/mudasir13cs)
316
- **Last Updated**: November 2025
317
- **Version**: 1.0
 
1
  ---
2
  license: cc-by-sa-4.0
3
+ language:
4
+ - en
5
  task_categories:
6
  - text-generation
7
  - question-answering
 
10
  - query-rewriting
11
  - context-aware
12
  - conversational-search
13
+ - conversational-ai
14
  - nlp
15
  - llm
16
  - fine-tuning
17
+ - intent-classification
18
+ - dialogue-systems
19
+ - retail
20
+ - search
21
+ pretty_name: E-Commerce Query Rewriting Dataset
22
  size_categories:
23
+ - 1K<n<10K
24
  ---
25
 
26
+ # [#e-commerce-query-rewriting-dataset](#e-commerce-query-rewriting-dataset) E-Commerce Query Rewriting Dataset
27
 
28
+ **Hub:** [`mudasir13cs/ecommerce-query-rewriting`](https://huggingface.co/datasets/mudasir13cs/ecommerce-query-rewriting)
29
 
30
+ A dataset of **10,000 examples** pairing ambiguous, context-dependent user queries with their fully resolved, context-aware rewrites for e-commerce product search. Built for fine-tuning LLMs to resolve pronouns, ellipsis, ordinals, and other conversational shortcuts using prior search context — the kind of resolution real shopping assistants need to handle turns like *"show me that one"* or *"the cheaper one"*.
31
 
32
+ - [Dataset summary](#dataset-summary)
33
+ - [Dataset structure](#dataset-structure)
34
+ - [Dataset statistics](#dataset-statistics)
35
+ - [Query rewriting patterns](#query-rewriting-patterns)
36
+ - [Loading the dataset](#loading-the-dataset)
37
+ - [Training formats](#training-formats)
38
+ - [Use cases](#use-cases)
39
+ - [Quality assurance](#quality-assurance)
40
+ - [Citation](#citation)
41
+ - [License](#license)
42
+ - [Acknowledgments](#acknowledgments)
43
+ - [Author / contact](#author--contact)
44
 
45
+ ## [#dataset-summary](#dataset-summary) Dataset summary
46
 
47
+ Conversational commerce agents constantly receive queries that only make sense given prior turns — a pronoun ("it"), an ordinal ("the second one"), or a fragment ("with better camera"). This dataset provides supervised pairs of `(ambiguous query, conversation context) → (unambiguous rewritten query)` so models can learn to perform this resolution reliably before handing the query off to search or a product-detail lookup.
 
 
 
 
48
 
49
+ **Key features**
50
 
51
+ - Real-world-style e-commerce data spanning **Flipkart**, **Amazon**, and **MyOnlineShop** product catalogs
52
+ - Rich conversational context: previous search term, UI state, product list, and last executed command
53
+ - **7 distinct rewriting patterns** covering the most common ambiguity types in shopping dialogue
54
+ - Variable product-list sizes (1–10 items) for realistic search-result scenarios
55
+ - Ready-to-use instruction-tuning format for both **query rewriting** and **intent classification**
56
+
57
+ ## [#dataset-structure](#dataset-structure) Dataset structure
58
 
59
  Each example contains:
60
 
61
+ | Field | Type | Description |
62
+ |---|---|---|
63
+ | `original_query` | `string` | Ambiguous user query requiring context resolution |
64
+ | `context.last_search_query` | `string` | Previous search category or term |
65
+ | `context.current_state` | `string` | UI state `SEARCH_RESULTS`, `PRODUCT_DETAIL`, or `INITIAL` |
66
+ | `context.product_titles` | `list[string]` | Product names from the last search (1–10 items) |
67
+ | `context.last_command` | `string` | Previously executed system command |
68
+ | `context.product_count` | `int` | Number of products in context (1–10) |
69
+ | `rewritten_query` | `string` | Clear, unambiguous query with references resolved |
70
+ | `intent` | `string` | User intent — `search`, `show_detail`, `go_back`, `close` |
71
+ | `command` | `string` | System command — `show_list`, `show_item`, `go_back`, `close` |
72
 
73
+ **Example**
74
 
75
  ```json
76
  {
 
95
  }
96
  ```
97
 
98
+ ## [#dataset-statistics](#dataset-statistics) Dataset statistics
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
99
 
100
+ **Overall**
 
 
101
 
102
+ - Total examples: **10,000**
103
+ - Product sources: Flipkart, Amazon, MyOnlineShop
104
+ - Format: JSON, instruction–input–output ready
105
 
106
+ **Intent distribution**
107
 
108
+ | Intent | Count | % |
109
+ |---|---|---|
110
+ | `show_detail` | 6,000 | 60.0% |
111
+ | `search` | 3,500 | 35.0% |
112
+ | `navigation` | 500 | 5.0% |
113
 
114
+ **Command distribution**
115
 
116
+ | Command | Count | % |
117
+ |---|---|---|
118
+ | `show_item` | 6,000 | 60.0% |
119
+ | `show_list` | 3,500 | 35.0% |
120
+ | `go_back` | 500 | 5.0% |
121
 
122
+ **State distribution**
 
 
123
 
124
+ | State | Count | % |
125
+ |---|---|---|
126
+ | `SEARCH_RESULTS` | 8,024 | 80.2% |
127
+ | `PRODUCT_DETAIL` | 1,976 | 19.8% |
128
 
129
+ ## [#query-rewriting-patterns](#query-rewriting-patterns) Query rewriting patterns
130
 
131
+ | # | Pattern | Share | Example |
132
+ |---|---|---|---|
133
+ | 1 | **Pronoun resolution** | ~30% | `"show me that one"` → `"show me details of iPhone 15 Pro from Smartphones search"` |
134
+ | 2 | **Ellipsis** | ~20% | `"find cheaper"` → `"find Smartphones cheaper than 50000"` |
135
+ | 3 | **Ordinals** | ~15% | `"show me first"` → `"show me details of iPhone 15 Pro from Smartphones search"` |
136
+ | 4 | **Product references** | ~15% | `"tell me about iPhone"` → `"show me details of iPhone 15 Pro from Smartphones search"` |
137
+ | 5 | **Price / category** | ~10% | `"show me under 50000"` → `"show me Smartphones under 50000"` |
138
+ | 6 | **Navigation** | ~5% | `"go back"` → `"return to Smartphones search results"` |
139
+ | 7 | **Refinements** | ~5% | `"higher rating"` → `"find Smartphones higher rating"` |
140
 
141
+ ## [#loading-the-dataset](#loading-the-dataset) Loading the dataset
142
 
143
+ **Using 🤗 Datasets (recommended)**
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
144
 
145
  ```python
146
  from datasets import load_dataset
147
 
148
+ dataset = load_dataset("mudasir13cs/ecommerce-query-rewriting")
 
 
 
 
 
 
 
 
 
149
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
150
  train_data = dataset["train"]
151
+ print(train_data[0])
 
152
  ```
153
 
154
+ **Direct JSON loading**
155
 
156
  ```python
157
  import json
158
 
 
159
  with open("dataset_complete.json", "r") as f:
160
  data = json.load(f)
161
  ```
162
 
163
+ ## [#training-formats](#training-formats) Training formats
164
 
165
+ **Query rewriter**
166
 
167
  ```json
168
  {
 
172
  }
173
  ```
174
 
175
+ **Intent classifier**
176
 
177
  ```json
178
  {
 
182
  }
183
  ```
184
 
185
+ ## [#use-cases](#use-cases) Use cases
186
+
187
+ - **Fine-tuning query rewriting models** — train LLMs to resolve ambiguous queries with `(context, query) → rewritten_query` pairs
188
+ - **Intent classification** — train classifiers on the `intent` field for dialogue-state routing
189
+ - **Conversational search systems** — build production agents that maintain and resolve context across turns
190
+ - **Research & evaluation** — benchmark rewriting approaches, study ambiguity resolution, and analyze conversational search patterns
191
+
192
+ ```python
193
+ def rewrite_query(query, context):
194
+ # Use a fine-tuned model to resolve the query against context
195
+ return model.predict(query, context)
196
+ ```
197
+
198
+ ## [#quality-assurance](#quality-assurance) Quality assurance
199
 
200
+ Every example is validated for:
201
 
202
+ - Presence of both `original_query` and `rewritten_query`
203
+ - Complete, well-formed `context` object
204
+ - Rewritten query is strictly longer and more specific than the original
205
+ - Valid `intent` and `command` values
206
+ - `product_count` within the valid range (1–10)
 
207
 
208
+ ## [#citation](#citation) Citation
209
 
210
  If you use this dataset in your research, please cite:
211
 
212
  ```bibtex
213
+ @dataset{ecommerce_query_rewriting_2026,
214
  title={E-Commerce Query Rewriting Dataset for Context-Aware Conversational Search},
215
  author={Syed Mudasir},
216
+ year={2026},
217
+ url={https://huggingface.co/datasets/mudasir13cs/ecommerce-query-rewriting},
218
  note={Dataset for fine-tuning context-aware query rewriting models in e-commerce}
219
  }
220
  ```
221
 
222
+ ## [#license](#license) License
 
 
223
 
224
+ Released under **Creative Commons Attribution-ShareAlike 4.0 International (CC BY-SA 4.0)**.
225
 
226
+ - ✅ Commercial use allowed
227
+ - ✅ Modification allowed
228
+ - ✅ Distribution allowed
229
+ - ✅ Private use allowed
230
+ - ⚠️ Attribution required
231
+ - ⚠️ ShareAlike derivatives must use the same license
232
 
233
+ ## [#acknowledgments](#acknowledgments) Acknowledgments
234
 
235
+ - Product data sources: **Flipkart**, **Amazon**, **MyOnlineShop**
236
+ - The open-source ML community for tooling and frameworks
237
+ - **Hugging Face** for dataset hosting infrastructure
238
 
239
+ ## [#author--contact](#author--contact) Author / contact
240
 
241
+ **Mudasir** — multimodal AI, VLM fine-tuning, retrieval/RAG research, and applied NLP engineering; **MS AI Convergence**, [Soongsil University](https://ssu.ac.kr/), Seoul. More projects and publications: **[mudasir13cs.github.io](https://mudasir13cs.github.io/)**
242
 
243
+ - **Hugging Face:** [@mudasir13cs](https://huggingface.co/mudasir13cs)
244
+ - **GitHub:** [@mudasir13cs](https://github.com/mudasir13cs)
245
+ - **Email:** mudasir13cs@gmail.com
246
 
247
  ---
248
 
249
+ **Version:** 1.0 · **Last updated:** July 2026