| | import os |
| | import re |
| |
|
| | folder_path = "data" |
| | langs = ["eu", "es"] |
| | output = "configs:\n" |
| |
|
| | for lang in langs: |
| | for root, dirs, files in os.walk(f"{folder_path}/{lang}"): |
| | for file in sorted(files): |
| | file_path = os.path.join(root, file) |
| | rel_path = os.path.relpath(file_path, folder_path) |
| | output += ( |
| | f"- config_name: {lang}_{os.path.splitext(file)[0]}\n data_files:\n" |
| | ) |
| | output += f' - split: test\n path: "{folder_path}/{rel_path}"\n' |
| |
|
| | |
| | with open("README.md", "r") as f: |
| | readme_content = f.read() |
| |
|
| | |
| | yaml_end = re.search(r"---\n\n", readme_content).start() |
| |
|
| | |
| | readme_content = readme_content[:yaml_end] + output + readme_content[yaml_end:] |
| |
|
| | |
| | with open("README.md", "w") as f: |
| | f.write(readme_content) |
| |
|