File size: 5,805 Bytes
79d64fc
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
---
license: cc-by-4.0
language:
  - en
  - zh
  - es
tags:
  - customer-support
  - multilingual
  - sentiment-analysis
  - conversational
pretty_name: Customer Support Cleaned
size_categories:
  - n<1K
---

# Customer Support Cleaned

## Dataset Summary

`customer-support-cleaned` is a small, curated multilingual customer-support
conversation dataset derived from a raw Excel workbook (`file1.xlsx`). Each
record contains a customer message (`user_message`), the support agent's reply
(`agent_response`), the conversation language (normalized to ISO 639-1), and a
sentiment label (`positive`, `neutral`, or `negative`).

The dataset is intended for tasks such as:
- Multilingual intent/sentiment classification for customer support,
- Evaluation of response-generation models,
- Demonstrations of data-cleaning and ETL pipelines.

The raw source contains intentionally noisy records (missing values, duplicate
IDs, inconsistent language codes, mixed-case sentiment labels, and duplicated
message pairs). All noise is removed by a reproducible cleaning pipeline (see
[Cleaning Decisions](#cleaning-decisions)), and the resulting artifact is
published as JSON Lines.

## Language Coverage

Language values are normalized to ISO 639-1 codes. Coverage in the released
version:

| Language      | ISO 639-1 code | Count |
|---------------|----------------|-------|
| English       | `en`           | 1     |
| Chinese       | `zh`           | 2     |
| Spanish       | `es`           | 1     |
| **Total**     |                | **4** |

## Data Fields

Each row in `dataset.jsonl` is a JSON object with the following fields (in
order):

| Field             | Type    | Description                                                              |
|-------------------|---------|--------------------------------------------------------------------------|
| `id`              | int     | Unique identifier of the conversation record.                            |
| `timestamp`       | string  | Timestamp of the customer message (`YYYY-MM-DD HH:MM:SS`).               |
| `user_message`    | string  | Customer's message (trimmed).                                            |
| `agent_response`  | string  | Agent's reply (trimmed).                                                 |
| `language`        | string  | ISO 639-1 language code of the conversation (e.g. `en`, `zh`, `es`).     |
| `sentiment`       | string  | Lowercase sentiment label: `positive`, `neutral`, or `negative`.         |
| `message_length`  | int     | Number of characters in `user_message`.                                  |

### Example

```json
{"id": 1, "timestamp": "2024-01-01 10:00:00", "user_message": "How do I reset my password?", "agent_response": "Please click the reset link on the login page.", "language": "en", "sentiment": "neutral", "message_length": 27}
```

## Cleaning Decisions

The raw workbook contained 8 records. The following deterministic pipeline
(`clean_dataset.py`) was applied, in order:

1. **Remove incomplete rows** – Rows where `user_message` or `agent_response`
   is missing (NaN) or blank (empty / whitespace-only) are dropped
   (2 rows removed).
2. **Trim whitespace** – Leading/trailing whitespace is removed from all text
   fields (`timestamp`, `user_message`, `agent_response`, `language`,
   `sentiment`).
3. **Deduplicate message pairs** – Rows with identical `user_message` and
   `agent_response` (after trimming) are dropped, keeping the first occurrence
   (2 rows removed).
4. **Enforce unique IDs** – Any remaining duplicate `id` values are resolved by
   keeping the first occurrence; the number of duplicates removed is recorded
   (0 rows removed after step 3).
5. **Normalize language** – Language values are mapped to ISO 639-1 codes
   (`English``en`, `Chinese``zh`, `Spanish``es`; already-normalized
   codes such as `zh` are kept as-is).
6. **Normalize sentiment** – Sentiment labels are lowercased (`Neutral``neutral`, `Positive ``positive`) and only rows with sentiment in
   {`positive`, `neutral`, `negative`} are retained (labels such as `angry`
   are dropped; 0 rows removed in this step because the `angry` row was
   already removed as incomplete).
7. **Add `message_length`** – An integer column is computed as the character
   count of the trimmed `user_message`.

**Result:** 8 raw records → **4 cleaned records**.

The full cleaning report (counts per step) is printed by `clean_dataset.py` and
is reproduced here for traceability:

```
original_rows: 8
rows_removed_missing_or_blank: 2
rows_removed_duplicate_message_pairs: 2
rows_removed_duplicate_ids: 0
rows_removed_invalid_sentiment: 0
final_rows: 4
```

## Reproducibility

To rebuild the dataset from the raw source:

```bash
pip install pandas openpyxl
python clean_dataset.py file1.xlsx dataset.jsonl
```

## Licensing and Usage Notes

- **License:** This dataset is released under the
  [CC BY 4.0](https://creativecommons.org/licenses/by/4.0/) license. You are
  free to share and adapt the material with appropriate attribution.
- **Usage:** Suitable for research and educational purposes, including
  multilingual NLP, sentiment analysis, and customer-support modeling. It is a
  small demo/quality-controlled dataset and should not be treated as a
  representative benchmark for production systems.
- **Privacy:** All messages are synthetic/sample content; no personal or
  identifying information is included.
- **Bias & limitations:** Due to the very small size (4 records), the dataset
  does not claim statistical representativeness. Language and sentiment
  distributions reflect only the cleaned sample.
- **Maintenance:** If the upstream raw data changes, re-run `clean_dataset.py`
  and re-upload `dataset.jsonl` to refresh this repository.