File size: 7,933 Bytes
19ca48d
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
49b70e6
dd03664
 
e0fa384
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
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
---
license: cc0-1.0
language:
- en
- zh
- hi
- es
- fr
- ar
- bn
- pt
- ru
- ur
- id
- de
- ja
- pcm
- mr
- te
- ta
- tr
- vi
- ko
- fa
pretty_name: Unit Conversion (21 languages)
size_categories:
- 10K<n<100K
task_categories:
- question-answering
- token-classification
tags:
- units
- unit-conversion
- math
- multilingual
- synthetic
configs:
- config_name: units
  data_files: units.csv
- config_name: qa
  data_files:
  - split: train
    path: qa/train.csv
  - split: validation
    path: qa/validation.csv
  - split: test
    path: qa/test.csv
- config_name: ner
  data_files:
  - split: train
    path: ner/train.jsonl
  - split: validation
    path: ner/validation.jsonl
  - split: test
    path: ner/test.jsonl
---

# Unit Conversion (21 languages)

A three-part dataset about unit conversion:

1. **`units`**: a lookup table of 120 units with exact conversion factors to SI, offsets (temperature), names in 21 languages, aliases, and notes.
2. **`qa`**: 59,745 conversion questions in 21 languages, each with a numeric answer and a worked solution.
3. **`ner`**: 16,800 short texts in which quantities and units are annotated with character spans.

Every number is computed by code with exact rational arithmetic (`fractions.Fraction`) and rounded to 6 significant digits. No language model produced any answer. The generator is included (`build_dataset.py`, `langdata_names.py`, `langdata_templates.py`), so the whole dataset is reproducible (seed `20261105`).


## Loading

```python
from datasets import load_dataset
units = load_dataset("YOUR_HF_USERNAME/unit-conversion", "units")["train"]
qa    = load_dataset("YOUR_HF_USERNAME/unit-conversion", "qa")
ner   = load_dataset("YOUR_HF_USERNAME/unit-conversion", "ner")
```

## Languages

| code | language | QA rows | NER rows | my confidence in the text |
|---|---|---|---|---|
| `en` | English | 2,845 | 800 | high |
| `zh` | Chinese (Mandarin) | 2,845 | 800 | high |
| `hi` | Hindi | 2,845 | 800 | high |
| `es` | Spanish | 2,845 | 800 | high |
| `fr` | French | 2,845 | 800 | high |
| `ar` | Arabic | 2,845 | 800 | high |
| `bn` | Bengali | 2,845 | 800 | lower |
| `pt` | Portuguese | 2,845 | 800 | high |
| `ru` | Russian | 2,845 | 800 | high |
| `ur` | Urdu | 2,845 | 800 | lower |
| `id` | Indonesian | 2,845 | 800 | high |
| `de` | German | 2,845 | 800 | high |
| `ja` | Japanese | 2,845 | 800 | high |
| `pcm` | Nigerian Pidgin | 2,845 | 800 | lower |
| `mr` | Marathi | 2,845 | 800 | lower |
| `te` | Telugu | 2,845 | 800 | lower |
| `ta` | Tamil | 2,845 | 800 | lower |
| `tr` | Turkish | 2,845 | 800 | high |
| `vi` | Vietnamese | 2,845 | 800 | high |
| `ko` | Korean | 2,845 | 800 | high |
| `fa` | Persian | 2,845 | 800 | high |

One QA/NER row exists per language, not as translations of each other: values and templates are sampled independently, but the split is grouped by unit pair, so no pair is shared across splits in any language.

## 1. `units.csv`

SI value = `value × to_si_factor + to_si_offset`. Conversion between units A and B:
`(v × factor_A + offset_A − offset_B) / factor_B`.

| column | meaning |
|---|---|
| `unit_id` | stable identifier (used by the other parts) |
| `dimension` | length, mass, time, temperature, temperature_difference, area, volume, speed, pressure, energy, power, force, data |
| `name_en`, `name_en_plural`, `name_<lang>`, `symbol` | names (one column per language) and symbol |
| `to_si_factor`, `to_si_factor_exact`, `to_si_offset` | factor as float, as an exact fraction, and the offset |
| `si_unit` | the reference unit of the dimension (`B` for data) |
| `system` | SI, metric, imperial, imperial_us, us_customary, traditional, ... |
| `aliases` | `|`-separated spellings and abbreviations in several languages |
| `trap_group` | common confusion group, if any (see below) |
| `reliability` | `exact`, `conventional`, or `traditional_variable` |
| `source`, `notes` | provenance and remarks |

## 2. `qa/`

| column | meaning |
|---|---|
| `id`, `lang` (ISO code, 21 values), `task` | identifiers |
| `question` | the question text |
| `answer_text`, `answer_value`, `answer_unit` | answer as text, as a float (6 significant digits), and the target `unit_id` |
| `solution` | short worked solution in the question language |
| `units_involved`, `dimension` | units used and the dimension of the answer |
| `trap_tags` | traps present in the question (see below) |
| `digits` | `latin` or `native` (Persian, Arabic-Indic, Bengali or Devanagari digits) |

Tasks and counts:

| task | count |
|---|---|
| `convert` | 45381 |
| `fuel_economy` | 504 |
| `word_problem_distance` | 4620 |
| `word_problem_energy` | 4620 |
| `word_problem_volume` | 4620 |

Splits: train 47,684, validation 6,118, test 5,943.
**Splits are grouped by unit pair** (for example `mi->km`): a pair that appears in the test set never appears in train, in any language. For word problems the split is random. So the test set measures generalisation to unseen pairs, not memorisation.

## 3. `ner/`

Each row has `text` and `entities`, a list of `{start, end, text, value, unit_id, dimension, si_value}`. Offsets are Python character offsets. An entity spans the quantity and the unit together (for example `۵ کیلومتر`). Splits: train 13,418, validation 1,689, test 1,693.

## Traps covered (`trap_tags`)

* `us_vs_uk_volume`: US vs UK gallon, pint, fluid ounce.
* `abs_vs_delta_temp`: a temperature (20 °C → 68 °F) vs a temperature difference (20 °C → 36 °F).
* `ton_variants`: metric tonne, US short ton, UK long ton.
* `binary_vs_decimal`: GB vs GiB, MB vs MiB, ...
* `calorie_variants`: calorie vs kilocalorie.
* `foot_variants`, `hp_variants`, `mmhg_vs_torr`, `oz_variants`: international vs survey foot, mechanical vs metric horsepower, mmHg vs torr, avoirdupois vs troy ounce.
* `regional_traditional`: traditional units whose value changed by region and era.
* `reciprocal_scale`: fuel economy (mpg vs L/100 km), where the relation is not linear.
* `multi_step`: word problems that need several unit steps.

## Limitations (please read)

* **Traditional units are conventions.** Values such as the mesqal (4.608 g), sir (75 g), man (Tabriz, 2.97 kg), zar (1.04 m), farsang (6 km) and jarib (1000 m²) are common modern values; historical values differed by city and era. They are marked `traditional_variable`.
* **Text is templated and synthetic.** Questions come from a small set of templates per language, so linguistic variety is lower than in real user text. All names and templates were written with the help of an AI assistant and **need native-speaker review**. Confidence is highest for the large languages and lower for Bengali, Urdu, Marathi, Telugu, Tamil and Nigerian Pidgin (marked `lower` above).
* **Agreement and case.** In Spanish, French, Portuguese, German and Russian the questions write units as symbols after numbers (`5 km`) to avoid plural and case errors; the `units` table still has full names. Arabic phrasing is simplified.
* **Traditional Persian units outside Persian and Arabic** are written in Latin transliteration (`mesqal`, `sir`, `man`, `zar`, `farsang`, `jarib`).
* **Digits.** Native digits are used only for Persian, Arabic, Urdu, Bengali, Hindi and Marathi (`digits` column); Tamil and Telugu use Latin digits.
* Some English units that no language has a short everyday name for (e.g. `US survey foot`) use descriptive names; compound names (square, cubic, per) are built by rule and can sound stiff.
* Fuel economy is in `qa` only (not in `units`) because it is not a linear scale.
* Answers are rounded to 6 significant digits; compare with a tolerance.
* Values with a conventional definition (`mmHg`, `cal`, `BTU`, Julian year) follow the cited convention.

## License

CC0 1.0 (public domain dedication). Sources of constants: BIPM SI Brochure, NIST SP 811 and Handbook 44, IEC 80000-13.

[https://toolshed.click/](https://toolshed.click/)
---
license: cc0-1.0
---