[update]add data
Browse files- README.md +9 -4
- chinese_chitchat.py +1 -0
- data/subtitle.jsonl +3 -0
- examples/process/process_subtitle.py +65 -0
README.md
CHANGED
|
@@ -14,18 +14,23 @@ size_categories:
|
|
| 14 |
|
| 15 |
| 数据 | 原始数据/项目地址 | 样本个数 | 语料描述 | 替代数据下载地址 |
|
| 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
|
|
|
|
|
|
|
|
|
|
| 20 |
|
| 21 |
|
| 22 |
<details>
|
| 23 |
<summary>参考的数据来源,展开查看</summary>
|
| 24 |
<pre>
|
| 25 |
<code>
|
| 26 |
-
|
| 27 |
https://github.com/codemayq/chinese_chatbot_corpus
|
| 28 |
|
|
|
|
|
|
|
| 29 |
</code>
|
| 30 |
</pre>
|
| 31 |
</details>
|
|
|
|
| 14 |
|
| 15 |
| 数据 | 原始数据/项目地址 | 样本个数 | 语料描述 | 替代数据下载地址 |
|
| 16 |
| :--- | :---: | :---: | :---: | :---: |
|
| 17 |
+
| ChatterBot | [ChatterBot](https://github.com/gunthercox/ChatterBot); [chatterbot-corpus](https://github.com/gunthercox/chatterbot-corpus) | 560 | 按类型分类,质量较高 | [阿里云盘](https://www.aliyundrive.com/s/qXBdAYtz5j5); 提取码: 81ao |
|
| 18 |
+
| douban | [Douban Conversation Corpus](https://github.com/MarkWuNLP/MultiTurnResponseSelection) | 352W | 来自北航和微软的paper, 开源项目, 噪音相对较少,原本是多轮 (平均7.6轮) | [阿里云盘](https://www.aliyundrive.com/s/qXBdAYtz5j5); 提取码: 81ao |
|
| 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 |
|
| 25 |
<details>
|
| 26 |
<summary>参考的数据来源,展开查看</summary>
|
| 27 |
<pre>
|
| 28 |
<code>
|
| 29 |
+
|
| 30 |
https://github.com/codemayq/chinese_chatbot_corpus
|
| 31 |
|
| 32 |
+
https://github.com/yangjianxin1/GPT2-chitchat
|
| 33 |
+
|
| 34 |
</code>
|
| 35 |
</pre>
|
| 36 |
</details>
|
chinese_chitchat.py
CHANGED
|
@@ -12,6 +12,7 @@ _URLS = {
|
|
| 12 |
"chatterbot": "data/chatterbot.jsonl",
|
| 13 |
"douban": "data/douban.jsonl",
|
| 14 |
"ptt": "data/ptt.jsonl",
|
|
|
|
| 15 |
|
| 16 |
}
|
| 17 |
|
|
|
|
| 12 |
"chatterbot": "data/chatterbot.jsonl",
|
| 13 |
"douban": "data/douban.jsonl",
|
| 14 |
"ptt": "data/ptt.jsonl",
|
| 15 |
+
"subtitle": "data/subtitle.jsonl",
|
| 16 |
|
| 17 |
}
|
| 18 |
|
data/subtitle.jsonl
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:1d13b4c351cbf840214e09c82c7eaeaafa7894b2cb08e90865e45f1ae62244af
|
| 3 |
+
size 31246730
|
examples/process/process_subtitle.py
ADDED
|
@@ -0,0 +1,65 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 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/dgk_lost_conv-master/results").as_posix(),
|
| 19 |
+
type=str
|
| 20 |
+
)
|
| 21 |
+
parser.add_argument(
|
| 22 |
+
"--output_file",
|
| 23 |
+
default=(project_path / "data/subtitle.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 |
+
with open(args.output_file, "w", encoding="utf-8") as fout:
|
| 36 |
+
for filename in tqdm(data_dir.glob("*.conv")):
|
| 37 |
+
with open(filename, "r", encoding="utf-8") as fin:
|
| 38 |
+
conversation = list()
|
| 39 |
+
for row in fin:
|
| 40 |
+
splits = str(row).strip().split(maxsplit=1)
|
| 41 |
+
|
| 42 |
+
if len(splits) == 1:
|
| 43 |
+
if len(conversation) == 0:
|
| 44 |
+
continue
|
| 45 |
+
row_ = {
|
| 46 |
+
"conversation": conversation,
|
| 47 |
+
"category": filename.stem,
|
| 48 |
+
"data_source": "subtitle",
|
| 49 |
+
}
|
| 50 |
+
row_ = json.dumps(row_, ensure_ascii=False)
|
| 51 |
+
fout.write("{}\n".format(row_))
|
| 52 |
+
conversation = list()
|
| 53 |
+
else:
|
| 54 |
+
message = splits[1]
|
| 55 |
+
|
| 56 |
+
conversation.append({
|
| 57 |
+
"role": "unknown",
|
| 58 |
+
"message": message,
|
| 59 |
+
})
|
| 60 |
+
|
| 61 |
+
return
|
| 62 |
+
|
| 63 |
+
|
| 64 |
+
if __name__ == '__main__':
|
| 65 |
+
main()
|