Datasets:
Tasks:
Text Classification
Modalities:
Text
Formats:
parquet
Sub-tasks:
multi-class-classification
Languages:
Chinese
Size:
1K - 10K
License:
Rebuild from Dataverse Excel: correct 0-6 labels + ZH/EN names + Dataset Card (train/test only)
Browse files- CITATION.cff +1 -12
- LICENSE +2 -7
- README.md +24 -32
- VERSION +1 -1
- checksums.sha256 +11 -11
- data/test-00000-of-00001.parquet +2 -2
- data/train-00000-of-00001.parquet +2 -2
- dataset_infos.yaml +4 -4
- label_taxonomy.json +14 -13
- metadata.json +1 -4
- scripts/evaluate_cc_theme_clf.py +7 -12
CITATION.cff
CHANGED
|
@@ -1,21 +1,10 @@
|
|
| 1 |
cff-version: 1.2.0
|
| 2 |
message: Please cite the JOCH 2024 paper and the Dataverse dataset.
|
| 3 |
title: "Classical Chinese Poetry Theme Classification (PoetryMTEB)"
|
| 4 |
-
version: "1.0.
|
| 5 |
license: CC0-1.0
|
| 6 |
authors:
|
| 7 |
- family-names: Hou
|
| 8 |
given-names: Jingrui
|
| 9 |
- family-names: Zhang
|
| 10 |
given-names: Shitou
|
| 11 |
-
preferred-citation:
|
| 12 |
-
type: article
|
| 13 |
-
title: "Exploring Thematic Diversity in Classical Chinese Poetry: A Novel Dataset and a BERT-enhanced Ensemble Learning Approach"
|
| 14 |
-
authors:
|
| 15 |
-
- family-names: Hou
|
| 16 |
-
given-names: Jingrui
|
| 17 |
-
- family-names: Zhang
|
| 18 |
-
given-names: Shitou
|
| 19 |
-
year: 2024
|
| 20 |
-
journal: Journal on Computing and Cultural Heritage
|
| 21 |
-
doi: "10.1145/3685679"
|
|
|
|
| 1 |
cff-version: 1.2.0
|
| 2 |
message: Please cite the JOCH 2024 paper and the Dataverse dataset.
|
| 3 |
title: "Classical Chinese Poetry Theme Classification (PoetryMTEB)"
|
| 4 |
+
version: "1.0.1"
|
| 5 |
license: CC0-1.0
|
| 6 |
authors:
|
| 7 |
- family-names: Hou
|
| 8 |
given-names: Jingrui
|
| 9 |
- family-names: Zhang
|
| 10 |
given-names: Shitou
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
LICENSE
CHANGED
|
@@ -1,11 +1,6 @@
|
|
| 1 |
Creative Commons CC0 1.0 Universal
|
| 2 |
-
=================================
|
| 3 |
-
|
| 4 |
-
This PoetryMTEB packaging redistributes the Classical Chinese poetry thematic
|
| 5 |
-
classification dataset under CC0 1.0, matching the Harvard Dataverse release:
|
| 6 |
-
|
| 7 |
-
https://doi.org/10.7910/DVN/6QJ7RK
|
| 8 |
|
|
|
|
| 9 |
Legal code: https://creativecommons.org/publicdomain/zero/1.0/legalcode
|
| 10 |
|
| 11 |
-
Please cite Hou & Zhang (JOCH 2024) and the Dataverse deposit
|
|
|
|
| 1 |
Creative Commons CC0 1.0 Universal
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 2 |
|
| 3 |
+
Upstream: https://doi.org/10.7910/DVN/6QJ7RK
|
| 4 |
Legal code: https://creativecommons.org/publicdomain/zero/1.0/legalcode
|
| 5 |
|
| 6 |
+
Please cite Hou & Zhang (JOCH 2024) and the Dataverse deposit.
|
README.md
CHANGED
|
@@ -58,34 +58,34 @@ dataset_info:
|
|
| 58 |
|
| 59 |
Multi-class **theme classification** of **classical Chinese poetry** for PoetryMTEB embedding evaluation.
|
| 60 |
|
| 61 |
-
Upstream
|
| 62 |
|
| 63 |
## Dataset Card
|
| 64 |
|
| 65 |
| Item | Description |
|
| 66 |
|------|-------------|
|
| 67 |
-
| **Dataset version (PoetryMTEB)** | `1.0.
|
| 68 |
-
| **Source** | [Harvard Dataverse DVN/6QJ7RK](https://dataverse.harvard.edu/dataset.xhtml?persistentId=doi:10.7910/DVN/6QJ7RK) |
|
| 69 |
| **Paper** | Hou J, Zhang S. *Exploring Thematic Diversity in Classical Chinese Poetry…* *JOCH* 17(4), 2024 ([DOI](https://doi.org/10.1145/3685679)) |
|
| 70 |
| **Languages** | Classical Chinese / Chinese (`zh`) |
|
| 71 |
| **Unit** | Full poem text (`poem`) |
|
| 72 |
-
| **Labels** | Single-label **7** themes (`label` 0–6) |
|
| 73 |
| **Size** | train=2624; test=292; **total=2916** |
|
| 74 |
-
| **Splits** | **train / test only** (no validation)
|
| 75 |
| **License** | [CC0 1.0](https://creativecommons.org/publicdomain/zero/1.0/) |
|
| 76 |
-
| **Evaluation metrics** | Accuracy, macro/micro F1
|
| 77 |
|
| 78 |
## Label taxonomy (7)
|
| 79 |
|
| 80 |
| id | label_name (zh) | name_en | train | test | total |
|
| 81 |
|---:|-----------------|---------|------:|-----:|------:|
|
| 82 |
-
| 0 | `爱情婚姻` | Love and Marriage |
|
| 83 |
-
| 1 | `交友送别` | Friendship and Farewell |
|
| 84 |
-
| 2 | `羁旅思乡` | Journey and Homesickness |
|
| 85 |
-
| 3 | `边塞战争` | Frontier and War |
|
| 86 |
-
| 4 | `山水田园` | Landscape and Countryside |
|
| 87 |
-
| 5 | `咏史怀古` | History and Nostalgia |
|
| 88 |
-
| 6 | `托物言志` | Expressing emotions through objects |
|
| 89 |
|
| 90 |
| id | Description (EN) |
|
| 91 |
|---:|------------------|
|
|
@@ -97,26 +97,24 @@ Upstream dataset: [A thematic classification dataset for Classical Chinese poetr
|
|
| 97 |
| 5 | Historical events, figures, and cultural memory; nostalgia. |
|
| 98 |
| 6 | Thoughts and feelings conveyed via portrayal/symbolism of objects. |
|
| 99 |
|
| 100 |
-
Codebook: `label_taxonomy.json`.
|
| 101 |
-
**Note:** Upstream Excel uses codes **0–6**. An earlier Hub release used **1–7**; this packaging remaps to **0–6** to match the Dataverse README.
|
| 102 |
|
| 103 |
## Features
|
| 104 |
|
| 105 |
| Field | Type | Description |
|
| 106 |
|-------|------|-------------|
|
| 107 |
-
| `id` | string | Example id (`ccptc-{split}-
|
| 108 |
-
| `poem` | string | **Classification input**
|
| 109 |
| `label` | int64 | Theme id **0–6** |
|
| 110 |
| `label_name` | string | Chinese theme name |
|
| 111 |
| `label_name_en` | string | English theme name |
|
| 112 |
-
| `label_name_zh` | string | Chinese theme name
|
| 113 |
|
| 114 |
## Construction method
|
| 115 |
|
| 116 |
-
1.
|
| 117 |
-
2.
|
| 118 |
-
3.
|
| 119 |
-
4. Write parquet under `data/`, Dataset Card, `dataset_infos.yaml`, taxonomy, checksums, eval script.
|
| 120 |
|
| 121 |
## Supporting materials
|
| 122 |
|
|
@@ -138,10 +136,6 @@ print(ds["train"][0]["poem"][:80])
|
|
| 138 |
print(ds["train"][0]["label_name"], ds["train"][0]["label_name_en"], ds["train"][0]["label"])
|
| 139 |
```
|
| 140 |
|
| 141 |
-
## Intended use
|
| 142 |
-
|
| 143 |
-
PoetryMTEB / MTEB-style **multi-class classification** probing of classical Chinese poem embeddings (theme recognition).
|
| 144 |
-
|
| 145 |
## Citation
|
| 146 |
|
| 147 |
```bibtex
|
|
@@ -158,8 +152,6 @@ PoetryMTEB / MTEB-style **multi-class classification** probing of classical Chin
|
|
| 158 |
}
|
| 159 |
```
|
| 160 |
|
| 161 |
-
Dataset:
|
| 162 |
-
|
| 163 |
```bibtex
|
| 164 |
@data{hou2024classical_theme,
|
| 165 |
author = {Hou, Jingrui},
|
|
@@ -171,15 +163,15 @@ Dataset:
|
|
| 171 |
}
|
| 172 |
```
|
| 173 |
|
| 174 |
-
This Hub packaging: `PoetryMTEB/ClassicalChinesePoetryThemeClassification` (version 1.0.
|
| 175 |
|
| 176 |
## License
|
| 177 |
|
| 178 |
-
**CC0 1.0** (
|
| 179 |
|
| 180 |
---
|
| 181 |
|
| 182 |
# 古典汉语诗歌主题分类(中文说明)
|
| 183 |
|
| 184 |
-
7 类
|
| 185 |
-
|
|
|
|
| 58 |
|
| 59 |
Multi-class **theme classification** of **classical Chinese poetry** for PoetryMTEB embedding evaluation.
|
| 60 |
|
| 61 |
+
Upstream: [A thematic classification dataset for Classical Chinese poetry](https://dataverse.harvard.edu/dataset.xhtml?persistentId=doi:10.7910/DVN/6QJ7RK) (Hou, Harvard Dataverse, [DOI](https://doi.org/10.7910/DVN/6QJ7RK)), with Hou & Zhang, *JOCH* 2024 ([paper](https://doi.org/10.1145/3685679)). Nearly 3,000 annotated poems across **seven** themes (Chunqiu → Qing).
|
| 62 |
|
| 63 |
## Dataset Card
|
| 64 |
|
| 65 |
| Item | Description |
|
| 66 |
|------|-------------|
|
| 67 |
+
| **Dataset version (PoetryMTEB)** | `1.0.1` |
|
| 68 |
+
| **Source** | [Harvard Dataverse DVN/6QJ7RK](https://dataverse.harvard.edu/dataset.xhtml?persistentId=doi:10.7910/DVN/6QJ7RK) (`train.xlsx` / `test.xlsx`) |
|
| 69 |
| **Paper** | Hou J, Zhang S. *Exploring Thematic Diversity in Classical Chinese Poetry…* *JOCH* 17(4), 2024 ([DOI](https://doi.org/10.1145/3685679)) |
|
| 70 |
| **Languages** | Classical Chinese / Chinese (`zh`) |
|
| 71 |
| **Unit** | Full poem text (`poem`) |
|
| 72 |
+
| **Labels** | Single-label **7** themes (`label` **0–6**, matching Dataverse README) |
|
| 73 |
| **Size** | train=2624; test=292; **total=2916** |
|
| 74 |
+
| **Splits** | **train / test only** (no validation) |
|
| 75 |
| **License** | [CC0 1.0](https://creativecommons.org/publicdomain/zero/1.0/) |
|
| 76 |
+
| **Evaluation metrics** | Accuracy, macro/micro F1 |
|
| 77 |
|
| 78 |
## Label taxonomy (7)
|
| 79 |
|
| 80 |
| id | label_name (zh) | name_en | train | test | total |
|
| 81 |
|---:|-----------------|---------|------:|-----:|------:|
|
| 82 |
+
| 0 | `爱情婚姻` | Love and Marriage | 269 | 43 | 312 |
|
| 83 |
+
| 1 | `交友送别` | Friendship and Farewell | 621 | 74 | 695 |
|
| 84 |
+
| 2 | `羁旅思乡` | Journey and Homesickness | 318 | 35 | 353 |
|
| 85 |
+
| 3 | `边塞战争` | Frontier and War | 207 | 23 | 230 |
|
| 86 |
+
| 4 | `山水田园` | Landscape and Countryside | 337 | 31 | 368 |
|
| 87 |
+
| 5 | `咏史怀古` | History and Nostalgia | 354 | 33 | 387 |
|
| 88 |
+
| 6 | `托物言志` | Expressing emotions through objects | 518 | 53 | 571 |
|
| 89 |
|
| 90 |
| id | Description (EN) |
|
| 91 |
|---:|------------------|
|
|
|
|
| 97 |
| 5 | Historical events, figures, and cultural memory; nostalgia. |
|
| 98 |
| 6 | Thoughts and feelings conveyed via portrayal/symbolism of objects. |
|
| 99 |
|
| 100 |
+
Codebook: `label_taxonomy.json`.
|
|
|
|
| 101 |
|
| 102 |
## Features
|
| 103 |
|
| 104 |
| Field | Type | Description |
|
| 105 |
|-------|------|-------------|
|
| 106 |
+
| `id` | string | Example id (`ccptc-{split}-{row}`) |
|
| 107 |
+
| `poem` | string | **Classification input** |
|
| 108 |
| `label` | int64 | Theme id **0–6** |
|
| 109 |
| `label_name` | string | Chinese theme name |
|
| 110 |
| `label_name_en` | string | English theme name |
|
| 111 |
+
| `label_name_zh` | string | Chinese theme name |
|
| 112 |
|
| 113 |
## Construction method
|
| 114 |
|
| 115 |
+
1. Download upstream `train.xlsx` / `test.xlsx` from Dataverse.
|
| 116 |
+
2. Keep official **0–6** labels; attach ZH/EN names from the Dataverse README.
|
| 117 |
+
3. Write PoetryMTEB parquet + Dataset Card + supporting materials.
|
|
|
|
| 118 |
|
| 119 |
## Supporting materials
|
| 120 |
|
|
|
|
| 136 |
print(ds["train"][0]["label_name"], ds["train"][0]["label_name_en"], ds["train"][0]["label"])
|
| 137 |
```
|
| 138 |
|
|
|
|
|
|
|
|
|
|
|
|
|
| 139 |
## Citation
|
| 140 |
|
| 141 |
```bibtex
|
|
|
|
| 152 |
}
|
| 153 |
```
|
| 154 |
|
|
|
|
|
|
|
| 155 |
```bibtex
|
| 156 |
@data{hou2024classical_theme,
|
| 157 |
author = {Hou, Jingrui},
|
|
|
|
| 163 |
}
|
| 164 |
```
|
| 165 |
|
| 166 |
+
This Hub packaging: `PoetryMTEB/ClassicalChinesePoetryThemeClassification` (version 1.0.1)
|
| 167 |
|
| 168 |
## License
|
| 169 |
|
| 170 |
+
**CC0 1.0** ([Dataverse](https://dataverse.harvard.edu/dataset.xhtml?persistentId=doi:10.7910/DVN/6QJ7RK)).
|
| 171 |
|
| 172 |
---
|
| 173 |
|
| 174 |
# 古典汉语诗歌主题分类(中文说明)
|
| 175 |
|
| 176 |
+
7 类:爱情婚姻、交友送别、羁旅思乡、边塞战争、山水田园、咏史怀古、托物言志。
|
| 177 |
+
train=2624 / test=292(无 validation);标签 **0–6**。
|
VERSION
CHANGED
|
@@ -1 +1 @@
|
|
| 1 |
-
1.0.
|
|
|
|
| 1 |
+
1.0.1
|
checksums.sha256
CHANGED
|
@@ -1,16 +1,16 @@
|
|
| 1 |
0aa078488d7fd57d413356ae6268c42166d1c95a4f97fe254f553e6a853ced9b CITATION.bib
|
| 2 |
-
|
| 3 |
-
|
| 4 |
-
|
| 5 |
-
|
| 6 |
-
|
| 7 |
-
|
| 8 |
-
|
| 9 |
-
|
| 10 |
-
|
| 11 |
058fa4a169c9b0fed806beac7e85119e413115b14415b158199deb0e86904a19 splits/test_ids.json
|
| 12 |
2a62bd13efbc96faef06b16e19576ce7b001a441096340cd1f57efac63f300fa splits/test_ids.txt
|
| 13 |
00ca4af6088da7fdc664781c3265594d539148ecf020a2d7fba4419ad9e0dcdf splits/train_ids.json
|
| 14 |
26b878be47e06a87b88b93385746c8bbaa4642dff083289bd65aef5c1553b7e0 splits/train_ids.txt
|
| 15 |
-
|
| 16 |
-
|
|
|
|
| 1 |
0aa078488d7fd57d413356ae6268c42166d1c95a4f97fe254f553e6a853ced9b CITATION.bib
|
| 2 |
+
38c8bc2d73f610ba2ce89cd9dc96b81ff36f35c82a525e5c85ef49c8164a5b0c CITATION.cff
|
| 3 |
+
f9150ba1da9683c8a4ed5213cde284e3ac74efc93fb1778f76caec2c5dc91f12 data/test-00000-of-00001.parquet
|
| 4 |
+
f7884187fe7fc0130b172acd0e7fa8623605cbab1766e1d23ebbff54365ff885 data/train-00000-of-00001.parquet
|
| 5 |
+
3b9527cb6d1ed76727fa39663766a09f696ef9e3203dd19c85d656da58dd2bf1 dataset_infos.yaml
|
| 6 |
+
723397631d6658366a49ae9c94187811966a161a4af3ef2635fdef34220f5e36 label_taxonomy.json
|
| 7 |
+
02db42bf21e64abd24a1878dda96073493f37ce69953293fb7d372c50ff6b56e LICENSE
|
| 8 |
+
08e55dd55095f8ef50eb5affa3daa398acb9772bf0b658bd06ed87b181dad6a9 metadata.json
|
| 9 |
+
04d3a9dbedee187b7ee84afe281a471abb5311c0bccfb9211ba0ab9cac4a969e README.md
|
| 10 |
+
4182ac562a144f534d018d4819e2fcc767167a5cfc181d1975dc303d7055d2dc scripts/evaluate_cc_theme_clf.py
|
| 11 |
058fa4a169c9b0fed806beac7e85119e413115b14415b158199deb0e86904a19 splits/test_ids.json
|
| 12 |
2a62bd13efbc96faef06b16e19576ce7b001a441096340cd1f57efac63f300fa splits/test_ids.txt
|
| 13 |
00ca4af6088da7fdc664781c3265594d539148ecf020a2d7fba4419ad9e0dcdf splits/train_ids.json
|
| 14 |
26b878be47e06a87b88b93385746c8bbaa4642dff083289bd65aef5c1553b7e0 splits/train_ids.txt
|
| 15 |
+
44676680de82b3e508a13d818a16bb7b2e702e4d15722ea7841c67a484143a87 stats.json
|
| 16 |
+
f34306bb50e2d2ec59c788b9013c5ac682ef7f7f69345a3e957e38c0b6ba2fdd VERSION
|
data/test-00000-of-00001.parquet
CHANGED
|
@@ -1,3 +1,3 @@
|
|
| 1 |
version https://git-lfs.github.com/spec/v1
|
| 2 |
-
oid sha256:
|
| 3 |
-
size
|
|
|
|
| 1 |
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:f9150ba1da9683c8a4ed5213cde284e3ac74efc93fb1778f76caec2c5dc91f12
|
| 3 |
+
size 67641
|
data/train-00000-of-00001.parquet
CHANGED
|
@@ -1,3 +1,3 @@
|
|
| 1 |
version https://git-lfs.github.com/spec/v1
|
| 2 |
-
oid sha256:
|
| 3 |
-
size
|
|
|
|
| 1 |
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:f7884187fe7fc0130b172acd0e7fa8623605cbab1766e1d23ebbff54365ff885
|
| 3 |
+
size 652026
|
dataset_infos.yaml
CHANGED
|
@@ -9,8 +9,8 @@ configs:
|
|
| 9 |
dataset_info:
|
| 10 |
configs:
|
| 11 |
- config_name: default
|
| 12 |
-
dataset_size:
|
| 13 |
-
download_size:
|
| 14 |
features:
|
| 15 |
- dtype: string
|
| 16 |
name: id
|
|
@@ -26,8 +26,8 @@ dataset_info:
|
|
| 26 |
name: label_name_zh
|
| 27 |
splits:
|
| 28 |
- name: train
|
| 29 |
-
num_bytes:
|
| 30 |
num_examples: 2624
|
| 31 |
- name: test
|
| 32 |
-
num_bytes:
|
| 33 |
num_examples: 292
|
|
|
|
| 9 |
dataset_info:
|
| 10 |
configs:
|
| 11 |
- config_name: default
|
| 12 |
+
dataset_size: 719667
|
| 13 |
+
download_size: 719667
|
| 14 |
features:
|
| 15 |
- dtype: string
|
| 16 |
name: id
|
|
|
|
| 26 |
name: label_name_zh
|
| 27 |
splits:
|
| 28 |
- name: train
|
| 29 |
+
num_bytes: 652026
|
| 30 |
num_examples: 2624
|
| 31 |
- name: test
|
| 32 |
+
num_bytes: 67641
|
| 33 |
num_examples: 292
|
label_taxonomy.json
CHANGED
|
@@ -1,6 +1,5 @@
|
|
| 1 |
{
|
| 2 |
"n_classes": 7,
|
| 3 |
-
"id_scheme": "0-6 matching Dataverse README; Hub 1-7 remapped via label-1",
|
| 4 |
"labels": [
|
| 5 |
{
|
| 6 |
"id": 0,
|
|
@@ -54,20 +53,22 @@
|
|
| 54 |
],
|
| 55 |
"counts": {
|
| 56 |
"train": {
|
| 57 |
-
"托物言志":
|
| 58 |
-
"
|
| 59 |
-
"
|
| 60 |
-
"
|
| 61 |
-
"
|
| 62 |
-
"山水田园":
|
|
|
|
| 63 |
},
|
| 64 |
"test": {
|
| 65 |
-
"
|
| 66 |
-
"托物言志":
|
| 67 |
-
"
|
| 68 |
-
"咏史怀古":
|
| 69 |
-
"
|
| 70 |
-
"
|
|
|
|
| 71 |
}
|
| 72 |
},
|
| 73 |
"source": {
|
|
|
|
| 1 |
{
|
| 2 |
"n_classes": 7,
|
|
|
|
| 3 |
"labels": [
|
| 4 |
{
|
| 5 |
"id": 0,
|
|
|
|
| 53 |
],
|
| 54 |
"counts": {
|
| 55 |
"train": {
|
| 56 |
+
"托物言志": 518,
|
| 57 |
+
"交友送别": 621,
|
| 58 |
+
"羁旅思乡": 318,
|
| 59 |
+
"咏史怀古": 354,
|
| 60 |
+
"爱情婚姻": 269,
|
| 61 |
+
"山水田园": 337,
|
| 62 |
+
"边塞战争": 207
|
| 63 |
},
|
| 64 |
"test": {
|
| 65 |
+
"交友送别": 74,
|
| 66 |
+
"托物言志": 53,
|
| 67 |
+
"爱情婚姻": 43,
|
| 68 |
+
"咏史怀古": 33,
|
| 69 |
+
"山水田园": 31,
|
| 70 |
+
"羁旅思乡": 35,
|
| 71 |
+
"边塞战争": 23
|
| 72 |
}
|
| 73 |
},
|
| 74 |
"source": {
|
metadata.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
| 1 |
{
|
| 2 |
"name": "ClassicalChinesePoetryThemeClassification",
|
| 3 |
"poetrymteb_repo": "PoetryMTEB/ClassicalChinesePoetryThemeClassification",
|
| 4 |
-
"version": "1.0.
|
| 5 |
"task": "multi-class-classification",
|
| 6 |
"language": [
|
| 7 |
"zh"
|
|
@@ -13,9 +13,6 @@
|
|
| 13 |
"test": 292
|
| 14 |
},
|
| 15 |
"has_validation": false,
|
| 16 |
-
"unit": "poem",
|
| 17 |
-
"label_field": "label",
|
| 18 |
-
"text_field": "poem",
|
| 19 |
"source": {
|
| 20 |
"dataverse": "https://doi.org/10.7910/DVN/6QJ7RK",
|
| 21 |
"paper_doi": "10.1145/3685679"
|
|
|
|
| 1 |
{
|
| 2 |
"name": "ClassicalChinesePoetryThemeClassification",
|
| 3 |
"poetrymteb_repo": "PoetryMTEB/ClassicalChinesePoetryThemeClassification",
|
| 4 |
+
"version": "1.0.1",
|
| 5 |
"task": "multi-class-classification",
|
| 6 |
"language": [
|
| 7 |
"zh"
|
|
|
|
| 13 |
"test": 292
|
| 14 |
},
|
| 15 |
"has_validation": false,
|
|
|
|
|
|
|
|
|
|
| 16 |
"source": {
|
| 17 |
"dataverse": "https://doi.org/10.7910/DVN/6QJ7RK",
|
| 18 |
"paper_doi": "10.1145/3685679"
|
scripts/evaluate_cc_theme_clf.py
CHANGED
|
@@ -20,16 +20,8 @@ def main() -> None:
|
|
| 20 |
p.add_argument("--seed", type=int, default=42)
|
| 21 |
p.add_argument("--out-json", default="")
|
| 22 |
args = p.parse_args()
|
| 23 |
-
|
| 24 |
ds = load_dataset(args.repo)
|
| 25 |
train, test = ds["train"], ds["test"]
|
| 26 |
-
x_train, y_train = list(train["poem"]), list(train["label"])
|
| 27 |
-
x_test, y_test = list(test["poem"]), list(test["label"])
|
| 28 |
-
id2name = {}
|
| 29 |
-
for lab, name in zip(train["label"], train["label_name"]):
|
| 30 |
-
id2name[int(lab)] = name
|
| 31 |
-
target_names = [id2name[i] for i in sorted(id2name)]
|
| 32 |
-
|
| 33 |
clf = Pipeline(
|
| 34 |
[
|
| 35 |
("tfidf", TfidfVectorizer(analyzer="char", ngram_range=(1, 3), max_features=50000)),
|
|
@@ -41,14 +33,17 @@ def main() -> None:
|
|
| 41 |
),
|
| 42 |
]
|
| 43 |
)
|
| 44 |
-
clf.fit(
|
| 45 |
-
pred = clf.predict(
|
|
|
|
|
|
|
|
|
|
| 46 |
metrics = {
|
| 47 |
"accuracy": float(accuracy_score(y_test, pred)),
|
| 48 |
"macro_f1": float(f1_score(y_test, pred, average="macro")),
|
| 49 |
"micro_f1": float(f1_score(y_test, pred, average="micro")),
|
| 50 |
-
"n_train": len(
|
| 51 |
-
"n_test": len(
|
| 52 |
"label_counts_test": dict(Counter(int(x) for x in y_test)),
|
| 53 |
"report": classification_report(
|
| 54 |
y_test, pred, target_names=target_names, digits=4
|
|
|
|
| 20 |
p.add_argument("--seed", type=int, default=42)
|
| 21 |
p.add_argument("--out-json", default="")
|
| 22 |
args = p.parse_args()
|
|
|
|
| 23 |
ds = load_dataset(args.repo)
|
| 24 |
train, test = ds["train"], ds["test"]
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 25 |
clf = Pipeline(
|
| 26 |
[
|
| 27 |
("tfidf", TfidfVectorizer(analyzer="char", ngram_range=(1, 3), max_features=50000)),
|
|
|
|
| 33 |
),
|
| 34 |
]
|
| 35 |
)
|
| 36 |
+
clf.fit(list(train["poem"]), list(train["label"]))
|
| 37 |
+
pred = clf.predict(list(test["poem"]))
|
| 38 |
+
y_test = list(test["label"])
|
| 39 |
+
id2name = {int(a): b for a, b in zip(train["label"], train["label_name"])}
|
| 40 |
+
target_names = [id2name[i] for i in sorted(id2name)]
|
| 41 |
metrics = {
|
| 42 |
"accuracy": float(accuracy_score(y_test, pred)),
|
| 43 |
"macro_f1": float(f1_score(y_test, pred, average="macro")),
|
| 44 |
"micro_f1": float(f1_score(y_test, pred, average="micro")),
|
| 45 |
+
"n_train": len(train),
|
| 46 |
+
"n_test": len(test),
|
| 47 |
"label_counts_test": dict(Counter(int(x) for x in y_test)),
|
| 48 |
"report": classification_report(
|
| 49 |
y_test, pred, target_names=target_names, digits=4
|