liwu-MNBVC / meta.py
orz99's picture
Duplicate from liwu/MNBVC
bef5be5
# This dict is all that matters in this file
# Each key in this dict corresponds to a sub-dataset
# Each key corresponds to a dict, which specify the config info for this sub-dataset
# Something like:
# {
# "law_judgement": {
# "files": [...],
# "feature_type": "TEXT_CORPUS_LEGACY",
# "description": "Texts from open law suits",
# },
# ...
# }
MNBVC_META = {}
base_url = 'https://huggingface.co/datasets/liwu/MNBVC/resolve/main'
def _flatten_list(input):
res = []
for i in input:
if type(i) == list:
res += _flatten_list(i)
else:
res.append(i)
return res
# =============================
# law_judgement
MNBVC_META['law_judgement'] = {}
MNBVC_META['law_judgement']['files'] = [
[f'{base_url}/law/judgement/{folder}/{i}.jsonl.gz' for i in range(1, count+1)]
for folder, count in [
('20230134', 49),
('20230135', 44),
('20230136', 44),
('20230137', 49),
('20230138', 41),
('20230139', 46),
('20230140', 46),
('20230141', 50),
]
]
MNBVC_META['law_judgement']['files'] = _flatten_list(MNBVC_META['law_judgement']['files'])
MNBVC_META['law_judgement']['feature_type'] = "TEXT_CORPUS_LEGACY"
MNBVC_META['law_judgement']['description'] = "Texts from open law suits"
_CONFIG2FORMAT = {
"law_judgement": "TEXT_CORPUS_LEGACY",
"gov_xuexiqiangguo": "TEXT_CORPUS",
"gov_report": "TEXT_CORPUS_LEGACY",
"co_ann_report": "TEXT_CORPUS_LEGACY",
"code_metadata": "TEXT_CORPUS_LEGACY",
}
# =============================
# gov_xuexiqiangguo
MNBVC_META['gov_xuexiqiangguo'] = {}
MNBVC_META['gov_xuexiqiangguo']['files'] = ['https://huggingface.co/datasets/liwu/MNBVC/resolve/main/gov/20230172/XueXiQiangGuo.jsonl.gz']
MNBVC_META['gov_xuexiqiangguo']['feature_type'] = "TEXT_CORPUS"
MNBVC_META['gov_xuexiqiangguo']['description'] = "Texts from government files (XueXiQiangGuo)"
# =============================
# gov_report
MNBVC_META['gov_report'] = {}
MNBVC_META['gov_report']['files'] = ['https://huggingface.co/datasets/liwu/MNBVC/resolve/main/gov/20230172/GovReport.jsonl.gz']
MNBVC_META['gov_report']['feature_type'] = "TEXT_CORPUS_LEGACY"
MNBVC_META['gov_report']['description'] = "Texts from government files (Gov Report)"
# =============================
# co_ann_report
MNBVC_META['co_ann_report'] = {}
MNBVC_META['co_ann_report']['files'] = [
[f'{base_url}/co_ann_report/{folder}/{i}.jsonl.gz' for i in range(count)]
for folder, count in [
('20230125', 49)
]
]
MNBVC_META['co_ann_report']['files'] = _flatten_list(MNBVC_META['co_ann_report']['files'])
MNBVC_META['co_ann_report']['feature_type'] = "TEXT_CORPUS_LEGACY"
MNBVC_META['co_ann_report']['description'] = "Texts from company annual reports"
# =============================
# code_metadata
MNBVC_META['code_metadata'] = {}
MNBVC_META['code_metadata']['files'] = [
[f'{base_url}/code/metadata/{folder}/{(start+i)*1000000}-{(start+i+1)*1000000}.jsonl.gz' for i in range(start, start+count)]
for folder, start, count in [
('20230301', 0, 10),
('20230302', 10, 10),
('20230303', 20, 10),
('20230304', 30, 10),
('20230305', 40, 10),
('20230306', 50, 10),
('20230307', 60, 10),
('20230308', 70, 10),
('20230309', 80, 10),
('20230310', 90, 10),
('20230311', 100, 10),
('20230312', 110, 10),
('20230313', 120, 10),
('20230314', 130, 10),
('20230315', 140, 10),
('20230316', 150, 10),
('20230317', 160, 10),
('20230318', 170, 10),
('20230319', 180, 10),
('20230320', 190, 10),
]
]
MNBVC_META['code_metadata']['files'] = _flatten_list(MNBVC_META['code_metadata']['files'])
MNBVC_META['code_metadata']['feature_type'] = "TEXT_CORPUS_LEGACY"
MNBVC_META['code_metadata']['description'] = "Meta data for the code corpus"
# =============================
# qa_zhihu
MNBVC_META['qa_zhihu'] = {}
MNBVC_META['qa_zhihu']['files'] = [
[f'{base_url}/qa/{folder}/zhihu/{i}.jsonl.gz' for i in range(count)]
for folder, count in [('20230196', 5)]
]
MNBVC_META['qa_zhihu']['files'] = _flatten_list(MNBVC_META['qa_zhihu']['files'])
MNBVC_META['qa_zhihu']['feature_type'] = "QA_CORPUS"
MNBVC_META['qa_zhihu']['description'] = "QA data from zhihu"
# =============================
# qa_wikihow
MNBVC_META['qa_wikihow'] = {}
MNBVC_META['qa_wikihow']['files'] = [
[f'{base_url}/qa/{folder}/wikihow/wikihow_en.{i}.jsonl.gz' for i in range(count)]
for folder, count in [('20230196', 4)]
]
MNBVC_META['qa_wikihow']['files'] += [
[f'{base_url}/qa/{folder}/wikihow/wikihow_zh.{i}.jsonl.gz' for i in range(count)]
for folder, count in [('20230196', 1)]
]
MNBVC_META['qa_wikihow']['files'] = _flatten_list(MNBVC_META['qa_wikihow']['files'])
MNBVC_META['qa_wikihow']['feature_type'] = "QA_CORPUS"
MNBVC_META['qa_wikihow']['description'] = "QA data from wikihow (both in zh and en)"
# =============================
# qa_mfa
MNBVC_META['qa_mfa'] = {}
MNBVC_META['qa_mfa']['files'] = [
[f'{base_url}/qa/{folder}/mfa/{i}.jsonl.gz' for i in range(count)]
for folder, count in [('20230196', 1)]
]
MNBVC_META['qa_mfa']['files'] = _flatten_list(MNBVC_META['qa_mfa']['files'])
MNBVC_META['qa_mfa']['feature_type'] = "QA_CORPUS"
MNBVC_META['qa_mfa']['description'] = "QA data from Ministry of Foreign Affairs"
# =============================
# news_peoples_daily
MNBVC_META['news_peoples_daily'] = {}
MNBVC_META['news_peoples_daily']['files'] = [
[f'{base_url}/news/{folder}/{i}.jsonl.gz' for i in range(count)]
for folder, count in [('20230196', 12)]
]
MNBVC_META['news_peoples_daily']['files'] = _flatten_list(MNBVC_META['news_peoples_daily']['files'])
MNBVC_META['news_peoples_daily']['feature_type'] = "TEXT_CORPUS"
MNBVC_META['news_peoples_daily']['description'] = "News data from people's daily"
# =============================
# wikipedia
MNBVC_META['wikipedia'] = {}
MNBVC_META['wikipedia']['files'] = [
[f'{base_url}/wiki/{folder}/{i}.jsonl.gz' for i in range(count)]
for folder, count in [('20230197', 46)]
]
MNBVC_META['wikipedia']['files'] += [
[f'{base_url}/wiki/{folder}/{i}.jsonl.gz' for i in range(beg, end)]
for folder, beg, end in [('20230198', 46, 78)]
]
MNBVC_META['wikipedia']['files'] = _flatten_list(MNBVC_META['wikipedia']['files'])
MNBVC_META['wikipedia']['feature_type'] = "TEXT_CORPUS"
MNBVC_META['wikipedia']['description'] = "Texts from wikipedia"