Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[feat] 希望convert_files脚本能够支持json和jsonl文件或任意文本文件的编码校验 #17

Open
voidf opened this issue Feb 27, 2024 · 1 comment

Comments

@voidf
Copy link

voidf commented Feb 27, 2024

关于txt后缀

实践中有很多一部分原始数据比如游戏文本采用yml或者json形式给出,而convert_files脚本在不修改源码的情况下很难从命令行参数去包含这些文件。命令行的输入-i给的一个目录,保证递归目录下都是相同形式的文件是相对容易的,但保证扩展名都是.txt是比较困难的。

common_utils.py:4get_file_paths函数写死了扩展名是.txtapi.py:113scan_dir函数写死了扩展名是.txt,看下这里能不能接受其它传参?

关于键值类型文件

在提交给MNBVC的语料中,我们采用的是.jsonl后缀,这种类型的文件需要一种统一的编码校验(放行规则)或者校正。

举个例子,没使用ensure_ascii=False情况下存出来的json形如这样:

{"\u662f\u5426\u5f85\u67e5\u6587\u4ef6": false, "\u662f\u5426\u91cd\u590d\u6587\u4ef6": false, "\u6bb5\u843d\u6570": 17944, "\u53bb\u91cd\u6bb5\u843d\u6570": 0, "\u4f4e\u8d28\u91cf\u6bb5\u843d\u6570": 0}

而我们希望转换后的jsonl能够不做unicode转义,形如这样:

{"是否待查文件": false, "是否重复文件": false, "段落数": 17944, "去重段落数": 0, "低质量段落数": 0}

麻烦看下这个最后的转换工作是不是应该放在convert_files.py这个脚本里面做?

@alanshi
Copy link
Owner

alanshi commented Mar 1, 2024

收到,我们可以先看看这个问题

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants