qgyd2021 commited on
Commit
12b173a
1 Parent(s): beff547

[update]add chinese_mnli

Browse files
README.md CHANGED
@@ -21,6 +21,7 @@ size_categories:
21
  | BUSTM | 汉语 | [BUSTM](https://tianchi.aliyun.com/competition/entrance/531851/information); [BUSTM](https://github.com/xiaobu-coai/BUSTM) | 总样本数为:177173,其中,匹配样本个数为:54805,不匹配样本个数为:122368 | 小布助手对话短文本语义匹配比赛数据集 | [BUSTM](https://github.com/CLUEbenchmark/FewCLUE/tree/main/datasets/bustm) |
22
  | CHIP2019 | 汉语 | [CHIP2019](https://www.biendata.xyz/competition/chip2019/) | 2万 | 平安医疗科技疾病问答迁移学习比赛数据集 | |
23
  | COVID-19 | 汉语 | [COVID-19](https://tianchi.aliyun.com/competition/entrance/231776/information) | | 天池新冠疫情相似句对判定大赛 | [COVID-19](https://gitee.com/liangzongchang/COVID-19-sentence-pair/) |
 
24
 
25
 
26
  <details>
 
21
  | BUSTM | 汉语 | [BUSTM](https://tianchi.aliyun.com/competition/entrance/531851/information); [BUSTM](https://github.com/xiaobu-coai/BUSTM) | 总样本数为:177173,其中,匹配样本个数为:54805,不匹配样本个数为:122368 | 小布助手对话短文本语义匹配比赛数据集 | [BUSTM](https://github.com/CLUEbenchmark/FewCLUE/tree/main/datasets/bustm) |
22
  | CHIP2019 | 汉语 | [CHIP2019](https://www.biendata.xyz/competition/chip2019/) | 2万 | 平安医疗科技疾病问答迁移学习比赛数据集 | |
23
  | COVID-19 | 汉语 | [COVID-19](https://tianchi.aliyun.com/competition/entrance/231776/information) | | 天池新冠疫情相似句对判定大赛 | [COVID-19](https://gitee.com/liangzongchang/COVID-19-sentence-pair/) |
24
+ | Chinese-MNLI | 汉语 | [Chinese-MNLI](https://github.com/pluto-junzeng/CNSD) | TRAIN: 390K, VALID: 12K, TEST: 13K | 通过翻译加部分人工修正的方法,从英文原数据集生成(原数据是:蕴含,中性,冲突,的句子推理数据集,已转换为句子对。) | |
25
 
26
 
27
  <details>
data/chinese_mnli.jsonl ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:994e50bf6964ca0d6073b31fae10af95c2037ebbba434a864591b79c64757045
3
+ size 117184478
examples/preprocess/process_chinese_mnli.py ADDED
@@ -0,0 +1,82 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ #!/usr/bin/python3
2
+ # -*- coding: utf-8 -*-
3
+ import argparse
4
+ import json
5
+ import os
6
+ from pathlib import Path
7
+ import sys
8
+
9
+ pwd = os.path.abspath(os.path.dirname(__file__))
10
+ sys.path.append(os.path.join(pwd, '../../'))
11
+
12
+ from datasets import load_dataset
13
+ from tqdm import tqdm
14
+
15
+ from project_settings import project_path
16
+
17
+
18
+ def get_args():
19
+ parser = argparse.ArgumentParser()
20
+
21
+ parser.add_argument("--data_dir", default="./data/chinese_mnli", type=str)
22
+
23
+ parser.add_argument(
24
+ "--output_file",
25
+ default=(project_path / "data/chinese_mnli.jsonl"),
26
+ type=str
27
+ )
28
+
29
+ args = parser.parse_args()
30
+ return args
31
+
32
+
33
+ def main():
34
+ args = get_args()
35
+
36
+ data_dir = Path(args.data_dir)
37
+
38
+ with open(args.output_file, "w", encoding="utf-8") as fout:
39
+ for name in ["cnsd_multil_train.jsonl", "cnsd_multil_dev_matched.jsonl", "cnsd_multil_dev_mismatched.jsonl"]:
40
+ filename = data_dir / name
41
+ with open(filename, "r", encoding="utf-8") as fin:
42
+ for row in fin:
43
+ row = json.loads(row)
44
+ sentence1 = row["sentence1"]
45
+ sentence2 = row["sentence2"]
46
+ gold_label = row["gold_label"]
47
+
48
+ if name == "cnsd_multil_train.jsonl":
49
+ label = "1" if gold_label in ("entailment",) else "0"
50
+ flag = "train"
51
+ category = "cnsd_multil_train"
52
+ elif name == "cnsd_multil_dev_matched.jsonl":
53
+ label = "1" if gold_label in ("entailment",) else "0"
54
+ flag = "validation"
55
+ category = "cnsd_multil_dev_matched"
56
+ elif name == "cnsd_multil_dev_mismatched.jsonl":
57
+ label = "1" if gold_label in ("entailment",) else "0"
58
+ flag = "validation"
59
+ category = "cnsd_multil_dev_mismatched"
60
+ else:
61
+ raise AssertionError
62
+
63
+ if label not in ("0", "1", None):
64
+ raise AssertionError
65
+
66
+ row = {
67
+ "sentence1": sentence1,
68
+ "sentence2": sentence2,
69
+ "label": label,
70
+ "category": category,
71
+ "data_source": "Chinese-MNLI",
72
+ "split": flag
73
+ }
74
+
75
+ row = json.dumps(row, ensure_ascii=False)
76
+ fout.write("{}\n".format(row))
77
+
78
+ return
79
+
80
+
81
+ if __name__ == '__main__':
82
+ main()
sentence_pair.py CHANGED
@@ -12,6 +12,7 @@ _URLS = {
12
  "afqmc": "data/afqmc.jsonl",
13
  "bustm": "data/bustm.jsonl",
14
  "ccks2018_task3": "data/ccks2018_task3.jsonl",
 
15
  "chinese_sts": "data/chinese_sts.jsonl",
16
  "chip2019": "data/chip2019.jsonl",
17
  "covid_19": "data/covid_19.jsonl",
 
12
  "afqmc": "data/afqmc.jsonl",
13
  "bustm": "data/bustm.jsonl",
14
  "ccks2018_task3": "data/ccks2018_task3.jsonl",
15
+ "chinese_mnli": "data/chinese_mnli.jsonl",
16
  "chinese_sts": "data/chinese_sts.jsonl",
17
  "chip2019": "data/chip2019.jsonl",
18
  "covid_19": "data/covid_19.jsonl",