[update]add data
Browse files- README.md +1 -0
- chinese_chitchat.py +1 -0
- data/weibo.jsonl +3 -0
- examples/process/process_weibo.py +69 -0
README.md
CHANGED
@@ -19,6 +19,7 @@ size_categories:
|
|
19 |
| ptt | [PTT中文語料](https://github.com/zake7749/Gossiping-Chinese-Corpus) | 77W | 开源项目, 台湾PTT论坛八卦版, 繁体, 语料较生活化, 有噪音 | [阿里云盘](https://www.aliyundrive.com/s/qXBdAYtz5j5); 提取码: 81ao |
|
20 |
| subtitle | [电视剧对白语料](https://github.com/aceimnorstuvwxz/dgk_lost_conv) | 274W | 开源项目, 来自爬取的电影和美剧的字幕, 有一些噪音, 对白不一定是严谨的对话, 原本是多轮 (平均5.3轮) | [阿里云盘](https://www.aliyundrive.com/s/qXBdAYtz5j5); 提取码: 81ao |
|
21 |
| tieba | [贴吧论坛回帖语料](https://pan.baidu.com/s/1mUknfwy1nhSM7XzH8xi7gQ); 密码:i4si | 232W | 多轮, 有噪音 | [阿里云盘](https://www.aliyundrive.com/s/qXBdAYtz5j5); 提取码: 81ao |
|
|
|
22 |
| xiaohuangji | [小黄鸡语料](https://github.com/candlewill/Dialog_Corpus) | 45W | 原人人网项目语料, 有一些不雅对话, 少量噪音 | [阿里云盘](https://www.aliyundrive.com/s/qXBdAYtz5j5); 提取码: 81ao |
|
23 |
|
24 |
|
|
|
19 |
| ptt | [PTT中文語料](https://github.com/zake7749/Gossiping-Chinese-Corpus) | 77W | 开源项目, 台湾PTT论坛八卦版, 繁体, 语料较生活化, 有噪音 | [阿里云盘](https://www.aliyundrive.com/s/qXBdAYtz5j5); 提取码: 81ao |
|
20 |
| subtitle | [电视剧对白语料](https://github.com/aceimnorstuvwxz/dgk_lost_conv) | 274W | 开源项目, 来自爬取的电影和美剧的字幕, 有一些噪音, 对白不一定是严谨的对话, 原本是多轮 (平均5.3轮) | [阿里云盘](https://www.aliyundrive.com/s/qXBdAYtz5j5); 提取码: 81ao |
|
21 |
| tieba | [贴吧论坛回帖语料](https://pan.baidu.com/s/1mUknfwy1nhSM7XzH8xi7gQ); 密码:i4si | 232W | 多轮, 有噪音 | [阿里云盘](https://www.aliyundrive.com/s/qXBdAYtz5j5); 提取码: 81ao |
|
22 |
+
| weibo | [阿里云盘](https://www.aliyundrive.com/s/qXBdAYtz5j5); 提取码: 81ao | 443W | 来自华为的paper | |
|
23 |
| xiaohuangji | [小黄鸡语料](https://github.com/candlewill/Dialog_Corpus) | 45W | 原人人网项目语料, 有一些不雅对话, 少量噪音 | [阿里云盘](https://www.aliyundrive.com/s/qXBdAYtz5j5); 提取码: 81ao |
|
24 |
|
25 |
|
chinese_chitchat.py
CHANGED
@@ -13,6 +13,7 @@ _URLS = {
|
|
13 |
"douban": "data/douban.jsonl",
|
14 |
"ptt": "data/ptt.jsonl",
|
15 |
"subtitle": "data/subtitle.jsonl",
|
|
|
16 |
|
17 |
}
|
18 |
|
|
|
13 |
"douban": "data/douban.jsonl",
|
14 |
"ptt": "data/ptt.jsonl",
|
15 |
"subtitle": "data/subtitle.jsonl",
|
16 |
+
"weibo": "data/weibo.jsonl",
|
17 |
|
18 |
}
|
19 |
|
data/weibo.jsonl
ADDED
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
1 |
+
version https://git-lfs.github.com/spec/v1
|
2 |
+
oid sha256:e10b46ea17143831980e953ee6be35aaab540895be2486b690f876a3f9d1298e
|
3 |
+
size 1051008080
|
examples/process/process_weibo.py
ADDED
@@ -0,0 +1,69 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
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_dir",
|
18 |
+
default=(project_path / "original_data/weibo-400w").as_posix(),
|
19 |
+
type=str
|
20 |
+
)
|
21 |
+
parser.add_argument(
|
22 |
+
"--output_file",
|
23 |
+
default=(project_path / "data/weibo.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 |
+
data_dir = Path(args.data_dir)
|
35 |
+
|
36 |
+
questions = list()
|
37 |
+
with open(data_dir / "stc_weibo_train_post", "r", encoding="utf-8") as f:
|
38 |
+
for row in f:
|
39 |
+
row = str(row).strip()
|
40 |
+
row = "".join(row.split())
|
41 |
+
questions.append(row)
|
42 |
+
|
43 |
+
answers = list()
|
44 |
+
with open(data_dir / "stc_weibo_train_response.part", "r", encoding="utf-8") as f:
|
45 |
+
for row in f:
|
46 |
+
row = str(row).strip()
|
47 |
+
row = "".join(row.split())
|
48 |
+
answers.append(row)
|
49 |
+
|
50 |
+
if len(questions) != len(answers):
|
51 |
+
raise AssertionError
|
52 |
+
|
53 |
+
with open(args.output_file, "w", encoding="utf-8") as f:
|
54 |
+
for question, answer in tqdm(zip(questions, answers)):
|
55 |
+
row = {
|
56 |
+
"conversation": [
|
57 |
+
{"role": "human", "message": question},
|
58 |
+
{"role": "assistant", "message": answer},
|
59 |
+
],
|
60 |
+
"category": None,
|
61 |
+
"data_source": "weibo",
|
62 |
+
}
|
63 |
+
row = json.dumps(row, ensure_ascii=False)
|
64 |
+
f.write("{}\n".format(row))
|
65 |
+
return
|
66 |
+
|
67 |
+
|
68 |
+
if __name__ == '__main__':
|
69 |
+
main()
|