qgyd2021 commited on
Commit
30062f4
1 Parent(s): b8e4209

[update]add data

Browse files
README.md CHANGED
@@ -16,6 +16,7 @@ size_categories:
16
  | :--- | :---: | :---: | :---: | :---: |
17
  | ChatterBot | [ChatterBot](https://github.com/gunthercox/ChatterBot); [chatterbot-corpus](https://github.com/gunthercox/chatterbot-corpus) | 560 | 按类型分类,质量较高 | |
18
  | douban | [Douban Conversation Corpus](https://github.com/MarkWuNLP/MultiTurnResponseSelection) | 352W | 来自北航和微软的paper, 开源项目, 噪音相对较少,原本是多轮 (平均7.6轮) | |
 
19
 
20
 
21
  <details>
 
16
  | :--- | :---: | :---: | :---: | :---: |
17
  | ChatterBot | [ChatterBot](https://github.com/gunthercox/ChatterBot); [chatterbot-corpus](https://github.com/gunthercox/chatterbot-corpus) | 560 | 按类型分类,质量较高 | |
18
  | douban | [Douban Conversation Corpus](https://github.com/MarkWuNLP/MultiTurnResponseSelection) | 352W | 来自北航和微软的paper, 开源项目, 噪音相对较少,原本是多轮 (平均7.6轮) | |
19
+ | ptt | [PTT 中文語料](https://github.com/zake7749/Gossiping-Chinese-Corpus) | 77W | 开源项目, 台湾PTT论坛八卦版, 繁体, 语料较生活化, 有噪音 | |
20
 
21
 
22
  <details>
chinese_chitchat.py CHANGED
@@ -11,6 +11,7 @@ import datasets
11
  _URLS = {
12
  "chatterbot": "data/chatterbot.jsonl",
13
  "douban": "data/douban.jsonl",
 
14
 
15
  }
16
 
 
11
  _URLS = {
12
  "chatterbot": "data/chatterbot.jsonl",
13
  "douban": "data/douban.jsonl",
14
+ "ptt": "data/ptt.jsonl",
15
 
16
  }
17
 
data/ptt.jsonl ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:731c515b1e3726637bdb07171af9c2d935b3989eaadea2ce3cf1112b8eb6d461
3
+ size 161955508
examples/process/process_ptt.py ADDED
@@ -0,0 +1,62 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ #!/usr/bin/python3
2
+ # -*- coding: utf-8 -*-
3
+ import argparse
4
+ import json
5
+ from pathlib import Path
6
+
7
+ import pandas as pd
8
+ from tqdm import tqdm
9
+
10
+ from project_settings import project_path
11
+
12
+
13
+ def get_args():
14
+ parser = argparse.ArgumentParser()
15
+
16
+ parser.add_argument(
17
+ "--data_file",
18
+ default=(project_path / "original_data/Gossiping-Chinese-Corpus-master/data/Gossiping-QA-Dataset-2_0.csv").as_posix(),
19
+ type=str
20
+ )
21
+ parser.add_argument(
22
+ "--output_file",
23
+ default=(project_path / "data/ptt.jsonl"),
24
+ type=str
25
+ )
26
+
27
+ args = parser.parse_args()
28
+ return args
29
+
30
+
31
+ def main():
32
+ args = get_args()
33
+
34
+ df = pd.read_csv(args.data_file)
35
+
36
+ with open(args.output_file, "w", encoding="utf-8") as fout:
37
+ for i, row in df.iterrows():
38
+ question = row["question"]
39
+ answer = row["answer"]
40
+
41
+ row = {
42
+ "conversation": [
43
+ {
44
+ "role": "human",
45
+ "message": question,
46
+ },
47
+ {
48
+ "role": "assistant",
49
+ "message": answer,
50
+ },
51
+ ],
52
+ "category": None,
53
+ "data_source": "ptt",
54
+ }
55
+ row = json.dumps(row, ensure_ascii=False)
56
+ fout.write("{}\n".format(row))
57
+
58
+ return
59
+
60
+
61
+ if __name__ == '__main__':
62
+ main()
main.py ADDED
@@ -0,0 +1,16 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ #!/usr/bin/python3
2
+ # -*- coding: utf-8 -*-
3
+ from datasets import load_dataset
4
+
5
+ dataset = load_dataset(
6
+ "chinese_chitchat.py",
7
+ name="chatterbot",
8
+ split="train",
9
+ )
10
+
11
+ for sample in dataset:
12
+ print(sample)
13
+
14
+
15
+ if __name__ == '__main__':
16
+ pass