Datasets:
Commit
·
35698f7
1
Parent(s):
1edb94c
Update parquet files
Browse files- README.md +0 -3
- chinese_metaphor_dataset.py +0 -85
- default/chinese_metaphor_dataset-train.parquet +3 -0
README.md
DELETED
@@ -1,3 +0,0 @@
|
|
1 |
-
---
|
2 |
-
license: cc-by-nc-sa-4.0
|
3 |
-
---
|
|
|
|
|
|
|
|
chinese_metaphor_dataset.py
DELETED
@@ -1,85 +0,0 @@
|
|
1 |
-
import datasets
|
2 |
-
# import pandas as pd
|
3 |
-
import json
|
4 |
-
|
5 |
-
_CITATION = """\
|
6 |
-
@inproceedings{li-etal-2022-cm,
|
7 |
-
title = "{CM}-Gen: A Neural Framework for {C}hinese Metaphor Generation with Explicit Context Modelling",
|
8 |
-
author = "Li, Yucheng and
|
9 |
-
Lin, Chenghua and
|
10 |
-
Guerin, Frank",
|
11 |
-
booktitle = "Proceedings of the 29th International Conference on Computational Linguistics",
|
12 |
-
month = oct,
|
13 |
-
year = "2022",
|
14 |
-
address = "Gyeongju, Republic of Korea",
|
15 |
-
publisher = "International Committee on Computational Linguistics",
|
16 |
-
url = "https://aclanthology.org/2022.coling-1.563",
|
17 |
-
pages = "6468--6479",
|
18 |
-
}
|
19 |
-
|
20 |
-
@misc{li-inlg-2022-nominal,
|
21 |
-
doi = {10.48550/ARXIV.2206.05195},
|
22 |
-
url = {https://arxiv.org/abs/2206.05195},
|
23 |
-
author = {Li, Yucheng and Lin, Chenghua and Geurin, Frank},
|
24 |
-
keywords = {Computation and Language (cs.CL), FOS: Computer and information sciences, FOS: Computer and information sciences},
|
25 |
-
title = {Nominal Metaphor Generation with Multitask Learning},
|
26 |
-
publisher = {arXiv},
|
27 |
-
year = {2022},
|
28 |
-
copyright = {arXiv.org perpetual, non-exclusive license}
|
29 |
-
}
|
30 |
-
"""
|
31 |
-
|
32 |
-
_DESCRIPTION = """\
|
33 |
-
Chinese Metaphor Corpus
|
34 |
-
|
35 |
-
The first Chinese metaphor corpus serving both metaphor identification and generation.
|
36 |
-
首个中文比喻数据集,可以用于中文比喻识别与中文比喻生成。
|
37 |
-
"""
|
38 |
-
|
39 |
-
_HOMEPAGE = "https://github.com/liyucheng09/Metaphor_Generator"
|
40 |
-
|
41 |
-
_URL = 'https://github.com/liyucheng09/Metaphor_Generator/raw/master/CMC/zh_CMC2.txt'
|
42 |
-
|
43 |
-
class CMC(datasets.GeneratorBasedBuilder):
|
44 |
-
|
45 |
-
BUILDER_CONFIG_CLASS=datasets.BuilderConfig
|
46 |
-
|
47 |
-
def _info(self):
|
48 |
-
|
49 |
-
feature = {
|
50 |
-
'sent': datasets.Value('string'),
|
51 |
-
'tenor': datasets.Value('string'),
|
52 |
-
'comparator': datasets.Value('string'),
|
53 |
-
'vehicle':datasets.Value('string'),
|
54 |
-
}
|
55 |
-
|
56 |
-
return datasets.DatasetInfo(
|
57 |
-
description=_DESCRIPTION,
|
58 |
-
features=datasets.Features(feature),
|
59 |
-
homepage=_HOMEPAGE,
|
60 |
-
citation=_CITATION
|
61 |
-
)
|
62 |
-
|
63 |
-
def _split_generators(self, dl_manager):
|
64 |
-
|
65 |
-
cmc_file = dl_manager.download(_URL)
|
66 |
-
|
67 |
-
return datasets.SplitGenerator(name=datasets.Split.TRAIN, gen_kwargs={'cmc_file': cmc_file}),
|
68 |
-
# return [
|
69 |
-
# datasets.SplitGenerator(name='hard', gen_kwargs={'filepath': self.config.data_path}),
|
70 |
-
# ]
|
71 |
-
|
72 |
-
def _generate_examples(self, cmc_file):
|
73 |
-
with open(cmc_file, encoding='utf-8') as f:
|
74 |
-
count = 0
|
75 |
-
for line in f:
|
76 |
-
if not line:
|
77 |
-
continue
|
78 |
-
data = json.loads(line)
|
79 |
-
yield count, {
|
80 |
-
'sent': data['sent'],
|
81 |
-
'tenor': data['tenor'],
|
82 |
-
'comparator': data['comparator'],
|
83 |
-
'vehicle': data['vehicle']
|
84 |
-
}
|
85 |
-
count+=1
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
default/chinese_metaphor_dataset-train.parquet
ADDED
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
1 |
+
version https://git-lfs.github.com/spec/v1
|
2 |
+
oid sha256:434981ef6b8f898518cacb5cd667931ae81057b19872ab9ddce6f93ca0088b6f
|
3 |
+
size 803090
|