Datasets:
Update files from the datasets library (from 1.16.0)
Browse filesRelease notes: https://github.com/huggingface/datasets/releases/tag/1.16.0
- README.md +7 -0
- dataset_infos.json +1 -1
- dummy/cs-en/1.0.0/dummy_data.zip +2 -2
- dummy/cs-en/1.0.0/dummy_data/dev.tgz/dev/newstest2013.cs +0 -1
- dummy/cs-en/1.0.0/dummy_data/dev.tgz/dev/newstest2013.en +0 -1
- dummy/cs-en/1.0.0/dummy_data/dev.tgz/dev/newstest2014-csen-ref.en.sgm +0 -1
- dummy/cs-en/1.0.0/dummy_data/dev.tgz/dev/newstest2014-csen-src.cs.sgm +0 -1
- dummy/cs-en/1.0.0/dummy_data/dev.tgz/dev/newstest2015-csen-ref.en.sgm +0 -1
- dummy/cs-en/1.0.0/dummy_data/dev.tgz/dev/newstest2015-csen-src.cs.sgm +0 -1
- dummy/cs-en/1.0.0/dummy_data/dev.tgz/dev/newstest2016-csen-ref.en.sgm +0 -1
- dummy/cs-en/1.0.0/dummy_data/dev.tgz/dev/newstest2016-csen-src.cs.sgm +0 -1
- dummy/cs-en/1.0.0/dummy_data/dev.tgz/dev/newstest2017-csen-ref.en.sgm +0 -1
- dummy/cs-en/1.0.0/dummy_data/dev.tgz/dev/newstest2017-csen-src.cs.sgm +0 -1
- dummy/cs-en/1.0.0/dummy_data/dev.tgz/dev/newstest2018-csen-ref.en.sgm +0 -1
- dummy/cs-en/1.0.0/dummy_data/dev.tgz/dev/newstest2018-csen-src.cs.sgm +0 -1
- dummy/cs-en/1.0.0/dummy_data/en-cs.bicleaner07.tmx.gz +0 -3
- dummy/cs-en/1.0.0/dummy_data/europarl-v9.cs-en.tsv.gz +0 -3
- dummy/cs-en/1.0.0/dummy_data/news-commentary-v14.cs-en.tsv.gz +0 -3
- dummy/cs-en/1.0.0/dummy_data/paracrawl-release1.en-cs.zipporah0-dedup-clean.tgz/paracrawl-release1.en-cs.zipporah0-dedup-clean.cs +0 -1
- dummy/cs-en/1.0.0/dummy_data/paracrawl-release1.en-cs.zipporah0-dedup-clean.tgz/paracrawl-release1.en-cs.zipporah0-dedup-clean.en +0 -1
- dummy/cs-en/1.0.0/dummy_data/training-parallel-commoncrawl.tgz/commoncrawl.cs-en.cs +0 -1
- dummy/cs-en/1.0.0/dummy_data/training-parallel-commoncrawl.tgz/commoncrawl.cs-en.en +0 -1
- dummy/cs-en/1.0.0/dummy_data/training-parallel-europarl-v7.tgz/training/europarl-v7.cs-en.cs +0 -1
- dummy/cs-en/1.0.0/dummy_data/training-parallel-europarl-v7.tgz/training/europarl-v7.cs-en.en +0 -1
- dummy/cs-en/1.0.0/dummy_data/training-parallel-nc-v13.tgz/training-parallel-nc-v13/news-commentary-v13.cs-en.cs +0 -1
- dummy/cs-en/1.0.0/dummy_data/training-parallel-nc-v13.tgz/training-parallel-nc-v13/news-commentary-v13.cs-en.en +0 -1
- dummy/cs-en/1.0.0/dummy_data/wikititles-v1.cs-en.tsv.gz +0 -3
- wmt_utils.py +111 -103
README.md
CHANGED
@@ -1,5 +1,12 @@
|
|
1 |
---
|
|
|
2 |
paperswithcode_id: null
|
|
|
|
|
|
|
|
|
|
|
|
|
3 |
---
|
4 |
|
5 |
# Dataset Card for "wmt19"
|
|
|
1 |
---
|
2 |
+
pretty_name: WMT19
|
3 |
paperswithcode_id: null
|
4 |
+
multilinguality:
|
5 |
+
- translation
|
6 |
+
task_categories:
|
7 |
+
- conditional-text-generation
|
8 |
+
task_ids:
|
9 |
+
- machine-translation
|
10 |
---
|
11 |
|
12 |
# Dataset Card for "wmt19"
|
dataset_infos.json
CHANGED
@@ -1 +1 @@
|
|
1 |
-
{"cs-en": {"description": "Translate dataset based on the data from statmt.org.\n\nVersions exists for the different years using a combination of multiple data\nsources. The base `wmt_translate` allows you to create your own config to choose\nyour own data/language pair by creating a custom `datasets.translate.wmt.WmtConfig`.\n\n```\nconfig = datasets.wmt.WmtConfig(\n version=\"0.0.1\",\n language_pair=(\"fr\", \"de\"),\n subsets={\n datasets.Split.TRAIN: [\"commoncrawl_frde\"],\n datasets.Split.VALIDATION: [\"euelections_dev2019\"],\n },\n)\nbuilder = datasets.builder(\"wmt_translate\", config=config)\n```\n\n", "citation": "\n@ONLINE {wmt19translate,\n author = \"Wikimedia Foundation\",\n title = \"ACL 2019 Fourth Conference on Machine Translation (WMT19), Shared Task: Machine Translation of News\",\n url = \"http://www.statmt.org/wmt19/translation-task.html\"\n}\n", "homepage": "http://www.statmt.org/wmt19/translation-task.html", "license": "", "features": {"translation": {"languages": ["cs", "en"], "id": null, "_type": "Translation"}}, "supervised_keys": {"input": "cs", "output": "en"}, "builder_name": "wmt19", "config_name": "cs-en", "version": {"version_str": "1.0.0", "description": null, "datasets_version_to_prepare": null, "major": 1, "minor": 0, "patch": 0}, "splits": {"train": {"name": "train", "num_bytes": 1314871994, "num_examples": 7270695, "dataset_name": "wmt19"}, "validation": {"name": "validation", "num_bytes": 696229, "num_examples": 2983, "dataset_name": "wmt19"}}, "download_checksums": {"https://huggingface.co/datasets/wmt/europarl/resolve/main/v9/training/europarl-v9.cs-en.tsv.gz": {"num_bytes": 68176874, "checksum": "e5e46de957439cf14e5048fc4127656d91315646822f2ac6c0193b5758617f60"}, "https://s3.amazonaws.com/web-language-models/paracrawl/release3/en-cs.bicleaner07.tmx.gz": {"num_bytes": 957135146, "checksum": "404bd17f9988f74f6544f7f9762bfbc4e52f7532779c28187e34dc8a5176960e"}, "https://huggingface.co/datasets/wmt/wmt13/resolve/main/training-parallel-commoncrawl.tgz": {"num_bytes": 918311367, "checksum": "c7a74e2ea01ac6c920123108627e35278d4ccb5701e15428ffa34de86fa3a9e5"}, "http://data.statmt.org/news-commentary/v14/training/news-commentary-v14.cs-en.tsv.gz": {"num_bytes": 28119465, "checksum": "b0ef38b810bc67811eb908080243e0211062c26a7a71cc05996c96ea6c55e0ff"}, "http://ufal.mff.cuni.cz/czeng/download.php?f=convert_czeng16_to_17.pl.zip": {"num_bytes": 2544381, "checksum": "e66466e00aecd392daaf547275590a9264bbc6aed70118c5c7cfd6946daf24ac"}, "https://huggingface.co/datasets/wmt/wikititles/resolve/main/v1/wikititles-v1.cs-en.tsv.gz": {"num_bytes": 5112423, "checksum": "54c9899b3cf897aaa520645436843d57e36ba9cce22f2c544a63a62493e18002"}, "https://huggingface.co/datasets/wmt/wmt19/resolve/main/translation-task/dev.tgz": {"num_bytes": 38654961, "checksum": "7a7deccf82ebb05ba508dba5eb21356492224e8f630ec4f992132b029b4b25e7"}}, "download_size": 2018054617, "dataset_size": 1315568223, "size_in_bytes": 3333622840}}
|
|
|
1 |
+
{"cs-en": {"description": "Translate dataset based on the data from statmt.org.\n\nVersions exists for the different years using a combination of multiple data\nsources. The base `wmt_translate` allows you to create your own config to choose\nyour own data/language pair by creating a custom `datasets.translate.wmt.WmtConfig`.\n\n```\nconfig = datasets.wmt.WmtConfig(\n version=\"0.0.1\",\n language_pair=(\"fr\", \"de\"),\n subsets={\n datasets.Split.TRAIN: [\"commoncrawl_frde\"],\n datasets.Split.VALIDATION: [\"euelections_dev2019\"],\n },\n)\nbuilder = datasets.builder(\"wmt_translate\", config=config)\n```\n\n", "citation": "\n@ONLINE {wmt19translate,\n author = {Wikimedia Foundation},\n title = {ACL 2019 Fourth Conference on Machine Translation (WMT19), Shared Task: Machine Translation of News},\n url = {http://www.statmt.org/wmt19/translation-task.html}\n}\n", "homepage": "http://www.statmt.org/wmt19/translation-task.html", "license": "", "features": {"translation": {"languages": ["cs", "en"], "id": null, "_type": "Translation"}}, "post_processed": null, "supervised_keys": {"input": "cs", "output": "en"}, "task_templates": null, "builder_name": "wmt19", "config_name": "cs-en", "version": {"version_str": "1.0.0", "description": null, "major": 1, "minor": 0, "patch": 0}, "splits": {"train": {"name": "train", "num_bytes": 1314871994, "num_examples": 7270695, "dataset_name": "wmt19"}, "validation": {"name": "validation", "num_bytes": 696229, "num_examples": 2983, "dataset_name": "wmt19"}}, "download_checksums": {"https://huggingface.co/datasets/wmt/europarl/resolve/main/v9/training/europarl-v9.cs-en.tsv.gz": {"num_bytes": 68176874, "checksum": "e5e46de957439cf14e5048fc4127656d91315646822f2ac6c0193b5758617f60"}, "https://s3.amazonaws.com/web-language-models/paracrawl/release3/en-cs.bicleaner07.tmx.gz": {"num_bytes": 957135146, "checksum": "404bd17f9988f74f6544f7f9762bfbc4e52f7532779c28187e34dc8a5176960e"}, "https://huggingface.co/datasets/wmt/wmt13/resolve/main-zip/training-parallel-commoncrawl.zip": {"num_bytes": 918734483, "checksum": "5ffe980072ea29adfd84568d099bea366d9f72772b988e670794ae851b4e5627"}, "http://data.statmt.org/news-commentary/v14/training/news-commentary-v14.cs-en.tsv.gz": {"num_bytes": 28119465, "checksum": "b0ef38b810bc67811eb908080243e0211062c26a7a71cc05996c96ea6c55e0ff"}, "http://ufal.mff.cuni.cz/czeng/download.php?f=convert_czeng16_to_17.pl.zip": {"num_bytes": 2544381, "checksum": "e66466e00aecd392daaf547275590a9264bbc6aed70118c5c7cfd6946daf24ac"}, "https://huggingface.co/datasets/wmt/wikititles/resolve/main/v1/wikititles-v1.cs-en.tsv.gz": {"num_bytes": 5112423, "checksum": "54c9899b3cf897aaa520645436843d57e36ba9cce22f2c544a63a62493e18002"}, "https://huggingface.co/datasets/wmt/wmt19/resolve/main-zip/translation-task/dev.zip": {"num_bytes": 38714274, "checksum": "d796e363740fdc4261aa6f5a3d2f8223e3adaee7d737b7724863325b8956dfd1"}}, "download_size": 2018537046, "post_processing_size": null, "dataset_size": 1315568223, "size_in_bytes": 3334105269}, "de-en": {"description": "Translate dataset based on the data from statmt.org.\n\nVersions exists for the different years using a combination of multiple data\nsources. The base `wmt_translate` allows you to create your own config to choose\nyour own data/language pair by creating a custom `datasets.translate.wmt.WmtConfig`.\n\n```\nconfig = datasets.wmt.WmtConfig(\n version=\"0.0.1\",\n language_pair=(\"fr\", \"de\"),\n subsets={\n datasets.Split.TRAIN: [\"commoncrawl_frde\"],\n datasets.Split.VALIDATION: [\"euelections_dev2019\"],\n },\n)\nbuilder = datasets.builder(\"wmt_translate\", config=config)\n```\n\n", "citation": "\n@ONLINE {wmt19translate,\n author = {Wikimedia Foundation},\n title = {ACL 2019 Fourth Conference on Machine Translation (WMT19), Shared Task: Machine Translation of News},\n url = {http://www.statmt.org/wmt19/translation-task.html}\n}\n", "homepage": "http://www.statmt.org/wmt19/translation-task.html", "license": "", "features": {"translation": {"languages": ["de", "en"], "id": null, "_type": "Translation"}}, "post_processed": null, "supervised_keys": {"input": "de", "output": "en"}, "task_templates": null, "builder_name": "wmt19", "config_name": "de-en", "version": {"version_str": "1.0.0", "description": null, "major": 1, "minor": 0, "patch": 0}, "splits": {"train": {"name": "train", "num_bytes": 8420967590, "num_examples": 38690334, "dataset_name": "wmt19"}, "validation": {"name": "validation", "num_bytes": 757649, "num_examples": 2998, "dataset_name": "wmt19"}}, "download_checksums": {"https://huggingface.co/datasets/wmt/europarl/resolve/main/v9/training/europarl-v9.de-en.tsv.gz": {"num_bytes": 204454328, "checksum": "c2aef75d81bf06b22e4a9237319c1d53ba9668a13cb155c6b1361182cd3abc84"}, "https://s3.amazonaws.com/web-language-models/paracrawl/release3/en-de.bicleaner07.tmx.gz": {"num_bytes": 9091373722, "checksum": "fbeef288e4f1d294534be3afbf43469cf59938553436108d717873c1c50d34c7"}, "https://huggingface.co/datasets/wmt/wmt13/resolve/main-zip/training-parallel-commoncrawl.zip": {"num_bytes": 918734483, "checksum": "5ffe980072ea29adfd84568d099bea366d9f72772b988e670794ae851b4e5627"}, "http://data.statmt.org/news-commentary/v14/training/news-commentary-v14.de-en.tsv.gz": {"num_bytes": 39390551, "checksum": "8aaa98a77d38bd39dcbdbcb775f3b6c633700e4c10fd915cf3dc6b9bfd0f2dca"}, "https://huggingface.co/datasets/wmt/wikititles/resolve/main/v1/wikititles-v1.de-en.tsv.gz": {"num_bytes": 17919359, "checksum": "24b0222ee87b6b8b3142c92f1b6f3c49374503fb066c46f190f00bf717a67102"}, "https://s3-eu-west-1.amazonaws.com/tilde-model/rapid2019.de-en.zip": {"num_bytes": 111888392, "checksum": "ed5a10e57092715020334b918f6e114e5b6c7206bee3e956f2a1e2937c59c2e7"}, "https://huggingface.co/datasets/wmt/wmt19/resolve/main-zip/translation-task/dev.zip": {"num_bytes": 38714274, "checksum": "d796e363740fdc4261aa6f5a3d2f8223e3adaee7d737b7724863325b8956dfd1"}}, "download_size": 10422475109, "post_processing_size": null, "dataset_size": 8421725239, "size_in_bytes": 18844200348}, "fi-en": {"description": "Translate dataset based on the data from statmt.org.\n\nVersions exists for the different years using a combination of multiple data\nsources. The base `wmt_translate` allows you to create your own config to choose\nyour own data/language pair by creating a custom `datasets.translate.wmt.WmtConfig`.\n\n```\nconfig = datasets.wmt.WmtConfig(\n version=\"0.0.1\",\n language_pair=(\"fr\", \"de\"),\n subsets={\n datasets.Split.TRAIN: [\"commoncrawl_frde\"],\n datasets.Split.VALIDATION: [\"euelections_dev2019\"],\n },\n)\nbuilder = datasets.builder(\"wmt_translate\", config=config)\n```\n\n", "citation": "\n@ONLINE {wmt19translate,\n author = {Wikimedia Foundation},\n title = {ACL 2019 Fourth Conference on Machine Translation (WMT19), Shared Task: Machine Translation of News},\n url = {http://www.statmt.org/wmt19/translation-task.html}\n}\n", "homepage": "http://www.statmt.org/wmt19/translation-task.html", "license": "", "features": {"translation": {"languages": ["fi", "en"], "id": null, "_type": "Translation"}}, "post_processed": null, "supervised_keys": {"input": "fi", "output": "en"}, "task_templates": null, "builder_name": "wmt19", "config_name": "fi-en", "version": {"version_str": "1.0.0", "description": null, "major": 1, "minor": 0, "patch": 0}, "splits": {"train": {"name": "train", "num_bytes": 1422922267, "num_examples": 6587448, "dataset_name": "wmt19"}, "validation": {"name": "validation", "num_bytes": 691841, "num_examples": 3000, "dataset_name": "wmt19"}}, "download_checksums": {"https://huggingface.co/datasets/wmt/europarl/resolve/main/v9/training/europarl-v9.fi-en.tsv.gz": {"num_bytes": 194574376, "checksum": "6bd65e497db4cc783b08f8be62aaa4b85c67c1e260a09e785cef77ff9e4488e8"}, "https://s3.amazonaws.com/web-language-models/paracrawl/release3/en-fi.bicleaner07.tmx.gz": {"num_bytes": 726455593, "checksum": "d7741612d6d82b9479819b1acc1149343c5bed7d4953f982e8889f2156a8bf17"}, "https://huggingface.co/datasets/wmt/wikititles/resolve/main/v1/wikititles-v1.fi-en.tsv.gz": {"num_bytes": 5101486, "checksum": "01906ddfc88b20039939e69652c5ba9b335c4671be5131c00d76ec0420760fad"}, "https://tilde-model.s3-eu-west-1.amazonaws.com/rapid2016.en-fi.tmx.zip": {"num_bytes": 41279180, "checksum": "2a3ad1343cded48241b8ed38db9a963d89f924eb46429f9c3eace56b1f56ba4e"}, "https://huggingface.co/datasets/wmt/wmt19/resolve/main-zip/translation-task/dev.zip": {"num_bytes": 38714274, "checksum": "d796e363740fdc4261aa6f5a3d2f8223e3adaee7d737b7724863325b8956dfd1"}}, "download_size": 1006124909, "post_processing_size": null, "dataset_size": 1423614108, "size_in_bytes": 2429739017}, "gu-en": {"description": "Translate dataset based on the data from statmt.org.\n\nVersions exists for the different years using a combination of multiple data\nsources. The base `wmt_translate` allows you to create your own config to choose\nyour own data/language pair by creating a custom `datasets.translate.wmt.WmtConfig`.\n\n```\nconfig = datasets.wmt.WmtConfig(\n version=\"0.0.1\",\n language_pair=(\"fr\", \"de\"),\n subsets={\n datasets.Split.TRAIN: [\"commoncrawl_frde\"],\n datasets.Split.VALIDATION: [\"euelections_dev2019\"],\n },\n)\nbuilder = datasets.builder(\"wmt_translate\", config=config)\n```\n\n", "citation": "\n@ONLINE {wmt19translate,\n author = {Wikimedia Foundation},\n title = {ACL 2019 Fourth Conference on Machine Translation (WMT19), Shared Task: Machine Translation of News},\n url = {http://www.statmt.org/wmt19/translation-task.html}\n}\n", "homepage": "http://www.statmt.org/wmt19/translation-task.html", "license": "", "features": {"translation": {"languages": ["gu", "en"], "id": null, "_type": "Translation"}}, "post_processed": null, "supervised_keys": {"input": "gu", "output": "en"}, "task_templates": null, "builder_name": "wmt19", "config_name": "gu-en", "version": {"version_str": "1.0.0", "description": null, "major": 1, "minor": 0, "patch": 0}, "splits": {"train": {"name": "train", "num_bytes": 590763, "num_examples": 11670, "dataset_name": "wmt19"}, "validation": {"name": "validation", "num_bytes": 774621, "num_examples": 1998, "dataset_name": "wmt19"}}, "download_checksums": {"https://huggingface.co/datasets/wmt/wikititles/resolve/main/v1/wikititles-v1.gu-en.tsv.gz": {"num_bytes": 177183, "checksum": "d07da4ff7e648e1e1bc3ac1303cd7c51df15704a13b8e6ce7ed46e938ef4ae8d"}, "https://huggingface.co/datasets/wmt/wmt19/resolve/main-zip/translation-task/dev.zip": {"num_bytes": 38714274, "checksum": "d796e363740fdc4261aa6f5a3d2f8223e3adaee7d737b7724863325b8956dfd1"}}, "download_size": 38891457, "post_processing_size": null, "dataset_size": 1365384, "size_in_bytes": 40256841}, "kk-en": {"description": "Translate dataset based on the data from statmt.org.\n\nVersions exists for the different years using a combination of multiple data\nsources. The base `wmt_translate` allows you to create your own config to choose\nyour own data/language pair by creating a custom `datasets.translate.wmt.WmtConfig`.\n\n```\nconfig = datasets.wmt.WmtConfig(\n version=\"0.0.1\",\n language_pair=(\"fr\", \"de\"),\n subsets={\n datasets.Split.TRAIN: [\"commoncrawl_frde\"],\n datasets.Split.VALIDATION: [\"euelections_dev2019\"],\n },\n)\nbuilder = datasets.builder(\"wmt_translate\", config=config)\n```\n\n", "citation": "\n@ONLINE {wmt19translate,\n author = {Wikimedia Foundation},\n title = {ACL 2019 Fourth Conference on Machine Translation (WMT19), Shared Task: Machine Translation of News},\n url = {http://www.statmt.org/wmt19/translation-task.html}\n}\n", "homepage": "http://www.statmt.org/wmt19/translation-task.html", "license": "", "features": {"translation": {"languages": ["kk", "en"], "id": null, "_type": "Translation"}}, "post_processed": null, "supervised_keys": {"input": "kk", "output": "en"}, "task_templates": null, "builder_name": "wmt19", "config_name": "kk-en", "version": {"version_str": "1.0.0", "description": null, "major": 1, "minor": 0, "patch": 0}, "splits": {"train": {"name": "train", "num_bytes": 9157438, "num_examples": 126583, "dataset_name": "wmt19"}, "validation": {"name": "validation", "num_bytes": 846857, "num_examples": 2066, "dataset_name": "wmt19"}}, "download_checksums": {"http://data.statmt.org/news-commentary/v14/training/news-commentary-v14.en-kk.tsv.gz": {"num_bytes": 1269004, "checksum": "bc0fdd1dd040c53409ace60c019a8a58450a36f128bc1e4263fcb5d4fc1bf0cb"}, "https://huggingface.co/datasets/wmt/wikititles/resolve/main/v1/wikititles-v1.kk-en.tsv.gz": {"num_bytes": 1575037, "checksum": "6117eb91ca5538298c15fb366fb7f15e5294c12ef7993f249f307f93c52ae504"}, "https://huggingface.co/datasets/wmt/wmt19/resolve/main-zip/translation-task/dev.zip": {"num_bytes": 38714274, "checksum": "d796e363740fdc4261aa6f5a3d2f8223e3adaee7d737b7724863325b8956dfd1"}}, "download_size": 41558315, "post_processing_size": null, "dataset_size": 10004295, "size_in_bytes": 51562610}, "lt-en": {"description": "Translate dataset based on the data from statmt.org.\n\nVersions exists for the different years using a combination of multiple data\nsources. The base `wmt_translate` allows you to create your own config to choose\nyour own data/language pair by creating a custom `datasets.translate.wmt.WmtConfig`.\n\n```\nconfig = datasets.wmt.WmtConfig(\n version=\"0.0.1\",\n language_pair=(\"fr\", \"de\"),\n subsets={\n datasets.Split.TRAIN: [\"commoncrawl_frde\"],\n datasets.Split.VALIDATION: [\"euelections_dev2019\"],\n },\n)\nbuilder = datasets.builder(\"wmt_translate\", config=config)\n```\n\n", "citation": "\n@ONLINE {wmt19translate,\n author = {Wikimedia Foundation},\n title = {ACL 2019 Fourth Conference on Machine Translation (WMT19), Shared Task: Machine Translation of News},\n url = {http://www.statmt.org/wmt19/translation-task.html}\n}\n", "homepage": "http://www.statmt.org/wmt19/translation-task.html", "license": "", "features": {"translation": {"languages": ["lt", "en"], "id": null, "_type": "Translation"}}, "post_processed": null, "supervised_keys": {"input": "lt", "output": "en"}, "task_templates": null, "builder_name": "wmt19", "config_name": "lt-en", "version": {"version_str": "1.0.0", "description": null, "major": 1, "minor": 0, "patch": 0}, "splits": {"train": {"name": "train", "num_bytes": 513084361, "num_examples": 2344893, "dataset_name": "wmt19"}, "validation": {"name": "validation", "num_bytes": 541953, "num_examples": 2000, "dataset_name": "wmt19"}}, "download_checksums": {"https://huggingface.co/datasets/wmt/europarl/resolve/main/v9/training/europarl-v9.lt-en.tsv.gz": {"num_bytes": 64351345, "checksum": "9ff4cf5ab95603a6f2c9b6342dd8fdaa9ab307dce3ba25b4317cc6da98069a2d"}, "https://s3.amazonaws.com/web-language-models/paracrawl/release3/en-lt.bicleaner07.tmx.gz": {"num_bytes": 286088883, "checksum": "8943d6770a4d0ac152436a42105052fb18cba0e8a6df401daa18390b9439693c"}, "https://huggingface.co/datasets/wmt/wikititles/resolve/main/v1/wikititles-v1.lt-en.tsv.gz": {"num_bytes": 1725255, "checksum": "4ee533538e441811cb98caf08ad749e8d407905952d3b880e2eb1e795f1f28fc"}, "https://tilde-model.s3-eu-west-1.amazonaws.com/rapid2016.en-lt.tmx.zip": {"num_bytes": 20430195, "checksum": "a61ffccc45d6763aaa3046708e1b19207f1c2dadab456312652892dd6a54c3f5"}, "https://huggingface.co/datasets/wmt/wmt19/resolve/main-zip/translation-task/dev.zip": {"num_bytes": 38714274, "checksum": "d796e363740fdc4261aa6f5a3d2f8223e3adaee7d737b7724863325b8956dfd1"}}, "download_size": 411309952, "post_processing_size": null, "dataset_size": 513626314, "size_in_bytes": 924936266}, "ru-en": {"description": "Translate dataset based on the data from statmt.org.\n\nVersions exists for the different years using a combination of multiple data\nsources. The base `wmt_translate` allows you to create your own config to choose\nyour own data/language pair by creating a custom `datasets.translate.wmt.WmtConfig`.\n\n```\nconfig = datasets.wmt.WmtConfig(\n version=\"0.0.1\",\n language_pair=(\"fr\", \"de\"),\n subsets={\n datasets.Split.TRAIN: [\"commoncrawl_frde\"],\n datasets.Split.VALIDATION: [\"euelections_dev2019\"],\n },\n)\nbuilder = datasets.builder(\"wmt_translate\", config=config)\n```\n\n", "citation": "\n@ONLINE {wmt19translate,\n author = {Wikimedia Foundation},\n title = {ACL 2019 Fourth Conference on Machine Translation (WMT19), Shared Task: Machine Translation of News},\n url = {http://www.statmt.org/wmt19/translation-task.html}\n}\n", "homepage": "http://www.statmt.org/wmt19/translation-task.html", "license": "", "features": {"translation": {"languages": ["ru", "en"], "id": null, "_type": "Translation"}}, "post_processed": null, "supervised_keys": {"input": "ru", "output": "en"}, "task_templates": null, "builder_name": "wmt19", "config_name": "ru-en", "version": {"version_str": "1.0.0", "description": null, "major": 1, "minor": 0, "patch": 0}, "splits": {"train": {"name": "train", "num_bytes": 13721377178, "num_examples": 37492126, "dataset_name": "wmt19"}, "validation": {"name": "validation", "num_bytes": 1085596, "num_examples": 3000, "dataset_name": "wmt19"}}, "download_checksums": {"https://s3.amazonaws.com/web-language-models/paracrawl/release1/paracrawl-release1.en-ru.zipporah0-dedup-clean.tgz": {"num_bytes": 667981874, "checksum": "d4902407ef462034e88fbf5d8712a11c4b32a6e0e82d3a1b4f42a6f33d94f3c0"}, "https://huggingface.co/datasets/wmt/wmt13/resolve/main-zip/training-parallel-commoncrawl.zip": {"num_bytes": 918734483, "checksum": "5ffe980072ea29adfd84568d099bea366d9f72772b988e670794ae851b4e5627"}, "http://data.statmt.org/news-commentary/v14/training/news-commentary-v14.en-ru.tsv.gz": {"num_bytes": 41411245, "checksum": "09aef10a0bb51104622ff6852cdf4f693b5906de970156b4e8db1e64ec55340c"}, "https://huggingface.co/datasets/wmt/wikititles/resolve/main/v1/wikititles-v1.ru-en.tsv.gz": {"num_bytes": 20299017, "checksum": "5da4f340b3ac684dca016bb5fc0730b00fc9808f0a4891a6d745aaa686a600e4"}, "https://huggingface.co/datasets/wmt/uncorpus/resolve/main-zip/UNv1.0.en-ru.zip": {"num_bytes": 2447006960, "checksum": "72c2670fa6aadb36d541cba91cd26b9da291a976bf1a2748177a57baf8261f4c"}, "https://huggingface.co/datasets/wmt/wmt19/resolve/main-zip/translation-task/dev.zip": {"num_bytes": 38714274, "checksum": "d796e363740fdc4261aa6f5a3d2f8223e3adaee7d737b7724863325b8956dfd1"}}, "download_size": 4134147853, "post_processing_size": null, "dataset_size": 13722462774, "size_in_bytes": 17856610627}, "zh-en": {"description": "Translate dataset based on the data from statmt.org.\n\nVersions exists for the different years using a combination of multiple data\nsources. The base `wmt_translate` allows you to create your own config to choose\nyour own data/language pair by creating a custom `datasets.translate.wmt.WmtConfig`.\n\n```\nconfig = datasets.wmt.WmtConfig(\n version=\"0.0.1\",\n language_pair=(\"fr\", \"de\"),\n subsets={\n datasets.Split.TRAIN: [\"commoncrawl_frde\"],\n datasets.Split.VALIDATION: [\"euelections_dev2019\"],\n },\n)\nbuilder = datasets.builder(\"wmt_translate\", config=config)\n```\n\n", "citation": "\n@ONLINE {wmt19translate,\n author = {Wikimedia Foundation},\n title = {ACL 2019 Fourth Conference on Machine Translation (WMT19), Shared Task: Machine Translation of News},\n url = {http://www.statmt.org/wmt19/translation-task.html}\n}\n", "homepage": "http://www.statmt.org/wmt19/translation-task.html", "license": "", "features": {"translation": {"languages": ["zh", "en"], "id": null, "_type": "Translation"}}, "post_processed": null, "supervised_keys": {"input": "zh", "output": "en"}, "task_templates": null, "builder_name": "wmt19", "config_name": "zh-en", "version": {"version_str": "1.0.0", "description": null, "major": 1, "minor": 0, "patch": 0}, "splits": {"train": {"name": "train", "num_bytes": 5584359748, "num_examples": 25984574, "dataset_name": "wmt19"}, "validation": {"name": "validation", "num_bytes": 1107522, "num_examples": 3981, "dataset_name": "wmt19"}}, "download_checksums": {"http://data.statmt.org/news-commentary/v14/training/news-commentary-v14.en-zh.tsv.gz": {"num_bytes": 36696769, "checksum": "fc9cc3f28ad62872d8eece1dffb1148f972baf6621bc87ba049a3ae0aab4025b"}, "https://huggingface.co/datasets/wmt/wikititles/resolve/main/v1/wikititles-v1.zh-en.tsv.gz": {"num_bytes": 12974754, "checksum": "78a8d371c0c1de14786bcbaaa08049d7f77ed58ecef3bc95a305ad17944f1fcb"}, "https://huggingface.co/datasets/wmt/uncorpus/resolve/main-zip/UNv1.0.en-zh.zip": {"num_bytes": 1385832125, "checksum": "97f5ce0892084cdbb2332b52ffcc0299a649ba0a43712d921575fe2b7edfb4b4"}, "https://huggingface.co/datasets/wmt/wmt18/resolve/main/cwmt-wmt/casia2015.zip": {"num_bytes": 98159063, "checksum": "c939f1528f96c419e9bbffb9caad869616a969e7704ffac896e245a02aff59a9"}, "https://huggingface.co/datasets/wmt/wmt18/resolve/main/cwmt-wmt/casict2011.zip": {"num_bytes": 166957775, "checksum": "606adc0ccc5d8fc7c47f8589991286616342a1a379a571ce3038918731ae0182"}, "https://huggingface.co/datasets/wmt/wmt18/resolve/main/cwmt-wmt/casict2015.zip": {"num_bytes": 106836569, "checksum": "eef8e25b297c1aff12ab24719247d3588e756d7a4e2c30d4d34fcb4d05ab1050"}, "https://huggingface.co/datasets/wmt/wmt18/resolve/main/cwmt-wmt/datum2015.zip": {"num_bytes": 100118018, "checksum": "654afce6731485c40ce856514ab80cd2bfd836126bcaf48cdb911ebc32b021a4"}, "https://huggingface.co/datasets/wmt/wmt18/resolve/main/cwmt-wmt/datum2017.zip": {"num_bytes": 99278067, "checksum": "737455c139596f4abf3b1da73bc38932b3ef9534549328eff47d867e29950ed2"}, "https://huggingface.co/datasets/wmt/wmt18/resolve/main/cwmt-wmt/neu2017.zip": {"num_bytes": 150311715, "checksum": "5c5ea9ac5cbc43c974bd53796a3a29829800865b6398b52cda0a3854cb0d2e03"}, "https://huggingface.co/datasets/wmt/wmt19/resolve/main-zip/translation-task/dev.zip": {"num_bytes": 38714274, "checksum": "d796e363740fdc4261aa6f5a3d2f8223e3adaee7d737b7724863325b8956dfd1"}}, "download_size": 2195879129, "post_processing_size": null, "dataset_size": 5585467270, "size_in_bytes": 7781346399}, "fr-de": {"description": "Translate dataset based on the data from statmt.org.\n\nVersions exists for the different years using a combination of multiple data\nsources. The base `wmt_translate` allows you to create your own config to choose\nyour own data/language pair by creating a custom `datasets.translate.wmt.WmtConfig`.\n\n```\nconfig = datasets.wmt.WmtConfig(\n version=\"0.0.1\",\n language_pair=(\"fr\", \"de\"),\n subsets={\n datasets.Split.TRAIN: [\"commoncrawl_frde\"],\n datasets.Split.VALIDATION: [\"euelections_dev2019\"],\n },\n)\nbuilder = datasets.builder(\"wmt_translate\", config=config)\n```\n\n", "citation": "\n@ONLINE {wmt19translate,\n author = {Wikimedia Foundation},\n title = {ACL 2019 Fourth Conference on Machine Translation (WMT19), Shared Task: Machine Translation of News},\n url = {http://www.statmt.org/wmt19/translation-task.html}\n}\n", "homepage": "http://www.statmt.org/wmt19/translation-task.html", "license": "", "features": {"translation": {"languages": ["fr", "de"], "id": null, "_type": "Translation"}}, "post_processed": null, "supervised_keys": {"input": "fr", "output": "de"}, "task_templates": null, "builder_name": "wmt19", "config_name": "fr-de", "version": {"version_str": "1.0.0", "description": null, "major": 1, "minor": 0, "patch": 0}, "splits": {"train": {"name": "train", "num_bytes": 2358413485, "num_examples": 9824476, "dataset_name": "wmt19"}, "validation": {"name": "validation", "num_bytes": 441426, "num_examples": 1512, "dataset_name": "wmt19"}}, "download_checksums": {"https://huggingface.co/datasets/wmt/wmt19/resolve/main/translation-task/fr-de/bitexts/europarl-v7.fr.gz": {"num_bytes": 93157785, "checksum": "a065d9e973cd126f0fe72437e2ae03af0cb4b102d51f711e7985034daf60de96"}, "https://huggingface.co/datasets/wmt/wmt19/resolve/main/translation-task/fr-de/bitexts/europarl-v7.de.gz": {"num_bytes": 97417749, "checksum": "6850fac194d2cf74a732588ac78b04488a63b79c5481779e77cbab7d0e655a1e"}, "https://huggingface.co/datasets/wmt/wmt19/resolve/main/translation-task/fr-de/bitexts/de-fr.bicleaner07.de.gz": {"num_bytes": 216045091, "checksum": "cc71eb1f4772acc12314827d91fbaea6a5a73678b97b1a699fb9505430c23bc8"}, "https://huggingface.co/datasets/wmt/wmt19/resolve/main/translation-task/fr-de/bitexts/de-fr.bicleaner07.fr.gz": {"num_bytes": 212226219, "checksum": "c5c6c94c8c0d574fa93a8ed57f5a43baf2cf77844bb77bc0d81dbbae77444e52"}, "https://huggingface.co/datasets/wmt/wmt19/resolve/main/translation-task/fr-de/bitexts/commoncrawl.fr.gz": {"num_bytes": 32607032, "checksum": "cf4e89b6a8058243d7d91a978624b124f1e3a47dea4e124a7e25085e2455a5a6"}, "https://huggingface.co/datasets/wmt/wmt19/resolve/main/translation-task/fr-de/bitexts/commoncrawl.de.gz": {"num_bytes": 33273148, "checksum": "1bbbc4502130dd8152286cb0b8cadeeaeb4eff5b3f8cf1e710f6c023733cf5da"}, "http://data.statmt.org/news-commentary/v14/training/news-commentary-v14.de-fr.tsv.gz": {"num_bytes": 33904548, "checksum": "31a7735fe2ae6d6841847fdebb5aed03d5da1c15500695154d3c35d40c29cb09"}, "https://huggingface.co/datasets/wmt/wmt19/resolve/main-zip/translation-task/dev.zip": {"num_bytes": 38714274, "checksum": "d796e363740fdc4261aa6f5a3d2f8223e3adaee7d737b7724863325b8956dfd1"}}, "download_size": 757345846, "post_processing_size": null, "dataset_size": 2358854911, "size_in_bytes": 3116200757}}
|
dummy/cs-en/1.0.0/dummy_data.zip
CHANGED
@@ -1,3 +1,3 @@
|
|
1 |
version https://git-lfs.github.com/spec/v1
|
2 |
-
oid sha256:
|
3 |
-
size
|
|
|
1 |
version https://git-lfs.github.com/spec/v1
|
2 |
+
oid sha256:0b3e02cf5068ff7f6756e24634fbc60474bd4df063aedbb78a483cd58a30b81c
|
3 |
+
size 10597
|
dummy/cs-en/1.0.0/dummy_data/dev.tgz/dev/newstest2013.cs
DELETED
@@ -1 +0,0 @@
|
|
1 |
-
Just a test sentence.
|
|
|
|
dummy/cs-en/1.0.0/dummy_data/dev.tgz/dev/newstest2013.en
DELETED
@@ -1 +0,0 @@
|
|
1 |
-
Just a test sentence.
|
|
|
|
dummy/cs-en/1.0.0/dummy_data/dev.tgz/dev/newstest2014-csen-ref.en.sgm
DELETED
@@ -1 +0,0 @@
|
|
1 |
-
<seg id="1"> Test </seg>
|
|
|
|
dummy/cs-en/1.0.0/dummy_data/dev.tgz/dev/newstest2014-csen-src.cs.sgm
DELETED
@@ -1 +0,0 @@
|
|
1 |
-
<seg id="1"> Test </seg>
|
|
|
|
dummy/cs-en/1.0.0/dummy_data/dev.tgz/dev/newstest2015-csen-ref.en.sgm
DELETED
@@ -1 +0,0 @@
|
|
1 |
-
<seg id="1"> Test </seg>
|
|
|
|
dummy/cs-en/1.0.0/dummy_data/dev.tgz/dev/newstest2015-csen-src.cs.sgm
DELETED
@@ -1 +0,0 @@
|
|
1 |
-
<seg id="1"> Test </seg>
|
|
|
|
dummy/cs-en/1.0.0/dummy_data/dev.tgz/dev/newstest2016-csen-ref.en.sgm
DELETED
@@ -1 +0,0 @@
|
|
1 |
-
<seg id="1"> Test </seg>
|
|
|
|
dummy/cs-en/1.0.0/dummy_data/dev.tgz/dev/newstest2016-csen-src.cs.sgm
DELETED
@@ -1 +0,0 @@
|
|
1 |
-
<seg id="1"> Test </seg>
|
|
|
|
dummy/cs-en/1.0.0/dummy_data/dev.tgz/dev/newstest2017-csen-ref.en.sgm
DELETED
@@ -1 +0,0 @@
|
|
1 |
-
<seg id="1"> Test </seg>
|
|
|
|
dummy/cs-en/1.0.0/dummy_data/dev.tgz/dev/newstest2017-csen-src.cs.sgm
DELETED
@@ -1 +0,0 @@
|
|
1 |
-
<seg id="1"> Test </seg>
|
|
|
|
dummy/cs-en/1.0.0/dummy_data/dev.tgz/dev/newstest2018-csen-ref.en.sgm
DELETED
@@ -1 +0,0 @@
|
|
1 |
-
<seg id="1"> Test </seg>
|
|
|
|
dummy/cs-en/1.0.0/dummy_data/dev.tgz/dev/newstest2018-csen-src.cs.sgm
DELETED
@@ -1 +0,0 @@
|
|
1 |
-
<seg id="1"> Test </seg>
|
|
|
|
dummy/cs-en/1.0.0/dummy_data/en-cs.bicleaner07.tmx.gz
DELETED
@@ -1,3 +0,0 @@
|
|
1 |
-
version https://git-lfs.github.com/spec/v1
|
2 |
-
oid sha256:ef30ae40774640a18c7f8aa5a11d2953cfb56e6ad5f213771926f86ae323f3b4
|
3 |
-
size 390
|
|
|
|
|
|
|
|
dummy/cs-en/1.0.0/dummy_data/europarl-v9.cs-en.tsv.gz
DELETED
@@ -1,3 +0,0 @@
|
|
1 |
-
version https://git-lfs.github.com/spec/v1
|
2 |
-
oid sha256:e5afa07f0a35bc335119cd84c74373d5404b253c038f67dbd27cc16d7f6b4a6a
|
3 |
-
size 18
|
|
|
|
|
|
|
|
dummy/cs-en/1.0.0/dummy_data/news-commentary-v14.cs-en.tsv.gz
DELETED
@@ -1,3 +0,0 @@
|
|
1 |
-
version https://git-lfs.github.com/spec/v1
|
2 |
-
oid sha256:e5afa07f0a35bc335119cd84c74373d5404b253c038f67dbd27cc16d7f6b4a6a
|
3 |
-
size 18
|
|
|
|
|
|
|
|
dummy/cs-en/1.0.0/dummy_data/paracrawl-release1.en-cs.zipporah0-dedup-clean.tgz/paracrawl-release1.en-cs.zipporah0-dedup-clean.cs
DELETED
@@ -1 +0,0 @@
|
|
1 |
-
This is a test sentence.
|
|
|
|
dummy/cs-en/1.0.0/dummy_data/paracrawl-release1.en-cs.zipporah0-dedup-clean.tgz/paracrawl-release1.en-cs.zipporah0-dedup-clean.en
DELETED
@@ -1 +0,0 @@
|
|
1 |
-
This is a test sentence.
|
|
|
|
dummy/cs-en/1.0.0/dummy_data/training-parallel-commoncrawl.tgz/commoncrawl.cs-en.cs
DELETED
@@ -1 +0,0 @@
|
|
1 |
-
This is a test sentence.
|
|
|
|
dummy/cs-en/1.0.0/dummy_data/training-parallel-commoncrawl.tgz/commoncrawl.cs-en.en
DELETED
@@ -1 +0,0 @@
|
|
1 |
-
This is a test sentence.
|
|
|
|
dummy/cs-en/1.0.0/dummy_data/training-parallel-europarl-v7.tgz/training/europarl-v7.cs-en.cs
DELETED
@@ -1 +0,0 @@
|
|
1 |
-
This is a test sentence to pass the tests.
|
|
|
|
dummy/cs-en/1.0.0/dummy_data/training-parallel-europarl-v7.tgz/training/europarl-v7.cs-en.en
DELETED
@@ -1 +0,0 @@
|
|
1 |
-
This is a test sentence
|
|
|
|
dummy/cs-en/1.0.0/dummy_data/training-parallel-nc-v13.tgz/training-parallel-nc-v13/news-commentary-v13.cs-en.cs
DELETED
@@ -1 +0,0 @@
|
|
1 |
-
This is a test sentence.
|
|
|
|
dummy/cs-en/1.0.0/dummy_data/training-parallel-nc-v13.tgz/training-parallel-nc-v13/news-commentary-v13.cs-en.en
DELETED
@@ -1 +0,0 @@
|
|
1 |
-
This is a test sentence.
|
|
|
|
dummy/cs-en/1.0.0/dummy_data/wikititles-v1.cs-en.tsv.gz
DELETED
@@ -1,3 +0,0 @@
|
|
1 |
-
version https://git-lfs.github.com/spec/v1
|
2 |
-
oid sha256:e5afa07f0a35bc335119cd84c74373d5404b253c038f67dbd27cc16d7f6b4a6a
|
3 |
-
size 18
|
|
|
|
|
|
|
|
wmt_utils.py
CHANGED
@@ -96,7 +96,7 @@ class SubDataset:
|
|
96 |
def _inject_language(self, src, strings):
|
97 |
"""Injects languages into (potentially) template strings."""
|
98 |
if src not in self.sources:
|
99 |
-
raise ValueError("Invalid source for '{
|
100 |
|
101 |
def _format_string(s):
|
102 |
if "{0}" in s and "{1}" and "{src}" in s:
|
@@ -127,7 +127,7 @@ _TRAIN_SUBSETS = [
|
|
127 |
name="commoncrawl",
|
128 |
target="en", # fr-de pair in commoncrawl_frde
|
129 |
sources={"cs", "de", "es", "fr", "ru"},
|
130 |
-
url="https://huggingface.co/datasets/wmt/wmt13/resolve/main/training-parallel-commoncrawl.
|
131 |
path=("commoncrawl.{src}-en.{src}", "commoncrawl.{src}-en.en"),
|
132 |
),
|
133 |
SubDataset(
|
@@ -184,14 +184,14 @@ _TRAIN_SUBSETS = [
|
|
184 |
name="dcep_v1",
|
185 |
target="en",
|
186 |
sources={"lv"},
|
187 |
-
url="https://huggingface.co/datasets/wmt/wmt17/resolve/main/translation-task/dcep.lv-en.v1.
|
188 |
path=("dcep.en-lv/dcep.lv", "dcep.en-lv/dcep.en"),
|
189 |
),
|
190 |
SubDataset(
|
191 |
name="europarl_v7",
|
192 |
target="en",
|
193 |
sources={"cs", "de", "es", "fr"},
|
194 |
-
url="https://huggingface.co/datasets/wmt/wmt13/resolve/main/training-parallel-europarl-v7.
|
195 |
path=("training/europarl-v7.{src}-en.{src}", "training/europarl-v7.{src}-en.en"),
|
196 |
),
|
197 |
SubDataset(
|
@@ -208,14 +208,14 @@ _TRAIN_SUBSETS = [
|
|
208 |
name="europarl_v8_18",
|
209 |
target="en",
|
210 |
sources={"et", "fi"},
|
211 |
-
url="https://huggingface.co/datasets/wmt/wmt18/resolve/main/translation-task/training-parallel-ep-v8.
|
212 |
path=("training/europarl-v8.{src}-en.{src}", "training/europarl-v8.{src}-en.en"),
|
213 |
),
|
214 |
SubDataset(
|
215 |
name="europarl_v8_16",
|
216 |
target="en",
|
217 |
sources={"fi", "ro"},
|
218 |
-
url="https://huggingface.co/datasets/wmt/wmt16/resolve/main/translation-task/training-parallel-ep-v8.
|
219 |
path=("training-parallel-ep-v8/europarl-v8.{src}-en.{src}", "training-parallel-ep-v8/europarl-v8.{src}-en.en"),
|
220 |
),
|
221 |
SubDataset(
|
@@ -229,7 +229,7 @@ _TRAIN_SUBSETS = [
|
|
229 |
name="gigafren",
|
230 |
target="en",
|
231 |
sources={"fr"},
|
232 |
-
url="https://huggingface.co/datasets/wmt/wmt10/resolve/main/training-giga-fren.
|
233 |
path=("giga-fren.release2.fixed.fr.gz", "giga-fren.release2.fixed.en.gz"),
|
234 |
),
|
235 |
SubDataset(
|
@@ -244,35 +244,35 @@ _TRAIN_SUBSETS = [
|
|
244 |
name="leta_v1",
|
245 |
target="en",
|
246 |
sources={"lv"},
|
247 |
-
url="https://huggingface.co/datasets/wmt/wmt17/resolve/main/translation-task/leta.v1.
|
248 |
path=("LETA-lv-en/leta.lv", "LETA-lv-en/leta.en"),
|
249 |
),
|
250 |
SubDataset(
|
251 |
name="multiun",
|
252 |
target="en",
|
253 |
sources={"es", "fr"},
|
254 |
-
url="https://huggingface.co/datasets/wmt/wmt13/resolve/main/training-parallel-un.
|
255 |
path=("un/undoc.2000.{src}-en.{src}", "un/undoc.2000.{src}-en.en"),
|
256 |
),
|
257 |
SubDataset(
|
258 |
name="newscommentary_v9",
|
259 |
target="en",
|
260 |
sources={"cs", "de", "fr", "ru"},
|
261 |
-
url="https://huggingface.co/datasets/wmt/wmt14/resolve/main/training-parallel-nc-v9.
|
262 |
path=("training/news-commentary-v9.{src}-en.{src}", "training/news-commentary-v9.{src}-en.en"),
|
263 |
),
|
264 |
SubDataset(
|
265 |
name="newscommentary_v10",
|
266 |
target="en",
|
267 |
sources={"cs", "de", "fr", "ru"},
|
268 |
-
url="https://huggingface.co/datasets/wmt/wmt15/resolve/main/training-parallel-nc-v10.
|
269 |
path=("news-commentary-v10.{src}-en.{src}", "news-commentary-v10.{src}-en.en"),
|
270 |
),
|
271 |
SubDataset(
|
272 |
name="newscommentary_v11",
|
273 |
target="en",
|
274 |
sources={"cs", "de", "ru"},
|
275 |
-
url="https://huggingface.co/datasets/wmt/wmt16/resolve/main/translation-task/training-parallel-nc-v11.
|
276 |
path=(
|
277 |
"training-parallel-nc-v11/news-commentary-v11.{src}-en.{src}",
|
278 |
"training-parallel-nc-v11/news-commentary-v11.{src}-en.en",
|
@@ -282,14 +282,14 @@ _TRAIN_SUBSETS = [
|
|
282 |
name="newscommentary_v12",
|
283 |
target="en",
|
284 |
sources={"cs", "de", "ru", "zh"},
|
285 |
-
url="https://huggingface.co/datasets/wmt/wmt17/resolve/main/translation-task/training-parallel-nc-v12.
|
286 |
path=("training/news-commentary-v12.{src}-en.{src}", "training/news-commentary-v12.{src}-en.en"),
|
287 |
),
|
288 |
SubDataset(
|
289 |
name="newscommentary_v13",
|
290 |
target="en",
|
291 |
sources={"cs", "de", "ru", "zh"},
|
292 |
-
url="https://huggingface.co/datasets/wmt/wmt18/resolve/main/translation-task/training-parallel-nc-v13.
|
293 |
path=(
|
294 |
"training-parallel-nc-v13/news-commentary-v13.{src}-en.{src}",
|
295 |
"training-parallel-nc-v13/news-commentary-v13.{src}-en.en",
|
@@ -313,14 +313,14 @@ _TRAIN_SUBSETS = [
|
|
313 |
name="onlinebooks_v1",
|
314 |
target="en",
|
315 |
sources={"lv"},
|
316 |
-
url="https://huggingface.co/datasets/wmt/wmt17/resolve/main/translation-task/books.lv-en.v1.
|
317 |
path=("farewell/farewell.lv", "farewell/farewell.en"),
|
318 |
),
|
319 |
SubDataset(
|
320 |
name="paracrawl_v1",
|
321 |
target="en",
|
322 |
sources={"cs", "de", "et", "fi", "ru"},
|
323 |
-
url="https://s3.amazonaws.com/web-language-models/paracrawl/release1/paracrawl-release1.en-{src}.zipporah0-dedup-clean.tgz",
|
324 |
path=(
|
325 |
"paracrawl-release1.en-{src}.zipporah0-dedup-clean.{src}",
|
326 |
"paracrawl-release1.en-{src}.zipporah0-dedup-clean.en",
|
@@ -330,7 +330,7 @@ _TRAIN_SUBSETS = [
|
|
330 |
name="paracrawl_v1_ru",
|
331 |
target="en",
|
332 |
sources={"ru"},
|
333 |
-
url="https://s3.amazonaws.com/web-language-models/paracrawl/release1/paracrawl-release1.en-ru.zipporah0-dedup-clean.tgz",
|
334 |
path=(
|
335 |
"paracrawl-release1.en-ru.zipporah0-dedup-clean.ru",
|
336 |
"paracrawl-release1.en-ru.zipporah0-dedup-clean.en",
|
@@ -357,7 +357,7 @@ _TRAIN_SUBSETS = [
|
|
357 |
name="rapid_2016",
|
358 |
target="en",
|
359 |
sources={"de", "et", "fi"},
|
360 |
-
url="https://huggingface.co/datasets/wmt/wmt18/resolve/main/translation-task/rapid2016.
|
361 |
path=("rapid2016.{0}-{1}.{src}", "rapid2016.{0}-{1}.en"),
|
362 |
),
|
363 |
SubDataset(
|
@@ -385,21 +385,21 @@ _TRAIN_SUBSETS = [
|
|
385 |
name="uncorpus_v1",
|
386 |
target="en",
|
387 |
sources={"ru", "zh"},
|
388 |
-
url="https://huggingface.co/datasets/wmt/uncorpus/resolve/main/UNv1.0.en-{src}.
|
389 |
path=("en-{src}/UNv1.0.en-{src}.{src}", "en-{src}/UNv1.0.en-{src}.en"),
|
390 |
),
|
391 |
SubDataset(
|
392 |
name="wikiheadlines_fi",
|
393 |
target="en",
|
394 |
sources={"fi"},
|
395 |
-
url="https://huggingface.co/datasets/wmt/wmt15/resolve/main/wiki-titles.
|
396 |
path="wiki/fi-en/titles.fi-en",
|
397 |
),
|
398 |
SubDataset(
|
399 |
name="wikiheadlines_hi",
|
400 |
target="en",
|
401 |
sources={"hi"},
|
402 |
-
url="https://huggingface.co/datasets/wmt/wmt14/resolve/main/wiki-titles.
|
403 |
path="wiki/hi-en/wiki-titles.hi-en",
|
404 |
),
|
405 |
SubDataset(
|
@@ -407,7 +407,7 @@ _TRAIN_SUBSETS = [
|
|
407 |
name="wikiheadlines_ru",
|
408 |
target="en",
|
409 |
sources={"ru"},
|
410 |
-
url="https://huggingface.co/datasets/wmt/wmt15/resolve/main/wiki-titles.
|
411 |
path="wiki/ru-en/wiki.ru-en",
|
412 |
),
|
413 |
SubDataset(
|
@@ -431,7 +431,7 @@ _TRAIN_SUBSETS = [
|
|
431 |
name=ss,
|
432 |
target="en",
|
433 |
sources={"zh"},
|
434 |
-
url="
|
435 |
path=("%s/*_c[hn].txt" % ss, "%s/*_en.txt" % ss),
|
436 |
)
|
437 |
for ss in CWMT_SUBSET_NAMES
|
@@ -442,175 +442,175 @@ _DEV_SUBSETS = [
|
|
442 |
name="euelections_dev2019",
|
443 |
target="de",
|
444 |
sources={"fr"},
|
445 |
-
url="https://huggingface.co/datasets/wmt/wmt19/resolve/main/translation-task/dev.
|
446 |
path=("dev/euelections_dev2019.fr-de.src.fr", "dev/euelections_dev2019.fr-de.tgt.de"),
|
447 |
),
|
448 |
SubDataset(
|
449 |
name="newsdev2014",
|
450 |
target="en",
|
451 |
sources={"hi"},
|
452 |
-
url="https://huggingface.co/datasets/wmt/wmt19/resolve/main/translation-task/dev.
|
453 |
path=("dev/newsdev2014.hi", "dev/newsdev2014.en"),
|
454 |
),
|
455 |
SubDataset(
|
456 |
name="newsdev2015",
|
457 |
target="en",
|
458 |
sources={"fi"},
|
459 |
-
url="https://huggingface.co/datasets/wmt/wmt19/resolve/main/translation-task/dev.
|
460 |
path=("dev/newsdev2015-fien-src.{src}.sgm", "dev/newsdev2015-fien-ref.en.sgm"),
|
461 |
),
|
462 |
SubDataset(
|
463 |
name="newsdiscussdev2015",
|
464 |
target="en",
|
465 |
sources={"ro", "tr"},
|
466 |
-
url="https://huggingface.co/datasets/wmt/wmt19/resolve/main/translation-task/dev.
|
467 |
path=("dev/newsdiscussdev2015-{src}en-src.{src}.sgm", "dev/newsdiscussdev2015-{src}en-ref.en.sgm"),
|
468 |
),
|
469 |
SubDataset(
|
470 |
name="newsdev2016",
|
471 |
target="en",
|
472 |
sources={"ro", "tr"},
|
473 |
-
url="https://huggingface.co/datasets/wmt/wmt19/resolve/main/translation-task/dev.
|
474 |
path=("dev/newsdev2016-{src}en-src.{src}.sgm", "dev/newsdev2016-{src}en-ref.en.sgm"),
|
475 |
),
|
476 |
SubDataset(
|
477 |
name="newsdev2017",
|
478 |
target="en",
|
479 |
sources={"lv", "zh"},
|
480 |
-
url="https://huggingface.co/datasets/wmt/wmt19/resolve/main/translation-task/dev.
|
481 |
path=("dev/newsdev2017-{src}en-src.{src}.sgm", "dev/newsdev2017-{src}en-ref.en.sgm"),
|
482 |
),
|
483 |
SubDataset(
|
484 |
name="newsdev2018",
|
485 |
target="en",
|
486 |
sources={"et"},
|
487 |
-
url="https://huggingface.co/datasets/wmt/wmt19/resolve/main/translation-task/dev.
|
488 |
path=("dev/newsdev2018-{src}en-src.{src}.sgm", "dev/newsdev2018-{src}en-ref.en.sgm"),
|
489 |
),
|
490 |
SubDataset(
|
491 |
name="newsdev2019",
|
492 |
target="en",
|
493 |
sources={"gu", "kk", "lt"},
|
494 |
-
url="https://huggingface.co/datasets/wmt/wmt19/resolve/main/translation-task/dev.
|
495 |
path=("dev/newsdev2019-{src}en-src.{src}.sgm", "dev/newsdev2019-{src}en-ref.en.sgm"),
|
496 |
),
|
497 |
SubDataset(
|
498 |
name="newsdiscussdev2015",
|
499 |
target="en",
|
500 |
sources={"fr"},
|
501 |
-
url="https://huggingface.co/datasets/wmt/wmt19/resolve/main/translation-task/dev.
|
502 |
path=("dev/newsdiscussdev2015-{src}en-src.{src}.sgm", "dev/newsdiscussdev2015-{src}en-ref.en.sgm"),
|
503 |
),
|
504 |
SubDataset(
|
505 |
name="newsdiscusstest2015",
|
506 |
target="en",
|
507 |
sources={"fr"},
|
508 |
-
url="https://huggingface.co/datasets/wmt/wmt19/resolve/main/translation-task/dev.
|
509 |
path=("dev/newsdiscusstest2015-{src}en-src.{src}.sgm", "dev/newsdiscusstest2015-{src}en-ref.en.sgm"),
|
510 |
),
|
511 |
SubDataset(
|
512 |
name="newssyscomb2009",
|
513 |
target="en",
|
514 |
sources={"cs", "de", "es", "fr"},
|
515 |
-
url="https://huggingface.co/datasets/wmt/wmt19/resolve/main/translation-task/dev.
|
516 |
path=("dev/newssyscomb2009.{src}", "dev/newssyscomb2009.en"),
|
517 |
),
|
518 |
SubDataset(
|
519 |
name="newstest2008",
|
520 |
target="en",
|
521 |
sources={"cs", "de", "es", "fr", "hu"},
|
522 |
-
url="https://huggingface.co/datasets/wmt/wmt19/resolve/main/translation-task/dev.
|
523 |
path=("dev/news-test2008.{src}", "dev/news-test2008.en"),
|
524 |
),
|
525 |
SubDataset(
|
526 |
name="newstest2009",
|
527 |
target="en",
|
528 |
sources={"cs", "de", "es", "fr"},
|
529 |
-
url="https://huggingface.co/datasets/wmt/wmt19/resolve/main/translation-task/dev.
|
530 |
path=("dev/newstest2009.{src}", "dev/newstest2009.en"),
|
531 |
),
|
532 |
SubDataset(
|
533 |
name="newstest2010",
|
534 |
target="en",
|
535 |
sources={"cs", "de", "es", "fr"},
|
536 |
-
url="https://huggingface.co/datasets/wmt/wmt19/resolve/main/translation-task/dev.
|
537 |
path=("dev/newstest2010.{src}", "dev/newstest2010.en"),
|
538 |
),
|
539 |
SubDataset(
|
540 |
name="newstest2011",
|
541 |
target="en",
|
542 |
sources={"cs", "de", "es", "fr"},
|
543 |
-
url="https://huggingface.co/datasets/wmt/wmt19/resolve/main/translation-task/dev.
|
544 |
path=("dev/newstest2011.{src}", "dev/newstest2011.en"),
|
545 |
),
|
546 |
SubDataset(
|
547 |
name="newstest2012",
|
548 |
target="en",
|
549 |
sources={"cs", "de", "es", "fr", "ru"},
|
550 |
-
url="https://huggingface.co/datasets/wmt/wmt19/resolve/main/translation-task/dev.
|
551 |
path=("dev/newstest2012.{src}", "dev/newstest2012.en"),
|
552 |
),
|
553 |
SubDataset(
|
554 |
name="newstest2013",
|
555 |
target="en",
|
556 |
sources={"cs", "de", "es", "fr", "ru"},
|
557 |
-
url="https://huggingface.co/datasets/wmt/wmt19/resolve/main/translation-task/dev.
|
558 |
path=("dev/newstest2013.{src}", "dev/newstest2013.en"),
|
559 |
),
|
560 |
SubDataset(
|
561 |
name="newstest2014",
|
562 |
target="en",
|
563 |
sources={"cs", "de", "es", "fr", "hi", "ru"},
|
564 |
-
url="https://huggingface.co/datasets/wmt/wmt19/resolve/main/translation-task/dev.
|
565 |
path=("dev/newstest2014-{src}en-src.{src}.sgm", "dev/newstest2014-{src}en-ref.en.sgm"),
|
566 |
),
|
567 |
SubDataset(
|
568 |
name="newstest2015",
|
569 |
target="en",
|
570 |
sources={"cs", "de", "fi", "ru"},
|
571 |
-
url="https://huggingface.co/datasets/wmt/wmt19/resolve/main/translation-task/dev.
|
572 |
path=("dev/newstest2015-{src}en-src.{src}.sgm", "dev/newstest2015-{src}en-ref.en.sgm"),
|
573 |
),
|
574 |
SubDataset(
|
575 |
name="newsdiscusstest2015",
|
576 |
target="en",
|
577 |
sources={"fr"},
|
578 |
-
url="https://huggingface.co/datasets/wmt/wmt19/resolve/main/translation-task/dev.
|
579 |
path=("dev/newsdiscusstest2015-{src}en-src.{src}.sgm", "dev/newsdiscusstest2015-{src}en-ref.en.sgm"),
|
580 |
),
|
581 |
SubDataset(
|
582 |
name="newstest2016",
|
583 |
target="en",
|
584 |
sources={"cs", "de", "fi", "ro", "ru", "tr"},
|
585 |
-
url="https://huggingface.co/datasets/wmt/wmt19/resolve/main/translation-task/dev.
|
586 |
path=("dev/newstest2016-{src}en-src.{src}.sgm", "dev/newstest2016-{src}en-ref.en.sgm"),
|
587 |
),
|
588 |
SubDataset(
|
589 |
name="newstestB2016",
|
590 |
target="en",
|
591 |
sources={"fi"},
|
592 |
-
url="https://huggingface.co/datasets/wmt/wmt19/resolve/main/translation-task/dev.
|
593 |
path=("dev/newstestB2016-enfi-ref.{src}.sgm", "dev/newstestB2016-enfi-src.en.sgm"),
|
594 |
),
|
595 |
SubDataset(
|
596 |
name="newstest2017",
|
597 |
target="en",
|
598 |
sources={"cs", "de", "fi", "lv", "ru", "tr", "zh"},
|
599 |
-
url="https://huggingface.co/datasets/wmt/wmt19/resolve/main/translation-task/dev.
|
600 |
path=("dev/newstest2017-{src}en-src.{src}.sgm", "dev/newstest2017-{src}en-ref.en.sgm"),
|
601 |
),
|
602 |
SubDataset(
|
603 |
name="newstestB2017",
|
604 |
target="en",
|
605 |
sources={"fi"},
|
606 |
-
url="https://huggingface.co/datasets/wmt/wmt19/resolve/main/translation-task/dev.
|
607 |
path=("dev/newstestB2017-fien-src.fi.sgm", "dev/newstestB2017-fien-ref.en.sgm"),
|
608 |
),
|
609 |
SubDataset(
|
610 |
name="newstest2018",
|
611 |
target="en",
|
612 |
sources={"cs", "de", "et", "fi", "ru", "tr", "zh"},
|
613 |
-
url="https://huggingface.co/datasets/wmt/wmt19/resolve/main/translation-task/dev.
|
614 |
path=("dev/newstest2018-{src}en-src.{src}.sgm", "dev/newstest2018-{src}en-ref.en.sgm"),
|
615 |
),
|
616 |
]
|
@@ -658,9 +658,7 @@ class WmtConfig(datasets.BuilderConfig):
|
|
658 |
# TODO(PVP): remove when manual dir works
|
659 |
# +++++++++++++++++++++
|
660 |
if language_pair[1] in ["cs", "hi", "ru"]:
|
661 |
-
assert NotImplementedError(
|
662 |
-
"The dataset for {}-en is currently not fully supported.".format(language_pair[1])
|
663 |
-
)
|
664 |
# +++++++++++++++++++++
|
665 |
|
666 |
|
@@ -730,7 +728,7 @@ class Wmt(ABC, datasets.GeneratorBasedBuilder):
|
|
730 |
if dataset.get_manual_dl_files(source):
|
731 |
# TODO(PVP): following two lines skip configs that are incomplete for now
|
732 |
# +++++++++++++++++++++
|
733 |
-
logger.info("Skipping {} for now. Incomplete dataset for {
|
734 |
continue
|
735 |
# +++++++++++++++++++++
|
736 |
|
@@ -741,9 +739,7 @@ class Wmt(ABC, datasets.GeneratorBasedBuilder):
|
|
741 |
]
|
742 |
assert all(
|
743 |
os.path.exists(path) for path in manual_paths
|
744 |
-
), "For {
|
745 |
-
dataset.name, dataset.get_url(source), dl_manager.manual_dir, ", ".join(manual_dl_files)
|
746 |
-
)
|
747 |
|
748 |
# set manual path for correct subset
|
749 |
manual_paths_dict[ss_name] = manual_paths
|
@@ -779,24 +775,36 @@ class Wmt(ABC, datasets.GeneratorBasedBuilder):
|
|
779 |
for ex_dir, rel_path in zip(extract_dirs, rel_paths)
|
780 |
]
|
781 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
782 |
for ss_name in split_subsets:
|
783 |
# TODO(PVP) remove following five lines when manual data works
|
784 |
# +++++++++++++++++++++
|
785 |
dataset = DATASET_MAP[ss_name]
|
786 |
source, _ = self.config.language_pair
|
787 |
if dataset.get_manual_dl_files(source):
|
788 |
-
logger.info("Skipping {} for now. Incomplete dataset for {
|
789 |
continue
|
790 |
# +++++++++++++++++++++
|
791 |
|
792 |
logger.info("Generating examples from: %s", ss_name)
|
|
|
793 |
dataset = DATASET_MAP[ss_name]
|
794 |
extract_dirs = extraction_map[ss_name]
|
795 |
files = _get_local_paths(dataset, extract_dirs)
|
|
|
|
|
|
|
796 |
|
797 |
if ss_name.startswith("czeng"):
|
798 |
if ss_name.endswith("16pre"):
|
799 |
sub_generator = functools.partial(_parse_tsv, language_pair=("en", "cs"))
|
|
|
800 |
elif ss_name.endswith("17"):
|
801 |
filter_path = _get_local_paths(_CZENG17_FILTER, extraction_map[_CZENG17_FILTER.name])[0]
|
802 |
sub_generator = functools.partial(_parse_czeng, filter_path=filter_path)
|
@@ -809,18 +817,21 @@ class Wmt(ABC, datasets.GeneratorBasedBuilder):
|
|
809 |
sub_generator = _parse_frde_bitext
|
810 |
else:
|
811 |
sub_generator = _parse_parallel_sentences
|
|
|
812 |
elif len(files) == 1:
|
813 |
-
fname =
|
814 |
# Note: Due to formatting used by `download_manager`, the file
|
815 |
# extension may not be at the end of the file path.
|
816 |
if ".tsv" in fname:
|
817 |
sub_generator = _parse_tsv
|
|
|
818 |
elif (
|
819 |
ss_name.startswith("newscommentary_v14")
|
820 |
or ss_name.startswith("europarl_v9")
|
821 |
or ss_name.startswith("wikititles_v1")
|
822 |
):
|
823 |
sub_generator = functools.partial(_parse_tsv, language_pair=self.config.language_pair)
|
|
|
824 |
elif "tmx" in fname or ss_name.startswith("paracrawl_v3"):
|
825 |
sub_generator = _parse_tmx
|
826 |
elif ss_name.startswith("wikiheadlines"):
|
@@ -830,28 +841,33 @@ class Wmt(ABC, datasets.GeneratorBasedBuilder):
|
|
830 |
else:
|
831 |
raise ValueError("Invalid number of files: %d" % len(files))
|
832 |
|
833 |
-
for sub_key, ex in sub_generator(*
|
834 |
if not all(ex.values()):
|
835 |
continue
|
836 |
# TODO(adarob): Add subset feature.
|
837 |
# ex["subset"] = subset
|
838 |
-
key = "{}/{}"
|
839 |
if with_translation is True:
|
840 |
ex = {"translation": ex}
|
841 |
yield key, ex
|
842 |
|
843 |
|
844 |
-
def _parse_parallel_sentences(f1, f2):
|
845 |
"""Returns examples from parallel SGML or text files, which may be gzipped."""
|
846 |
|
847 |
-
def _parse_text(path):
|
848 |
"""Returns the sentences from a single text file, which may be gzipped."""
|
849 |
-
split_path =
|
850 |
|
851 |
if split_path[-1] == "gz":
|
852 |
lang = split_path[-2]
|
853 |
-
|
854 |
-
|
|
|
|
|
|
|
|
|
|
|
855 |
|
856 |
if split_path[-1] == "txt":
|
857 |
# CWMT
|
@@ -859,25 +875,32 @@ def _parse_parallel_sentences(f1, f2):
|
|
859 |
lang = "zh" if lang in ("ch", "cn") else lang
|
860 |
else:
|
861 |
lang = split_path[-1]
|
862 |
-
with open(path, "rb") as f:
|
863 |
-
return f.read().decode("utf-8").split("\n"), lang
|
864 |
|
865 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
866 |
"""Returns sentences from a single SGML file."""
|
867 |
-
lang =
|
868 |
-
sentences = []
|
869 |
# Note: We can't use the XML parser since some of the files are badly
|
870 |
# formatted.
|
871 |
seg_re = re.compile(r"<seg id=\"\d+\">(.*)</seg>")
|
872 |
-
with open(path, encoding="utf-8") as f:
|
873 |
-
for line in f:
|
874 |
-
seg_match = re.match(seg_re, line)
|
875 |
-
if seg_match:
|
876 |
-
assert len(seg_match.groups()) == 1
|
877 |
-
sentences.append(seg_match.groups()[0])
|
878 |
-
return sentences, lang
|
879 |
|
880 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
881 |
|
882 |
# Some datasets (e.g., CWMT) contain multiple parallel files specified with
|
883 |
# a wildcard. We sort both sets to align them and parse them one by one.
|
@@ -893,34 +916,19 @@ def _parse_parallel_sentences(f1, f2):
|
|
893 |
)
|
894 |
|
895 |
for f_id, (f1_i, f2_i) in enumerate(zip(sorted(f1_files), sorted(f2_files))):
|
896 |
-
l1_sentences, l1 = parse_file(f1_i)
|
897 |
-
l2_sentences, l2 = parse_file(f2_i)
|
898 |
-
|
899 |
-
assert len(l1_sentences) == len(l2_sentences), "Sizes do not match: %d vs %d for %s vs %s." % (
|
900 |
-
len(l1_sentences),
|
901 |
-
len(l2_sentences),
|
902 |
-
f1_i,
|
903 |
-
f2_i,
|
904 |
-
)
|
905 |
|
906 |
for line_id, (s1, s2) in enumerate(zip(l1_sentences, l2_sentences)):
|
907 |
-
key = "{}/{}"
|
908 |
yield key, {l1: s1, l2: s2}
|
909 |
|
910 |
|
911 |
def _parse_frde_bitext(fr_path, de_path):
|
912 |
-
with open(fr_path, encoding="utf-8") as
|
913 |
-
|
914 |
-
|
915 |
-
|
916 |
-
assert len(fr_sentences) == len(de_sentences), "Sizes do not match: %d vs %d for %s vs %s." % (
|
917 |
-
len(fr_sentences),
|
918 |
-
len(de_sentences),
|
919 |
-
fr_path,
|
920 |
-
de_path,
|
921 |
-
)
|
922 |
-
for line_id, (s1, s2) in enumerate(zip(fr_sentences, de_sentences)):
|
923 |
-
yield line_id, {"fr": s1, "de": s2}
|
924 |
|
925 |
|
926 |
def _parse_tmx(path):
|
@@ -946,11 +954,11 @@ def _parse_tmx(path):
|
|
946 |
elem.clear()
|
947 |
|
948 |
|
949 |
-
def _parse_tsv(path, language_pair=None):
|
950 |
"""Generates examples from TSV file."""
|
951 |
if language_pair is None:
|
952 |
-
lang_match = re.match(r".*\.([a-z][a-z])-([a-z][a-z])\.tsv",
|
953 |
-
assert lang_match is not None, "Invalid TSV filename: %s" %
|
954 |
l1, l2 = lang_match.groups()
|
955 |
else:
|
956 |
l1, l2 = language_pair
|
@@ -997,7 +1005,7 @@ def _parse_czeng(*paths, **kwargs):
|
|
997 |
block_match = re.match(re_block, id_)
|
998 |
if block_match and block_match.groups()[0] in bad_blocks:
|
999 |
continue
|
1000 |
-
sub_key = "{}/{}"
|
1001 |
yield sub_key, {
|
1002 |
"cs": cs.strip(),
|
1003 |
"en": en.strip(),
|
|
|
96 |
def _inject_language(self, src, strings):
|
97 |
"""Injects languages into (potentially) template strings."""
|
98 |
if src not in self.sources:
|
99 |
+
raise ValueError(f"Invalid source for '{self.name}': {src}")
|
100 |
|
101 |
def _format_string(s):
|
102 |
if "{0}" in s and "{1}" and "{src}" in s:
|
|
|
127 |
name="commoncrawl",
|
128 |
target="en", # fr-de pair in commoncrawl_frde
|
129 |
sources={"cs", "de", "es", "fr", "ru"},
|
130 |
+
url="https://huggingface.co/datasets/wmt/wmt13/resolve/main-zip/training-parallel-commoncrawl.zip",
|
131 |
path=("commoncrawl.{src}-en.{src}", "commoncrawl.{src}-en.en"),
|
132 |
),
|
133 |
SubDataset(
|
|
|
184 |
name="dcep_v1",
|
185 |
target="en",
|
186 |
sources={"lv"},
|
187 |
+
url="https://huggingface.co/datasets/wmt/wmt17/resolve/main-zip/translation-task/dcep.lv-en.v1.zip",
|
188 |
path=("dcep.en-lv/dcep.lv", "dcep.en-lv/dcep.en"),
|
189 |
),
|
190 |
SubDataset(
|
191 |
name="europarl_v7",
|
192 |
target="en",
|
193 |
sources={"cs", "de", "es", "fr"},
|
194 |
+
url="https://huggingface.co/datasets/wmt/wmt13/resolve/main-zip/training-parallel-europarl-v7.zip",
|
195 |
path=("training/europarl-v7.{src}-en.{src}", "training/europarl-v7.{src}-en.en"),
|
196 |
),
|
197 |
SubDataset(
|
|
|
208 |
name="europarl_v8_18",
|
209 |
target="en",
|
210 |
sources={"et", "fi"},
|
211 |
+
url="https://huggingface.co/datasets/wmt/wmt18/resolve/main-zip/translation-task/training-parallel-ep-v8.zip",
|
212 |
path=("training/europarl-v8.{src}-en.{src}", "training/europarl-v8.{src}-en.en"),
|
213 |
),
|
214 |
SubDataset(
|
215 |
name="europarl_v8_16",
|
216 |
target="en",
|
217 |
sources={"fi", "ro"},
|
218 |
+
url="https://huggingface.co/datasets/wmt/wmt16/resolve/main-zip/translation-task/training-parallel-ep-v8.zip",
|
219 |
path=("training-parallel-ep-v8/europarl-v8.{src}-en.{src}", "training-parallel-ep-v8/europarl-v8.{src}-en.en"),
|
220 |
),
|
221 |
SubDataset(
|
|
|
229 |
name="gigafren",
|
230 |
target="en",
|
231 |
sources={"fr"},
|
232 |
+
url="https://huggingface.co/datasets/wmt/wmt10/resolve/main-zip/training-giga-fren.zip",
|
233 |
path=("giga-fren.release2.fixed.fr.gz", "giga-fren.release2.fixed.en.gz"),
|
234 |
),
|
235 |
SubDataset(
|
|
|
244 |
name="leta_v1",
|
245 |
target="en",
|
246 |
sources={"lv"},
|
247 |
+
url="https://huggingface.co/datasets/wmt/wmt17/resolve/main-zip/translation-task/leta.v1.zip",
|
248 |
path=("LETA-lv-en/leta.lv", "LETA-lv-en/leta.en"),
|
249 |
),
|
250 |
SubDataset(
|
251 |
name="multiun",
|
252 |
target="en",
|
253 |
sources={"es", "fr"},
|
254 |
+
url="https://huggingface.co/datasets/wmt/wmt13/resolve/main-zip/training-parallel-un.zip",
|
255 |
path=("un/undoc.2000.{src}-en.{src}", "un/undoc.2000.{src}-en.en"),
|
256 |
),
|
257 |
SubDataset(
|
258 |
name="newscommentary_v9",
|
259 |
target="en",
|
260 |
sources={"cs", "de", "fr", "ru"},
|
261 |
+
url="https://huggingface.co/datasets/wmt/wmt14/resolve/main-zip/training-parallel-nc-v9.zip",
|
262 |
path=("training/news-commentary-v9.{src}-en.{src}", "training/news-commentary-v9.{src}-en.en"),
|
263 |
),
|
264 |
SubDataset(
|
265 |
name="newscommentary_v10",
|
266 |
target="en",
|
267 |
sources={"cs", "de", "fr", "ru"},
|
268 |
+
url="https://huggingface.co/datasets/wmt/wmt15/resolve/main-zip/training-parallel-nc-v10.zip",
|
269 |
path=("news-commentary-v10.{src}-en.{src}", "news-commentary-v10.{src}-en.en"),
|
270 |
),
|
271 |
SubDataset(
|
272 |
name="newscommentary_v11",
|
273 |
target="en",
|
274 |
sources={"cs", "de", "ru"},
|
275 |
+
url="https://huggingface.co/datasets/wmt/wmt16/resolve/main-zip/translation-task/training-parallel-nc-v11.zip",
|
276 |
path=(
|
277 |
"training-parallel-nc-v11/news-commentary-v11.{src}-en.{src}",
|
278 |
"training-parallel-nc-v11/news-commentary-v11.{src}-en.en",
|
|
|
282 |
name="newscommentary_v12",
|
283 |
target="en",
|
284 |
sources={"cs", "de", "ru", "zh"},
|
285 |
+
url="https://huggingface.co/datasets/wmt/wmt17/resolve/main-zip/translation-task/training-parallel-nc-v12.zip",
|
286 |
path=("training/news-commentary-v12.{src}-en.{src}", "training/news-commentary-v12.{src}-en.en"),
|
287 |
),
|
288 |
SubDataset(
|
289 |
name="newscommentary_v13",
|
290 |
target="en",
|
291 |
sources={"cs", "de", "ru", "zh"},
|
292 |
+
url="https://huggingface.co/datasets/wmt/wmt18/resolve/main-zip/translation-task/training-parallel-nc-v13.zip",
|
293 |
path=(
|
294 |
"training-parallel-nc-v13/news-commentary-v13.{src}-en.{src}",
|
295 |
"training-parallel-nc-v13/news-commentary-v13.{src}-en.en",
|
|
|
313 |
name="onlinebooks_v1",
|
314 |
target="en",
|
315 |
sources={"lv"},
|
316 |
+
url="https://huggingface.co/datasets/wmt/wmt17/resolve/main-zip/translation-task/books.lv-en.v1.zip",
|
317 |
path=("farewell/farewell.lv", "farewell/farewell.en"),
|
318 |
),
|
319 |
SubDataset(
|
320 |
name="paracrawl_v1",
|
321 |
target="en",
|
322 |
sources={"cs", "de", "et", "fi", "ru"},
|
323 |
+
url="https://s3.amazonaws.com/web-language-models/paracrawl/release1/paracrawl-release1.en-{src}.zipporah0-dedup-clean.tgz", # TODO(QL): use gzip for streaming
|
324 |
path=(
|
325 |
"paracrawl-release1.en-{src}.zipporah0-dedup-clean.{src}",
|
326 |
"paracrawl-release1.en-{src}.zipporah0-dedup-clean.en",
|
|
|
330 |
name="paracrawl_v1_ru",
|
331 |
target="en",
|
332 |
sources={"ru"},
|
333 |
+
url="https://s3.amazonaws.com/web-language-models/paracrawl/release1/paracrawl-release1.en-ru.zipporah0-dedup-clean.tgz", # TODO(QL): use gzip for streaming
|
334 |
path=(
|
335 |
"paracrawl-release1.en-ru.zipporah0-dedup-clean.ru",
|
336 |
"paracrawl-release1.en-ru.zipporah0-dedup-clean.en",
|
|
|
357 |
name="rapid_2016",
|
358 |
target="en",
|
359 |
sources={"de", "et", "fi"},
|
360 |
+
url="https://huggingface.co/datasets/wmt/wmt18/resolve/main-zip/translation-task/rapid2016.zip",
|
361 |
path=("rapid2016.{0}-{1}.{src}", "rapid2016.{0}-{1}.en"),
|
362 |
),
|
363 |
SubDataset(
|
|
|
385 |
name="uncorpus_v1",
|
386 |
target="en",
|
387 |
sources={"ru", "zh"},
|
388 |
+
url="https://huggingface.co/datasets/wmt/uncorpus/resolve/main-zip/UNv1.0.en-{src}.zip",
|
389 |
path=("en-{src}/UNv1.0.en-{src}.{src}", "en-{src}/UNv1.0.en-{src}.en"),
|
390 |
),
|
391 |
SubDataset(
|
392 |
name="wikiheadlines_fi",
|
393 |
target="en",
|
394 |
sources={"fi"},
|
395 |
+
url="https://huggingface.co/datasets/wmt/wmt15/resolve/main-zip/wiki-titles.zip",
|
396 |
path="wiki/fi-en/titles.fi-en",
|
397 |
),
|
398 |
SubDataset(
|
399 |
name="wikiheadlines_hi",
|
400 |
target="en",
|
401 |
sources={"hi"},
|
402 |
+
url="https://huggingface.co/datasets/wmt/wmt14/resolve/main-zip/wiki-titles.zip",
|
403 |
path="wiki/hi-en/wiki-titles.hi-en",
|
404 |
),
|
405 |
SubDataset(
|
|
|
407 |
name="wikiheadlines_ru",
|
408 |
target="en",
|
409 |
sources={"ru"},
|
410 |
+
url="https://huggingface.co/datasets/wmt/wmt15/resolve/main-zip/wiki-titles.zip",
|
411 |
path="wiki/ru-en/wiki.ru-en",
|
412 |
),
|
413 |
SubDataset(
|
|
|
431 |
name=ss,
|
432 |
target="en",
|
433 |
sources={"zh"},
|
434 |
+
url="https://huggingface.co/datasets/wmt/wmt18/resolve/main/cwmt-wmt/%s.zip" % ss,
|
435 |
path=("%s/*_c[hn].txt" % ss, "%s/*_en.txt" % ss),
|
436 |
)
|
437 |
for ss in CWMT_SUBSET_NAMES
|
|
|
442 |
name="euelections_dev2019",
|
443 |
target="de",
|
444 |
sources={"fr"},
|
445 |
+
url="https://huggingface.co/datasets/wmt/wmt19/resolve/main-zip/translation-task/dev.zip",
|
446 |
path=("dev/euelections_dev2019.fr-de.src.fr", "dev/euelections_dev2019.fr-de.tgt.de"),
|
447 |
),
|
448 |
SubDataset(
|
449 |
name="newsdev2014",
|
450 |
target="en",
|
451 |
sources={"hi"},
|
452 |
+
url="https://huggingface.co/datasets/wmt/wmt19/resolve/main-zip/translation-task/dev.zip",
|
453 |
path=("dev/newsdev2014.hi", "dev/newsdev2014.en"),
|
454 |
),
|
455 |
SubDataset(
|
456 |
name="newsdev2015",
|
457 |
target="en",
|
458 |
sources={"fi"},
|
459 |
+
url="https://huggingface.co/datasets/wmt/wmt19/resolve/main-zip/translation-task/dev.zip",
|
460 |
path=("dev/newsdev2015-fien-src.{src}.sgm", "dev/newsdev2015-fien-ref.en.sgm"),
|
461 |
),
|
462 |
SubDataset(
|
463 |
name="newsdiscussdev2015",
|
464 |
target="en",
|
465 |
sources={"ro", "tr"},
|
466 |
+
url="https://huggingface.co/datasets/wmt/wmt19/resolve/main-zip/translation-task/dev.zip",
|
467 |
path=("dev/newsdiscussdev2015-{src}en-src.{src}.sgm", "dev/newsdiscussdev2015-{src}en-ref.en.sgm"),
|
468 |
),
|
469 |
SubDataset(
|
470 |
name="newsdev2016",
|
471 |
target="en",
|
472 |
sources={"ro", "tr"},
|
473 |
+
url="https://huggingface.co/datasets/wmt/wmt19/resolve/main-zip/translation-task/dev.zip",
|
474 |
path=("dev/newsdev2016-{src}en-src.{src}.sgm", "dev/newsdev2016-{src}en-ref.en.sgm"),
|
475 |
),
|
476 |
SubDataset(
|
477 |
name="newsdev2017",
|
478 |
target="en",
|
479 |
sources={"lv", "zh"},
|
480 |
+
url="https://huggingface.co/datasets/wmt/wmt19/resolve/main-zip/translation-task/dev.zip",
|
481 |
path=("dev/newsdev2017-{src}en-src.{src}.sgm", "dev/newsdev2017-{src}en-ref.en.sgm"),
|
482 |
),
|
483 |
SubDataset(
|
484 |
name="newsdev2018",
|
485 |
target="en",
|
486 |
sources={"et"},
|
487 |
+
url="https://huggingface.co/datasets/wmt/wmt19/resolve/main-zip/translation-task/dev.zip",
|
488 |
path=("dev/newsdev2018-{src}en-src.{src}.sgm", "dev/newsdev2018-{src}en-ref.en.sgm"),
|
489 |
),
|
490 |
SubDataset(
|
491 |
name="newsdev2019",
|
492 |
target="en",
|
493 |
sources={"gu", "kk", "lt"},
|
494 |
+
url="https://huggingface.co/datasets/wmt/wmt19/resolve/main-zip/translation-task/dev.zip",
|
495 |
path=("dev/newsdev2019-{src}en-src.{src}.sgm", "dev/newsdev2019-{src}en-ref.en.sgm"),
|
496 |
),
|
497 |
SubDataset(
|
498 |
name="newsdiscussdev2015",
|
499 |
target="en",
|
500 |
sources={"fr"},
|
501 |
+
url="https://huggingface.co/datasets/wmt/wmt19/resolve/main-zip/translation-task/dev.zip",
|
502 |
path=("dev/newsdiscussdev2015-{src}en-src.{src}.sgm", "dev/newsdiscussdev2015-{src}en-ref.en.sgm"),
|
503 |
),
|
504 |
SubDataset(
|
505 |
name="newsdiscusstest2015",
|
506 |
target="en",
|
507 |
sources={"fr"},
|
508 |
+
url="https://huggingface.co/datasets/wmt/wmt19/resolve/main-zip/translation-task/dev.zip",
|
509 |
path=("dev/newsdiscusstest2015-{src}en-src.{src}.sgm", "dev/newsdiscusstest2015-{src}en-ref.en.sgm"),
|
510 |
),
|
511 |
SubDataset(
|
512 |
name="newssyscomb2009",
|
513 |
target="en",
|
514 |
sources={"cs", "de", "es", "fr"},
|
515 |
+
url="https://huggingface.co/datasets/wmt/wmt19/resolve/main-zip/translation-task/dev.zip",
|
516 |
path=("dev/newssyscomb2009.{src}", "dev/newssyscomb2009.en"),
|
517 |
),
|
518 |
SubDataset(
|
519 |
name="newstest2008",
|
520 |
target="en",
|
521 |
sources={"cs", "de", "es", "fr", "hu"},
|
522 |
+
url="https://huggingface.co/datasets/wmt/wmt19/resolve/main-zip/translation-task/dev.zip",
|
523 |
path=("dev/news-test2008.{src}", "dev/news-test2008.en"),
|
524 |
),
|
525 |
SubDataset(
|
526 |
name="newstest2009",
|
527 |
target="en",
|
528 |
sources={"cs", "de", "es", "fr"},
|
529 |
+
url="https://huggingface.co/datasets/wmt/wmt19/resolve/main-zip/translation-task/dev.zip",
|
530 |
path=("dev/newstest2009.{src}", "dev/newstest2009.en"),
|
531 |
),
|
532 |
SubDataset(
|
533 |
name="newstest2010",
|
534 |
target="en",
|
535 |
sources={"cs", "de", "es", "fr"},
|
536 |
+
url="https://huggingface.co/datasets/wmt/wmt19/resolve/main-zip/translation-task/dev.zip",
|
537 |
path=("dev/newstest2010.{src}", "dev/newstest2010.en"),
|
538 |
),
|
539 |
SubDataset(
|
540 |
name="newstest2011",
|
541 |
target="en",
|
542 |
sources={"cs", "de", "es", "fr"},
|
543 |
+
url="https://huggingface.co/datasets/wmt/wmt19/resolve/main-zip/translation-task/dev.zip",
|
544 |
path=("dev/newstest2011.{src}", "dev/newstest2011.en"),
|
545 |
),
|
546 |
SubDataset(
|
547 |
name="newstest2012",
|
548 |
target="en",
|
549 |
sources={"cs", "de", "es", "fr", "ru"},
|
550 |
+
url="https://huggingface.co/datasets/wmt/wmt19/resolve/main-zip/translation-task/dev.zip",
|
551 |
path=("dev/newstest2012.{src}", "dev/newstest2012.en"),
|
552 |
),
|
553 |
SubDataset(
|
554 |
name="newstest2013",
|
555 |
target="en",
|
556 |
sources={"cs", "de", "es", "fr", "ru"},
|
557 |
+
url="https://huggingface.co/datasets/wmt/wmt19/resolve/main-zip/translation-task/dev.zip",
|
558 |
path=("dev/newstest2013.{src}", "dev/newstest2013.en"),
|
559 |
),
|
560 |
SubDataset(
|
561 |
name="newstest2014",
|
562 |
target="en",
|
563 |
sources={"cs", "de", "es", "fr", "hi", "ru"},
|
564 |
+
url="https://huggingface.co/datasets/wmt/wmt19/resolve/main-zip/translation-task/dev.zip",
|
565 |
path=("dev/newstest2014-{src}en-src.{src}.sgm", "dev/newstest2014-{src}en-ref.en.sgm"),
|
566 |
),
|
567 |
SubDataset(
|
568 |
name="newstest2015",
|
569 |
target="en",
|
570 |
sources={"cs", "de", "fi", "ru"},
|
571 |
+
url="https://huggingface.co/datasets/wmt/wmt19/resolve/main-zip/translation-task/dev.zip",
|
572 |
path=("dev/newstest2015-{src}en-src.{src}.sgm", "dev/newstest2015-{src}en-ref.en.sgm"),
|
573 |
),
|
574 |
SubDataset(
|
575 |
name="newsdiscusstest2015",
|
576 |
target="en",
|
577 |
sources={"fr"},
|
578 |
+
url="https://huggingface.co/datasets/wmt/wmt19/resolve/main-zip/translation-task/dev.zip",
|
579 |
path=("dev/newsdiscusstest2015-{src}en-src.{src}.sgm", "dev/newsdiscusstest2015-{src}en-ref.en.sgm"),
|
580 |
),
|
581 |
SubDataset(
|
582 |
name="newstest2016",
|
583 |
target="en",
|
584 |
sources={"cs", "de", "fi", "ro", "ru", "tr"},
|
585 |
+
url="https://huggingface.co/datasets/wmt/wmt19/resolve/main-zip/translation-task/dev.zip",
|
586 |
path=("dev/newstest2016-{src}en-src.{src}.sgm", "dev/newstest2016-{src}en-ref.en.sgm"),
|
587 |
),
|
588 |
SubDataset(
|
589 |
name="newstestB2016",
|
590 |
target="en",
|
591 |
sources={"fi"},
|
592 |
+
url="https://huggingface.co/datasets/wmt/wmt19/resolve/main-zip/translation-task/dev.zip",
|
593 |
path=("dev/newstestB2016-enfi-ref.{src}.sgm", "dev/newstestB2016-enfi-src.en.sgm"),
|
594 |
),
|
595 |
SubDataset(
|
596 |
name="newstest2017",
|
597 |
target="en",
|
598 |
sources={"cs", "de", "fi", "lv", "ru", "tr", "zh"},
|
599 |
+
url="https://huggingface.co/datasets/wmt/wmt19/resolve/main-zip/translation-task/dev.zip",
|
600 |
path=("dev/newstest2017-{src}en-src.{src}.sgm", "dev/newstest2017-{src}en-ref.en.sgm"),
|
601 |
),
|
602 |
SubDataset(
|
603 |
name="newstestB2017",
|
604 |
target="en",
|
605 |
sources={"fi"},
|
606 |
+
url="https://huggingface.co/datasets/wmt/wmt19/resolve/main-zip/translation-task/dev.zip",
|
607 |
path=("dev/newstestB2017-fien-src.fi.sgm", "dev/newstestB2017-fien-ref.en.sgm"),
|
608 |
),
|
609 |
SubDataset(
|
610 |
name="newstest2018",
|
611 |
target="en",
|
612 |
sources={"cs", "de", "et", "fi", "ru", "tr", "zh"},
|
613 |
+
url="https://huggingface.co/datasets/wmt/wmt19/resolve/main-zip/translation-task/dev.zip",
|
614 |
path=("dev/newstest2018-{src}en-src.{src}.sgm", "dev/newstest2018-{src}en-ref.en.sgm"),
|
615 |
),
|
616 |
]
|
|
|
658 |
# TODO(PVP): remove when manual dir works
|
659 |
# +++++++++++++++++++++
|
660 |
if language_pair[1] in ["cs", "hi", "ru"]:
|
661 |
+
assert NotImplementedError(f"The dataset for {language_pair[1]}-en is currently not fully supported.")
|
|
|
|
|
662 |
# +++++++++++++++++++++
|
663 |
|
664 |
|
|
|
728 |
if dataset.get_manual_dl_files(source):
|
729 |
# TODO(PVP): following two lines skip configs that are incomplete for now
|
730 |
# +++++++++++++++++++++
|
731 |
+
logger.info("Skipping {dataset.name} for now. Incomplete dataset for {self.config.name}")
|
732 |
continue
|
733 |
# +++++++++++++++++++++
|
734 |
|
|
|
739 |
]
|
740 |
assert all(
|
741 |
os.path.exists(path) for path in manual_paths
|
742 |
+
), f"For {dataset.name}, you must manually download the following file(s) from {dataset.get_url(source)} and place them in {dl_manager.manual_dir}: {', '.join(manual_dl_files)}"
|
|
|
|
|
743 |
|
744 |
# set manual path for correct subset
|
745 |
manual_paths_dict[ss_name] = manual_paths
|
|
|
775 |
for ex_dir, rel_path in zip(extract_dirs, rel_paths)
|
776 |
]
|
777 |
|
778 |
+
def _get_filenames(dataset):
|
779 |
+
rel_paths = dataset.get_path(source)
|
780 |
+
urls = dataset.get_url(source)
|
781 |
+
if len(urls) == 1:
|
782 |
+
urls = urls * len(rel_paths)
|
783 |
+
return [rel_path if rel_path else os.path.basename(url) for url, rel_path in zip(urls, rel_paths)]
|
784 |
+
|
785 |
for ss_name in split_subsets:
|
786 |
# TODO(PVP) remove following five lines when manual data works
|
787 |
# +++++++++++++++++++++
|
788 |
dataset = DATASET_MAP[ss_name]
|
789 |
source, _ = self.config.language_pair
|
790 |
if dataset.get_manual_dl_files(source):
|
791 |
+
logger.info(f"Skipping {dataset.name} for now. Incomplete dataset for {self.config.name}")
|
792 |
continue
|
793 |
# +++++++++++++++++++++
|
794 |
|
795 |
logger.info("Generating examples from: %s", ss_name)
|
796 |
+
print("Generating examples from: %s", ss_name)
|
797 |
dataset = DATASET_MAP[ss_name]
|
798 |
extract_dirs = extraction_map[ss_name]
|
799 |
files = _get_local_paths(dataset, extract_dirs)
|
800 |
+
filenames = _get_filenames(dataset)
|
801 |
+
|
802 |
+
sub_generator_args = tuple(files)
|
803 |
|
804 |
if ss_name.startswith("czeng"):
|
805 |
if ss_name.endswith("16pre"):
|
806 |
sub_generator = functools.partial(_parse_tsv, language_pair=("en", "cs"))
|
807 |
+
sub_generator_args += tuple(filenames)
|
808 |
elif ss_name.endswith("17"):
|
809 |
filter_path = _get_local_paths(_CZENG17_FILTER, extraction_map[_CZENG17_FILTER.name])[0]
|
810 |
sub_generator = functools.partial(_parse_czeng, filter_path=filter_path)
|
|
|
817 |
sub_generator = _parse_frde_bitext
|
818 |
else:
|
819 |
sub_generator = _parse_parallel_sentences
|
820 |
+
sub_generator_args += tuple(filenames)
|
821 |
elif len(files) == 1:
|
822 |
+
fname = filenames[0]
|
823 |
# Note: Due to formatting used by `download_manager`, the file
|
824 |
# extension may not be at the end of the file path.
|
825 |
if ".tsv" in fname:
|
826 |
sub_generator = _parse_tsv
|
827 |
+
sub_generator_args += tuple(filenames)
|
828 |
elif (
|
829 |
ss_name.startswith("newscommentary_v14")
|
830 |
or ss_name.startswith("europarl_v9")
|
831 |
or ss_name.startswith("wikititles_v1")
|
832 |
):
|
833 |
sub_generator = functools.partial(_parse_tsv, language_pair=self.config.language_pair)
|
834 |
+
sub_generator_args += tuple(filenames)
|
835 |
elif "tmx" in fname or ss_name.startswith("paracrawl_v3"):
|
836 |
sub_generator = _parse_tmx
|
837 |
elif ss_name.startswith("wikiheadlines"):
|
|
|
841 |
else:
|
842 |
raise ValueError("Invalid number of files: %d" % len(files))
|
843 |
|
844 |
+
for sub_key, ex in sub_generator(*sub_generator_args):
|
845 |
if not all(ex.values()):
|
846 |
continue
|
847 |
# TODO(adarob): Add subset feature.
|
848 |
# ex["subset"] = subset
|
849 |
+
key = f"{ss_name}/{sub_key}"
|
850 |
if with_translation is True:
|
851 |
ex = {"translation": ex}
|
852 |
yield key, ex
|
853 |
|
854 |
|
855 |
+
def _parse_parallel_sentences(f1, f2, filename1, filename2):
|
856 |
"""Returns examples from parallel SGML or text files, which may be gzipped."""
|
857 |
|
858 |
+
def _parse_text(path, original_filename):
|
859 |
"""Returns the sentences from a single text file, which may be gzipped."""
|
860 |
+
split_path = original_filename.split(".")
|
861 |
|
862 |
if split_path[-1] == "gz":
|
863 |
lang = split_path[-2]
|
864 |
+
|
865 |
+
def gen():
|
866 |
+
with open(path, "rb") as f, gzip.GzipFile(fileobj=f) as g:
|
867 |
+
for line in g:
|
868 |
+
yield line.decode("utf-8").rstrip()
|
869 |
+
|
870 |
+
return gen(), lang
|
871 |
|
872 |
if split_path[-1] == "txt":
|
873 |
# CWMT
|
|
|
875 |
lang = "zh" if lang in ("ch", "cn") else lang
|
876 |
else:
|
877 |
lang = split_path[-1]
|
|
|
|
|
878 |
|
879 |
+
def gen():
|
880 |
+
with open(path, "rb") as f:
|
881 |
+
for line in f:
|
882 |
+
yield line.decode("utf-8").rstrip()
|
883 |
+
|
884 |
+
return gen(), lang
|
885 |
+
|
886 |
+
def _parse_sgm(path, original_filename):
|
887 |
"""Returns sentences from a single SGML file."""
|
888 |
+
lang = original_filename.split(".")[-2]
|
|
|
889 |
# Note: We can't use the XML parser since some of the files are badly
|
890 |
# formatted.
|
891 |
seg_re = re.compile(r"<seg id=\"\d+\">(.*)</seg>")
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
892 |
|
893 |
+
def gen():
|
894 |
+
with open(path, encoding="utf-8") as f:
|
895 |
+
for line in f:
|
896 |
+
seg_match = re.match(seg_re, line)
|
897 |
+
if seg_match:
|
898 |
+
assert len(seg_match.groups()) == 1
|
899 |
+
yield seg_match.groups()[0]
|
900 |
+
|
901 |
+
return gen(), lang
|
902 |
+
|
903 |
+
parse_file = _parse_sgm if os.path.basename(f1).endswith(".sgm") else _parse_text
|
904 |
|
905 |
# Some datasets (e.g., CWMT) contain multiple parallel files specified with
|
906 |
# a wildcard. We sort both sets to align them and parse them one by one.
|
|
|
916 |
)
|
917 |
|
918 |
for f_id, (f1_i, f2_i) in enumerate(zip(sorted(f1_files), sorted(f2_files))):
|
919 |
+
l1_sentences, l1 = parse_file(f1_i, filename1)
|
920 |
+
l2_sentences, l2 = parse_file(f2_i, filename2)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
921 |
|
922 |
for line_id, (s1, s2) in enumerate(zip(l1_sentences, l2_sentences)):
|
923 |
+
key = f"{f_id}/{line_id}"
|
924 |
yield key, {l1: s1, l2: s2}
|
925 |
|
926 |
|
927 |
def _parse_frde_bitext(fr_path, de_path):
|
928 |
+
with open(fr_path, encoding="utf-8") as fr_f:
|
929 |
+
with open(de_path, encoding="utf-8") as de_f:
|
930 |
+
for line_id, (s1, s2) in enumerate(zip(fr_f, de_f)):
|
931 |
+
yield line_id, {"fr": s1.rstrip(), "de": s2.rstrip()}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
932 |
|
933 |
|
934 |
def _parse_tmx(path):
|
|
|
954 |
elem.clear()
|
955 |
|
956 |
|
957 |
+
def _parse_tsv(path, filename, language_pair=None):
|
958 |
"""Generates examples from TSV file."""
|
959 |
if language_pair is None:
|
960 |
+
lang_match = re.match(r".*\.([a-z][a-z])-([a-z][a-z])\.tsv", filename)
|
961 |
+
assert lang_match is not None, "Invalid TSV filename: %s" % filename
|
962 |
l1, l2 = lang_match.groups()
|
963 |
else:
|
964 |
l1, l2 = language_pair
|
|
|
1005 |
block_match = re.match(re_block, id_)
|
1006 |
if block_match and block_match.groups()[0] in bad_blocks:
|
1007 |
continue
|
1008 |
+
sub_key = f"{filename}/{line_id}"
|
1009 |
yield sub_key, {
|
1010 |
"cs": cs.strip(),
|
1011 |
"en": en.strip(),
|