vjeronymo2 commited on
Commit
80abb16
1 Parent(s): 8eb0a93

Adding loader script

Browse files
Files changed (2) hide show
  1. dataset_infos.json +1 -0
  2. mrobust.py +265 -0
dataset_infos.json ADDED
@@ -0,0 +1 @@
 
1
+ {"collection-chinese": {"description": "\nRobust04 translated datasets\n\nChinese collection", "citation": "", "homepage": "", "license": "", "features": {"id": {"dtype": "string", "id": null, "_type": "Value"}, "text": {"dtype": "string", "id": null, "_type": "Value"}}, "post_processed": null, "supervised_keys": null, "task_templates": null, "builder_name": "m_robust", "config_name": "collection-chinese", "version": {"version_str": "1.0.0", "description": null, "major": 1, "minor": 0, "patch": 0}, "splits": {"collection": {"name": "collection", "num_bytes": 1530702099, "num_examples": 528032, "dataset_name": "m_robust"}}, "download_checksums": {"https://huggingface.co/datasets/unicamp-dl/mrobust/resolve/main/data/collections/chinese_collection.tsv": {"num_bytes": 1527533486, "checksum": "1fbbac3cb659d7e9e25748edc81304dbaf00dc507ba18afdef06d9627455087f"}}, "download_size": 1527533486, "post_processing_size": null, "dataset_size": 1530702099, "size_in_bytes": 3058235585}, "collection-dutch": {"description": "\nRobust04 translated datasets\n\nDutch collection", "citation": "", "homepage": "", "license": "", "features": {"id": {"dtype": "string", "id": null, "_type": "Value"}, "text": {"dtype": "string", "id": null, "_type": "Value"}}, "post_processed": null, "supervised_keys": null, "task_templates": null, "builder_name": "m_robust", "config_name": "collection-dutch", "version": {"version_str": "1.0.0", "description": null, "major": 1, "minor": 0, "patch": 0}, "splits": {"collection": {"name": "collection", "num_bytes": 1932193188, "num_examples": 528032, "dataset_name": "m_robust"}}, "download_checksums": {"https://huggingface.co/datasets/unicamp-dl/mrobust/resolve/main/data/collections/dutch_collection.tsv": {"num_bytes": 1929024572, "checksum": "010a9b524fc54e1c5db3f7199eecad1e8b260b83836b92233742059bdf0d22cd"}}, "download_size": 1929024572, "post_processing_size": null, "dataset_size": 1932193188, "size_in_bytes": 3861217760}, "collection-english": {"description": "\nRobust04 translated datasets\n\nEnglish collection", "citation": "", "homepage": "", "license": "", "features": {"id": {"dtype": "string", "id": null, "_type": "Value"}, "text": {"dtype": "string", "id": null, "_type": "Value"}}, "post_processed": null, "supervised_keys": null, "task_templates": null, "builder_name": "m_robust", "config_name": "collection-english", "version": {"version_str": "1.0.0", "description": null, "major": 1, "minor": 0, "patch": 0}, "splits": {"collection": {"name": "collection", "num_bytes": 1797791695, "num_examples": 528032, "dataset_name": "m_robust"}}, "download_checksums": {"https://huggingface.co/datasets/unicamp-dl/mrobust/resolve/main/data/collections/english_collection.tsv": {"num_bytes": 1794623079, "checksum": "0e0e72e54ab9eabf9a8b3f8b94412232a1fd138112b4b7d959e31f2f5e3d0f3f"}}, "download_size": 1794623079, "post_processing_size": null, "dataset_size": 1797791695, "size_in_bytes": 3592414774}, "collection-french": {"description": "\nRobust04 translated datasets\n\nFrench collection", "citation": "", "homepage": "", "license": "", "features": {"id": {"dtype": "string", "id": null, "_type": "Value"}, "text": {"dtype": "string", "id": null, "_type": "Value"}}, "post_processed": null, "supervised_keys": null, "task_templates": null, "builder_name": "m_robust", "config_name": "collection-french", "version": {"version_str": "1.0.0", "description": null, "major": 1, "minor": 0, "patch": 0}, "splits": {"collection": {"name": "collection", "num_bytes": 2036951843, "num_examples": 528032, "dataset_name": "m_robust"}}, "download_checksums": {"https://huggingface.co/datasets/unicamp-dl/mrobust/resolve/main/data/collections/french_collection.tsv": {"num_bytes": 2033783227, "checksum": "18e87dfaf003aa0efa289f025236a10a8535267f367b3ef999fdd302e74197f4"}}, "download_size": 2033783227, "post_processing_size": null, "dataset_size": 2036951843, "size_in_bytes": 4070735070}, "collection-german": {"description": "\nRobust04 translated datasets\n\nGerman collection", "citation": "", "homepage": "", "license": "", "features": {"id": {"dtype": "string", "id": null, "_type": "Value"}, "text": {"dtype": "string", "id": null, "_type": "Value"}}, "post_processed": null, "supervised_keys": null, "task_templates": null, "builder_name": "m_robust", "config_name": "collection-german", "version": {"version_str": "1.0.0", "description": null, "major": 1, "minor": 0, "patch": 0}, "splits": {"collection": {"name": "collection", "num_bytes": 1952256092, "num_examples": 528032, "dataset_name": "m_robust"}}, "download_checksums": {"https://huggingface.co/datasets/unicamp-dl/mrobust/resolve/main/data/collections/german_collection.tsv": {"num_bytes": 1949087476, "checksum": "c8c0e86b60f7623b5fb94ad4dee4d0fd1baad766be38ae113ed307ef93b2aa91"}}, "download_size": 1949087476, "post_processing_size": null, "dataset_size": 1952256092, "size_in_bytes": 3901343568}, "collection-indonesian": {"description": "\nRobust04 translated datasets\n\nIndonesian collection", "citation": "", "homepage": "", "license": "", "features": {"id": {"dtype": "string", "id": null, "_type": "Value"}, "text": {"dtype": "string", "id": null, "_type": "Value"}}, "post_processed": null, "supervised_keys": null, "task_templates": null, "builder_name": "m_robust", "config_name": "collection-indonesian", "version": {"version_str": "1.0.0", "description": null, "major": 1, "minor": 0, "patch": 0}, "splits": {"collection": {"name": "collection", "num_bytes": 1847802090, "num_examples": 528032, "dataset_name": "m_robust"}}, "download_checksums": {"https://huggingface.co/datasets/unicamp-dl/mrobust/resolve/main/data/collections/indonesian_collection.tsv": {"num_bytes": 1844633474, "checksum": "75afc69af9ccbabc898f1a04baeb9794682a4390c96b14fc9f0f1ff1e9b711cf"}}, "download_size": 1844633474, "post_processing_size": null, "dataset_size": 1847802090, "size_in_bytes": 3692435564}, "collection-italian": {"description": "\nRobust04 translated datasets\n\nItalian collection", "citation": "", "homepage": "", "license": "", "features": {"id": {"dtype": "string", "id": null, "_type": "Value"}, "text": {"dtype": "string", "id": null, "_type": "Value"}}, "post_processed": null, "supervised_keys": null, "task_templates": null, "builder_name": "m_robust", "config_name": "collection-italian", "version": {"version_str": "1.0.0", "description": null, "major": 1, "minor": 0, "patch": 0}, "splits": {"collection": {"name": "collection", "num_bytes": 1945619347, "num_examples": 528032, "dataset_name": "m_robust"}}, "download_checksums": {"https://huggingface.co/datasets/unicamp-dl/mrobust/resolve/main/data/collections/italian_collection.tsv": {"num_bytes": 1942450731, "checksum": "ee98ad13683c3c572ffa72f16ecc815e912866f426289b7a28bf805c6af3bd4a"}}, "download_size": 1942450731, "post_processing_size": null, "dataset_size": 1945619347, "size_in_bytes": 3888070078}, "collection-portuguese": {"description": "\nRobust04 translated datasets\n\nPortuguese collection", "citation": "", "homepage": "", "license": "", "features": {"id": {"dtype": "string", "id": null, "_type": "Value"}, "text": {"dtype": "string", "id": null, "_type": "Value"}}, "post_processed": null, "supervised_keys": null, "task_templates": null, "builder_name": "m_robust", "config_name": "collection-portuguese", "version": {"version_str": "1.0.0", "description": null, "major": 1, "minor": 0, "patch": 0}, "splits": {"collection": {"name": "collection", "num_bytes": 1917306932, "num_examples": 528032, "dataset_name": "m_robust"}}, "download_checksums": {"https://huggingface.co/datasets/unicamp-dl/mrobust/resolve/main/data/collections/portuguese_collection.tsv": {"num_bytes": 1914138316, "checksum": "79b982e22e4b9c4326345899ad3ccc66a38b7c6f36ad26c9b687b1a23b130dc1"}}, "download_size": 1914138316, "post_processing_size": null, "dataset_size": 1917306932, "size_in_bytes": 3831445248}, "collection-russian": {"description": "\nRobust04 translated datasets\n\nRussian collection", "citation": "", "homepage": "", "license": "", "features": {"id": {"dtype": "string", "id": null, "_type": "Value"}, "text": {"dtype": "string", "id": null, "_type": "Value"}}, "post_processed": null, "supervised_keys": null, "task_templates": null, "builder_name": "m_robust", "config_name": "collection-russian", "version": {"version_str": "1.0.0", "description": null, "major": 1, "minor": 0, "patch": 0}, "splits": {"collection": {"name": "collection", "num_bytes": 3114493415, "num_examples": 528032, "dataset_name": "m_robust"}}, "download_checksums": {"https://huggingface.co/datasets/unicamp-dl/mrobust/resolve/main/data/collections/russian_collection.tsv": {"num_bytes": 3111324799, "checksum": "fc568e6f1fc72f98941934db64dc2b1e58cd0dff354a429997d413bdc9fb5287"}}, "download_size": 3111324799, "post_processing_size": null, "dataset_size": 3114493415, "size_in_bytes": 6225818214}, "collection-spanish": {"description": "\nRobust04 translated datasets\n\nSpanish collection", "citation": "", "homepage": "", "license": "", "features": {"id": {"dtype": "string", "id": null, "_type": "Value"}, "text": {"dtype": "string", "id": null, "_type": "Value"}}, "post_processed": null, "supervised_keys": null, "task_templates": null, "builder_name": "m_robust", "config_name": "collection-spanish", "version": {"version_str": "1.0.0", "description": null, "major": 1, "minor": 0, "patch": 0}, "splits": {"collection": {"name": "collection", "num_bytes": 1986755070, "num_examples": 528032, "dataset_name": "m_robust"}}, "download_checksums": {"https://huggingface.co/datasets/unicamp-dl/mrobust/resolve/main/data/collections/spanish_collection.tsv": {"num_bytes": 1983586454, "checksum": "9080704680944f8524b7429f0de4b4d69766f77dd0fde50b852b561b4dd0d1b4"}}, "download_size": 1983586454, "post_processing_size": null, "dataset_size": 1986755070, "size_in_bytes": 3970341524}, "collection-vietnamese": {"description": "\nRobust04 translated datasets\n\nVietnamese collection", "citation": "", "homepage": "", "license": "", "features": {"id": {"dtype": "string", "id": null, "_type": "Value"}, "text": {"dtype": "string", "id": null, "_type": "Value"}}, "post_processed": null, "supervised_keys": null, "task_templates": null, "builder_name": "m_robust", "config_name": "collection-vietnamese", "version": {"version_str": "1.0.0", "description": null, "major": 1, "minor": 0, "patch": 0}, "splits": {"collection": {"name": "collection", "num_bytes": 2304716783, "num_examples": 528032, "dataset_name": "m_robust"}}, "download_checksums": {"https://huggingface.co/datasets/unicamp-dl/mrobust/resolve/main/data/collections/vietnamese_collection.tsv": {"num_bytes": 2301548167, "checksum": "e0037ee0f15b8191aff4d65fdf8781625c96b38ef50fd4c6816058bdbd604699"}}, "download_size": 2301548167, "post_processing_size": null, "dataset_size": 2304716783, "size_in_bytes": 4606264950}, "queries-chinese": {"description": "\nRobust04 translated datasets\n\nChinese queries", "citation": "", "homepage": "", "license": "", "features": {"id": {"dtype": "string", "id": null, "_type": "Value"}, "text": {"dtype": "string", "id": null, "_type": "Value"}}, "post_processed": null, "supervised_keys": null, "task_templates": null, "builder_name": "m_robust", "config_name": "queries-chinese", "version": {"version_str": "1.0.0", "description": null, "major": 1, "minor": 0, "patch": 0}, "splits": {"queries": {"name": "queries", "num_bytes": 21695, "num_examples": 250, "dataset_name": "m_robust"}}, "download_checksums": {"https://huggingface.co/datasets/unicamp-dl/mrobust/resolve/main/data/queries/chinese_queries.tsv": {"num_bytes": 20187, "checksum": "22712c0621269681176965da6ddbd760d5af579f58c20f650ac84fc84cb0c30a"}}, "download_size": 20187, "post_processing_size": null, "dataset_size": 21695, "size_in_bytes": 41882}, "queries-dutch": {"description": "\nRobust04 translated datasets\n\nDutch queries", "citation": "", "homepage": "", "license": "", "features": {"id": {"dtype": "string", "id": null, "_type": "Value"}, "text": {"dtype": "string", "id": null, "_type": "Value"}}, "post_processed": null, "supervised_keys": null, "task_templates": null, "builder_name": "m_robust", "config_name": "queries-dutch", "version": {"version_str": "1.0.0", "description": null, "major": 1, "minor": 0, "patch": 0}, "splits": {"queries": {"name": "queries", "num_bytes": 29900, "num_examples": 250, "dataset_name": "m_robust"}}, "download_checksums": {"https://huggingface.co/datasets/unicamp-dl/mrobust/resolve/main/data/queries/dutch_queries.tsv": {"num_bytes": 28392, "checksum": "bf76fcd0ea16c5e28187f5215400a3236ee232e49b80c5a2f82f874cf3f542bb"}}, "download_size": 28392, "post_processing_size": null, "dataset_size": 29900, "size_in_bytes": 58292}, "queries-english": {"description": "\nRobust04 translated datasets\n\nEnglish queries", "citation": "", "homepage": "", "license": "", "features": {"id": {"dtype": "string", "id": null, "_type": "Value"}, "text": {"dtype": "string", "id": null, "_type": "Value"}}, "post_processed": null, "supervised_keys": null, "task_templates": null, "builder_name": "m_robust", "config_name": "queries-english", "version": {"version_str": "1.0.0", "description": null, "major": 1, "minor": 0, "patch": 0}, "splits": {"queries": {"name": "queries", "num_bytes": 27087, "num_examples": 250, "dataset_name": "m_robust"}}, "download_checksums": {"https://huggingface.co/datasets/unicamp-dl/mrobust/resolve/main/data/queries/english_queries.tsv": {"num_bytes": 25579, "checksum": "788eac62f7825aeb72f2692d5bf195f22cbac1b0860c0fe98ef1682ba8ff95ea"}}, "download_size": 25579, "post_processing_size": null, "dataset_size": 27087, "size_in_bytes": 52666}, "queries-french": {"description": "\nRobust04 translated datasets\n\nFrench queries", "citation": "", "homepage": "", "license": "", "features": {"id": {"dtype": "string", "id": null, "_type": "Value"}, "text": {"dtype": "string", "id": null, "_type": "Value"}}, "post_processed": null, "supervised_keys": null, "task_templates": null, "builder_name": "m_robust", "config_name": "queries-french", "version": {"version_str": "1.0.0", "description": null, "major": 1, "minor": 0, "patch": 0}, "splits": {"queries": {"name": "queries", "num_bytes": 32878, "num_examples": 250, "dataset_name": "m_robust"}}, "download_checksums": {"https://huggingface.co/datasets/unicamp-dl/mrobust/resolve/main/data/queries/french_queries.tsv": {"num_bytes": 31370, "checksum": "76274d67a5758b4e49837123217c47c5284f27b6b8297e95ff59660847c5d8f6"}}, "download_size": 31370, "post_processing_size": null, "dataset_size": 32878, "size_in_bytes": 64248}, "queries-german": {"description": "\nRobust04 translated datasets\n\nGerman queries", "citation": "", "homepage": "", "license": "", "features": {"id": {"dtype": "string", "id": null, "_type": "Value"}, "text": {"dtype": "string", "id": null, "_type": "Value"}}, "post_processed": null, "supervised_keys": null, "task_templates": null, "builder_name": "m_robust", "config_name": "queries-german", "version": {"version_str": "1.0.0", "description": null, "major": 1, "minor": 0, "patch": 0}, "splits": {"queries": {"name": "queries", "num_bytes": 31371, "num_examples": 250, "dataset_name": "m_robust"}}, "download_checksums": {"https://huggingface.co/datasets/unicamp-dl/mrobust/resolve/main/data/queries/german_queries.tsv": {"num_bytes": 29863, "checksum": "b649479bf189c85422be71ba327e1ba325c6aef3de462b1cf09a08e89faad28e"}}, "download_size": 29863, "post_processing_size": null, "dataset_size": 31371, "size_in_bytes": 61234}, "queries-indonesian": {"description": "\nRobust04 translated datasets\n\nIndonesian queries", "citation": "", "homepage": "", "license": "", "features": {"id": {"dtype": "string", "id": null, "_type": "Value"}, "text": {"dtype": "string", "id": null, "_type": "Value"}}, "post_processed": null, "supervised_keys": null, "task_templates": null, "builder_name": "m_robust", "config_name": "queries-indonesian", "version": {"version_str": "1.0.0", "description": null, "major": 1, "minor": 0, "patch": 0}, "splits": {"queries": {"name": "queries", "num_bytes": 27845, "num_examples": 250, "dataset_name": "m_robust"}}, "download_checksums": {"https://huggingface.co/datasets/unicamp-dl/mrobust/resolve/main/data/queries/indonesian_queries.tsv": {"num_bytes": 26337, "checksum": "c3836551c356464c82a600df3ebcf3f0f1b8d69cee09ccc99b54bee9167f06f3"}}, "download_size": 26337, "post_processing_size": null, "dataset_size": 27845, "size_in_bytes": 54182}, "queries-italian": {"description": "\nRobust04 translated datasets\n\nItalian queries", "citation": "", "homepage": "", "license": "", "features": {"id": {"dtype": "string", "id": null, "_type": "Value"}, "text": {"dtype": "string", "id": null, "_type": "Value"}}, "post_processed": null, "supervised_keys": null, "task_templates": null, "builder_name": "m_robust", "config_name": "queries-italian", "version": {"version_str": "1.0.0", "description": null, "major": 1, "minor": 0, "patch": 0}, "splits": {"queries": {"name": "queries", "num_bytes": 30214, "num_examples": 250, "dataset_name": "m_robust"}}, "download_checksums": {"https://huggingface.co/datasets/unicamp-dl/mrobust/resolve/main/data/queries/italian_queries.tsv": {"num_bytes": 28706, "checksum": "51c19a45f46700ce74bedb145ebd1e979dd5b709710cb5bcca9c30db6f12c8ef"}}, "download_size": 28706, "post_processing_size": null, "dataset_size": 30214, "size_in_bytes": 58920}, "queries-portuguese": {"description": "\nRobust04 translated datasets\n\nPortuguese queries", "citation": "", "homepage": "", "license": "", "features": {"id": {"dtype": "string", "id": null, "_type": "Value"}, "text": {"dtype": "string", "id": null, "_type": "Value"}}, "post_processed": null, "supervised_keys": null, "task_templates": null, "builder_name": "m_robust", "config_name": "queries-portuguese", "version": {"version_str": "1.0.0", "description": null, "major": 1, "minor": 0, "patch": 0}, "splits": {"queries": {"name": "queries", "num_bytes": 29926, "num_examples": 250, "dataset_name": "m_robust"}}, "download_checksums": {"https://huggingface.co/datasets/unicamp-dl/mrobust/resolve/main/data/queries/portuguese_queries.tsv": {"num_bytes": 28418, "checksum": "38d2a074bef9e714952a417e323ff143a08e474f6740b76d0d71447a4f16d718"}}, "download_size": 28418, "post_processing_size": null, "dataset_size": 29926, "size_in_bytes": 58344}, "queries-russian": {"description": "\nRobust04 translated datasets\n\nRussian queries", "citation": "", "homepage": "", "license": "", "features": {"id": {"dtype": "string", "id": null, "_type": "Value"}, "text": {"dtype": "string", "id": null, "_type": "Value"}}, "post_processed": null, "supervised_keys": null, "task_templates": null, "builder_name": "m_robust", "config_name": "queries-russian", "version": {"version_str": "1.0.0", "description": null, "major": 1, "minor": 0, "patch": 0}, "splits": {"queries": {"name": "queries", "num_bytes": 50030, "num_examples": 250, "dataset_name": "m_robust"}}, "download_checksums": {"https://huggingface.co/datasets/unicamp-dl/mrobust/resolve/main/data/queries/russian_queries.tsv": {"num_bytes": 48522, "checksum": "fedae04e4ad9c0c18c910a29dd2a7fbea9061e9796f5d050da22d21e13622ddf"}}, "download_size": 48522, "post_processing_size": null, "dataset_size": 50030, "size_in_bytes": 98552}, "queries-spanish": {"description": "\nRobust04 translated datasets\n\nSpanish queries", "citation": "", "homepage": "", "license": "", "features": {"id": {"dtype": "string", "id": null, "_type": "Value"}, "text": {"dtype": "string", "id": null, "_type": "Value"}}, "post_processed": null, "supervised_keys": null, "task_templates": null, "builder_name": "m_robust", "config_name": "queries-spanish", "version": {"version_str": "1.0.0", "description": null, "major": 1, "minor": 0, "patch": 0}, "splits": {"queries": {"name": "queries", "num_bytes": 31718, "num_examples": 250, "dataset_name": "m_robust"}}, "download_checksums": {"https://huggingface.co/datasets/unicamp-dl/mrobust/resolve/main/data/queries/spanish_queries.tsv": {"num_bytes": 30210, "checksum": "5f48b4307f511f9fefd260fcf1ad77c5ed549a2fff2609d5d066229422bc7213"}}, "download_size": 30210, "post_processing_size": null, "dataset_size": 31718, "size_in_bytes": 61928}, "queries-vietnamese": {"description": "\nRobust04 translated datasets\n\nVietnamese queries", "citation": "", "homepage": "", "license": "", "features": {"id": {"dtype": "string", "id": null, "_type": "Value"}, "text": {"dtype": "string", "id": null, "_type": "Value"}}, "post_processed": null, "supervised_keys": null, "task_templates": null, "builder_name": "m_robust", "config_name": "queries-vietnamese", "version": {"version_str": "1.0.0", "description": null, "major": 1, "minor": 0, "patch": 0}, "splits": {"queries": {"name": "queries", "num_bytes": 37152, "num_examples": 250, "dataset_name": "m_robust"}}, "download_checksums": {"https://huggingface.co/datasets/unicamp-dl/mrobust/resolve/main/data/queries/vietnamese_queries.tsv": {"num_bytes": 35644, "checksum": "80722572077a4ba615f9f2ec5c2316dccce8e226dd422b3bb5cbcaea9685dde7"}}, "download_size": 35644, "post_processing_size": null, "dataset_size": 37152, "size_in_bytes": 72796}}
mrobust.py ADDED
@@ -0,0 +1,265 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # coding=utf-8
2
+ # Copyright 2020 The TensorFlow Datasets Authors and the HuggingFace Datasets Authors.
3
+ #
4
+ # Licensed under the Apache License, Version 2.0 (the "License");
5
+ # you may not use this file except in compliance with the License.
6
+ # You may obtain a copy of the License at
7
+ #
8
+ # http://www.apache.org/licenses/LICENSE-2.0
9
+ #
10
+ # Unless required by applicable law or agreed to in writing, software
11
+ # distributed under the License is distributed on an "AS IS" BASIS,
12
+ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13
+ # See the License for the specific language governing permissions and
14
+ # limitations under the License.
15
+
16
+ # Lint as: python3
17
+ """mrobust dataset."""
18
+
19
+ import datasets
20
+
21
+
22
+ # _CITATION = """
23
+ # @misc{bonifacio2021mmarco,
24
+ # title={mMARCO: A Multilingual Version of the MS MARCO Passage Ranking Dataset},
25
+ # author={Luiz Henrique Bonifacio and Israel Campiotti and Vitor Jeronymo and Hugo Queiroz Abonizio and Roberto Lotufo and Rodrigo Nogueira},
26
+ # year={2021},
27
+ # eprint={2108.13897},
28
+ # archivePrefix={arXiv},
29
+ # primaryClass={cs.CL}
30
+ # }
31
+ # """
32
+
33
+ # _URL = "https://github.com/unicamp-dl/mMARCO"
34
+
35
+ _DESCRIPTION = """
36
+ Robust04 translated datasets
37
+ """
38
+
39
+
40
+ # def generate_examples_triples(filepath, collection_path, queries_path):
41
+ # collection = {}
42
+ # with open(collection_path, encoding="utf-8") as f:
43
+ # for line in f:
44
+ # doc_id, doc = line.rstrip().split("\t")
45
+ # collection[doc_id] = doc
46
+
47
+ # queries = {}
48
+ # with open(queries_path, encoding="utf-8") as f:
49
+ # for line in f:
50
+ # query_id, query = line.rstrip().split("\t")
51
+ # queries[query_id] = query
52
+
53
+ # with open(filepath, encoding="utf-8") as f:
54
+ # for (idx, line) in enumerate(f):
55
+ # query_id, pos_id, neg_id = line.rstrip().split("\t")
56
+ # features = {
57
+ # "query": queries[query_id],
58
+ # "positive": collection[pos_id],
59
+ # "negative": collection[neg_id],
60
+ # }
61
+ # yield idx, features
62
+
63
+
64
+ def generate_examples_tuples(filepath):
65
+ with open(filepath, encoding="utf-8") as f:
66
+ for (idx, line) in enumerate(f):
67
+ idx, text = line.rstrip().split("\t")
68
+ features = {
69
+ "id": idx,
70
+ "text": text,
71
+ }
72
+ yield idx, features
73
+
74
+
75
+ # def generate_examples_runs(filepath, collection_path, queries_path):
76
+ # collection = {}
77
+ # with open(collection_path, encoding="utf-8") as f:
78
+ # for line in f:
79
+ # doc_id, doc = line.rstrip().split("\t")
80
+ # collection[doc_id] = doc
81
+
82
+ # queries = {}
83
+ # with open(queries_path, encoding="utf-8") as f:
84
+ # for line in f:
85
+ # query_id, query = line.rstrip().split("\t")
86
+ # queries[query_id] = query
87
+
88
+ # qid_to_ranked_candidate_passages = {}
89
+ # with open(filepath, encoding="utf-8") as f:
90
+ # for line in f:
91
+ # qid, pid, rank = line.rstrip().split("\t")
92
+ # if qid not in qid_to_ranked_candidate_passages:
93
+ # qid_to_ranked_candidate_passages[qid] = []
94
+ # qid_to_ranked_candidate_passages[qid].append(pid)
95
+
96
+ # for (idx, qid) in enumerate(qid_to_ranked_candidate_passages):
97
+ # features = {
98
+ # "id": qid,
99
+ # "query": queries[qid],
100
+ # "passages": [
101
+ # {
102
+ # "id": pid,
103
+ # "passage": collection[pid],
104
+ # }
105
+ # for pid in qid_to_ranked_candidate_passages[qid]
106
+ # ],
107
+ # }
108
+ # yield idx, features
109
+
110
+
111
+ _BASE_URLS = {
112
+ "collections": "https://huggingface.co/datasets/unicamp-dl/mrobust/resolve/main/data/collections/",
113
+ "queries": "https://huggingface.co/datasets/unicamp-dl/mrobust/resolve/main/data/queries/",
114
+ # "runs": "https://huggingface.co/datasets/unicamp-dl/mrobust/resolve/main/data/runs/",
115
+ # "train": "https://huggingface.co/datasets/unicamp-dl/mrobust/resolve/main/data/triples.train.ids.small.tsv",
116
+ }
117
+
118
+ LANGUAGES = [
119
+ "chinese",
120
+ "dutch",
121
+ "english",
122
+ "french",
123
+ "german",
124
+ "indonesian",
125
+ "italian",
126
+ "portuguese",
127
+ "russian",
128
+ "spanish",
129
+ "vietnamese",
130
+ ]
131
+
132
+
133
+ class MRobust(datasets.GeneratorBasedBuilder):
134
+
135
+ BUILDER_CONFIGS = (
136
+ # [
137
+ # datasets.BuilderConfig(
138
+ # name=language,
139
+ # description=f"{language.capitalize()} triples",
140
+ # version=datasets.Version("1.0.0"),
141
+ # )
142
+ # for language in LANGUAGES
143
+ # ]
144
+ [
145
+ datasets.BuilderConfig(
146
+ name=f"collection-{language}",
147
+ description=f"{language.capitalize()} collection",
148
+ version=datasets.Version("1.0.0"),
149
+ )
150
+ for language in LANGUAGES
151
+ ]
152
+ + [
153
+ datasets.BuilderConfig(
154
+ name=f"queries-{language}",
155
+ description=f"{language.capitalize()} queries",
156
+ version=datasets.Version("1.0.0"),
157
+ )
158
+ for language in LANGUAGES
159
+ ]
160
+ # + [
161
+ # datasets.BuilderConfig(
162
+ # name=f"runs-{language}",
163
+ # description=f"{language.capitalize()} runs",
164
+ # version=datasets.Version("1.0.0"),
165
+ # )
166
+ # for language in LANGUAGES
167
+ # ]
168
+ )
169
+
170
+ DEFAULT_CONFIG_NAME = "english"
171
+
172
+ def _info(self):
173
+ name = self.config.name
174
+ if name.startswith("collection") or name.startswith("queries"):
175
+ features = {
176
+ "id": datasets.Value("string"),
177
+ "text": datasets.Value("string"),
178
+ }
179
+ # elif name.startswith("runs"):
180
+ # features = {
181
+ # "id": datasets.Value("int32"),
182
+ # "query": datasets.Value("string"),
183
+ # "passages": datasets.Sequence(
184
+ # {
185
+ # "id": datasets.Value("int32"),
186
+ # "passage": datasets.Value("string"),
187
+ # }
188
+ # ),
189
+ # }
190
+ # else:
191
+ # features = {
192
+ # "query": datasets.Value("string"),
193
+ # "positive": datasets.Value("string"),
194
+ # "negative": datasets.Value("string"),
195
+ # }
196
+
197
+ return datasets.DatasetInfo(
198
+ description=f"{_DESCRIPTION}\n{self.config.description}",
199
+ features=datasets.Features(features),
200
+ supervised_keys=None,
201
+ # homepage=_URL,
202
+ # citation=_CITATION,
203
+ )
204
+
205
+ def _split_generators(self, dl_manager):
206
+ """Returns SplitGenerators."""
207
+
208
+ if self.config.name.startswith("collection"):
209
+ url = _BASE_URLS["collections"] + self.config.name[11:] + "_collection.tsv"
210
+ dl_path = dl_manager.download_and_extract(url)
211
+ return (datasets.SplitGenerator(name="collection", gen_kwargs={"filepath": dl_path}),)
212
+ elif self.config.name.startswith("queries"):
213
+ url = _BASE_URLS["queries"] + self.config.name[8:] + "_queries.tsv"
214
+ dl_path = dl_manager.download_and_extract(url)
215
+ return (datasets.SplitGenerator(name="queries", gen_kwargs={"filepath": dl_path}),)
216
+ # elif self.config.name.startswith("runs"):
217
+ # urls = {
218
+ # "collection": _BASE_URLS["collections"] + self.config.name[5:] + "_collection.tsv",
219
+ # "queries": _BASE_URLS["queries-dev"] + self.config.name[5:] + "_queries.dev.tsv",
220
+ # "run": _BASE_URLS["runs"] + "run.bm25_" + self.config.name[5:] + ".txt",
221
+ # }
222
+
223
+ # dl_path = dl_manager.download_and_extract(urls)
224
+ # return (
225
+ # datasets.SplitGenerator(
226
+ # name="bm25",
227
+ # gen_kwargs={
228
+ # "filepath": dl_path["run"],
229
+ # "args": {
230
+ # "collection": dl_path["collection"],
231
+ # "queries": dl_path["queries"],
232
+ # },
233
+ # },
234
+ # ),
235
+ # )
236
+ # else:
237
+ # urls = {
238
+ # "collection": _BASE_URLS["collections"] + self.config.name + "_collection.tsv",
239
+ # "queries": _BASE_URLS["queries-train"] + self.config.name + "_queries.train.tsv",
240
+ # "train": _BASE_URLS["train"],
241
+ # }
242
+ # dl_path = dl_manager.download_and_extract(urls)
243
+
244
+ # return [
245
+ # datasets.SplitGenerator(
246
+ # name=datasets.Split.TRAIN,
247
+ # gen_kwargs={
248
+ # "filepath": dl_path["train"],
249
+ # "args": {
250
+ # "collection": dl_path["collection"],
251
+ # "queries": dl_path["queries"],
252
+ # },
253
+ # },
254
+ # )
255
+ # ]
256
+
257
+ def _generate_examples(self, filepath, args=None):
258
+ """Yields examples."""
259
+
260
+ if self.config.name.startswith("collection") or self.config.name.startswith("queries"):
261
+ return generate_examples_tuples(filepath)
262
+ # if self.config.name.startswith("runs"):
263
+ # return generate_examples_runs(filepath, args["collection"], args["queries"])
264
+ # else:
265
+ # return generate_examples_triples(filepath, args["collection"], args["queries"])