Commit
·
2c4b081
0
Parent(s):
Update files from the datasets library (from 1.0.0)
Browse filesRelease notes: https://github.com/huggingface/datasets/releases/tag/1.0.0
- .gitattributes +27 -0
- dataset_infos.json +1 -0
- dummy/ModApte/1.0.0/dummy_data.zip +3 -0
- dummy/ModHayes/1.0.0/dummy_data.zip +3 -0
- dummy/ModLewis/1.0.0/dummy_data.zip +3 -0
- reuters21578.py +402 -0
.gitattributes
ADDED
|
@@ -0,0 +1,27 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
*.7z filter=lfs diff=lfs merge=lfs -text
|
| 2 |
+
*.arrow filter=lfs diff=lfs merge=lfs -text
|
| 3 |
+
*.bin filter=lfs diff=lfs merge=lfs -text
|
| 4 |
+
*.bin.* filter=lfs diff=lfs merge=lfs -text
|
| 5 |
+
*.bz2 filter=lfs diff=lfs merge=lfs -text
|
| 6 |
+
*.ftz filter=lfs diff=lfs merge=lfs -text
|
| 7 |
+
*.gz filter=lfs diff=lfs merge=lfs -text
|
| 8 |
+
*.h5 filter=lfs diff=lfs merge=lfs -text
|
| 9 |
+
*.joblib filter=lfs diff=lfs merge=lfs -text
|
| 10 |
+
*.lfs.* filter=lfs diff=lfs merge=lfs -text
|
| 11 |
+
*.model filter=lfs diff=lfs merge=lfs -text
|
| 12 |
+
*.msgpack filter=lfs diff=lfs merge=lfs -text
|
| 13 |
+
*.onnx filter=lfs diff=lfs merge=lfs -text
|
| 14 |
+
*.ot filter=lfs diff=lfs merge=lfs -text
|
| 15 |
+
*.parquet filter=lfs diff=lfs merge=lfs -text
|
| 16 |
+
*.pb filter=lfs diff=lfs merge=lfs -text
|
| 17 |
+
*.pt filter=lfs diff=lfs merge=lfs -text
|
| 18 |
+
*.pth filter=lfs diff=lfs merge=lfs -text
|
| 19 |
+
*.rar filter=lfs diff=lfs merge=lfs -text
|
| 20 |
+
saved_model/**/* filter=lfs diff=lfs merge=lfs -text
|
| 21 |
+
*.tar.* filter=lfs diff=lfs merge=lfs -text
|
| 22 |
+
*.tflite filter=lfs diff=lfs merge=lfs -text
|
| 23 |
+
*.tgz filter=lfs diff=lfs merge=lfs -text
|
| 24 |
+
*.xz filter=lfs diff=lfs merge=lfs -text
|
| 25 |
+
*.zip filter=lfs diff=lfs merge=lfs -text
|
| 26 |
+
*.zstandard filter=lfs diff=lfs merge=lfs -text
|
| 27 |
+
*tfevents* filter=lfs diff=lfs merge=lfs -text
|
dataset_infos.json
ADDED
|
@@ -0,0 +1 @@
|
|
|
|
|
|
|
| 1 |
+
{"ModHayes": {"description": "The Reuters-21578 dataset is one of the most widely used data collections for text\ncategorization research. It is collected from the Reuters financial newswire service in 1987.\n", "citation": "@article{APTE94,\nauthor = {Chidanand Apt{'{e}} and Fred Damerau and Sholom M. Weiss},\ntitle = {Automated Learning of Decision Rules for Text Categorization},\njournal = {ACM Transactions on Information Systems},\nyear = {1994}, \nnote = {To appear.}\n}\n\n@inproceedings{APTE94b,\nauthor = {Chidanand Apt{'{e}} and Fred Damerau and Sholom M. Weiss},\ntitle = {Toward Language Independent Automated Learning of Text Categorization Models},\nbooktitle = {sigir94},\nyear = {1994},\nnote = {To appear.}\n}\n\n@inproceedings{HAYES8},\nauthor = {Philip J. Hayes and Peggy M. Anderson and Irene B. Nirenburg and \nLinda M. Schmandt},\ntitle = {{TCS}: A Shell for Content-Based Text Categorization},\nbooktitle = {IEEE Conference on Artificial Intelligence Applications},\nyear = {1990}\n}\n\n@inproceedings{HAYES90b,\nauthor = {Philip J. Hayes and Steven P. Weinstein},\ntitle = {{CONSTRUE/TIS:} A System for Content-Based Indexing of a \nDatabase of News Stories},\nbooktitle = {Second Annual Conference on Innovative Applications of\nArtificial Intelligence},\nyear = {1990}\n}\n\n@incollection{HAYES92 ,\nauthor = {Philip J. Hayes},\ntitle = {Intelligent High-Volume Text Processing using Shallow,\nDomain-Specific Techniques},\nbooktitle = {Text-Based Intelligent Systems},\npublisher = {Lawrence Erlbaum},\naddress = {Hillsdale, NJ},\nyear = {1992},\neditor = {Paul S. Jacobs}\n}\n\n@inproceedings{LEWIS91c ,\nauthor = {David D. Lewis},\ntitle = {Evaluating Text Categorization},\nbooktitle = {Proceedings of Speech and Natural Language Workshop},\nyear = {1991},\nmonth = {feb},\norganization = {Defense Advanced Research Projects Agency},\npublisher = {Morgan Kaufmann},\npages = {312--318}\n\n}\n\n@phdthesis{LEWIS91d,\nauthor = {David Dolan Lewis},\ntitle = {Representation and Learning in Information Retrieval},\nschool = {Computer Science Dept.; Univ. of Massachusetts; Amherst, MA 01003},\nyear = 1992},\nnote = {Technical Report 91--93.}\n}\n\n@inproceedings{LEWIS91e,\nauthor = {David D. Lewis},\ntitle = {Data Extraction as Text Categorization: An Experiment with\nthe {MUC-3} Corpus},\nbooktitle = {Proceedings of the Third Message Understanding Evaluation\nand Conference},\nyear = {1991},\nmonth = {may},\norganization = {Defense Advanced Research Projects Agency},\npublisher = {Morgan Kaufmann},\naddress = {Los Altos, CA}\n\n}\n\n@inproceedings{LEWIS92b,\nauthor = {David D. Lewis},\ntitle = {An Evaluation of Phrasal and Clustered Representations on a Text\nCategorization Task},\nbooktitle = {Fifteenth Annual International ACM SIGIR Conference on\nResearch and Development in Information Retrieval},\nyear = {1992},\npages = {37--50}\n}\n\n@inproceedings{LEWIS92d ,\nauthor = {David D. Lewis and Richard M. Tong},\ntitle = {Text Filtering in {MUC-3} and {MUC-4}},\nbooktitle = {Proceedings of the Fourth Message Understanding Conference ({MUC-4})},\nyear = {1992},\nmonth = {jun},\norganization = {Defense Advanced Research Projects Agency},\npublisher = {Morgan Kaufmann},\naddress = {Los Altos, CA}\n}\n\n@inproceedings{LEWIS92e,\nauthor = {David D. Lewis},\ntitle = {Feature Selection and Feature Extraction for Text Categorization},\nbooktitle = {Proceedings of Speech and Natural Language Workshop},\nyear = {1992},\nmonth = {feb} ,\norganization = {Defense Advanced Research Projects Agency},\npublisher = {Morgan Kaufmann},\npages = {212--217}\n}\n\n@inproceedings{LEWIS94b,\nauthor = {David D. Lewis and Marc Ringuette},\ntitle = {A Comparison of Two Learning Algorithms for Text Categorization},\nbooktitle = {Symposium on Document Analysis and Information Retrieval},\nyear = {1994},\norganization = {ISRI; Univ. of Nevada, Las Vegas},\naddress = {Las Vegas, NV},\nmonth = {apr},\npages = {81--93}\n}\n\n@article{LEWIS94d, \nauthor = {David D. Lewis and Philip J. Hayes}, \ntitle = {Guest Editorial}, \njournal = {ACM Transactions on Information Systems}, \nyear = {1994}, \nvolume = {12}, \nnumber = {3}, \npages = {231}, \nmonth = {jul}\n}\n\n@article{SPARCKJONES76,\nauthor = {K. {Sparck Jones} and C. J. {van Rijsbergen}},\ntitle = {Information Retrieval Test Collections},\njournal = {Journal of Documentation},\nyear = {1976},\nvolume = {32},\nnumber = {1},\npages = {59--75}\n}\n\n@book{WEISS91,\nauthor = {Sholom M. Weiss and Casimir A. Kulikowski},\ntitle = {Computer Systems That Learn},\npublisher = {Morgan Kaufmann},\nyear = {1991},\naddress = {San Mateo, CA}\n}\n", "homepage": "https://kdd.ics.uci.edu/databases/reuters21578/reuters21578.html", "license": "", "features": {"text": {"dtype": "string", "id": null, "_type": "Value"}, "topics": {"feature": {"dtype": "string", "id": null, "_type": "Value"}, "length": -1, "id": null, "_type": "Sequence"}, "lewis_split": {"dtype": "string", "id": null, "_type": "Value"}, "cgis_split": {"dtype": "string", "id": null, "_type": "Value"}, "old_id": {"dtype": "string", "id": null, "_type": "Value"}, "new_id": {"dtype": "string", "id": null, "_type": "Value"}, "places": {"feature": {"dtype": "string", "id": null, "_type": "Value"}, "length": -1, "id": null, "_type": "Sequence"}, "people": {"feature": {"dtype": "string", "id": null, "_type": "Value"}, "length": -1, "id": null, "_type": "Sequence"}, "orgs": {"feature": {"dtype": "string", "id": null, "_type": "Value"}, "length": -1, "id": null, "_type": "Sequence"}, "exchanges": {"feature": {"dtype": "string", "id": null, "_type": "Value"}, "length": -1, "id": null, "_type": "Sequence"}, "date": {"dtype": "string", "id": null, "_type": "Value"}, "title": {"dtype": "string", "id": null, "_type": "Value"}}, "supervised_keys": null, "builder_name": "reuters21578", "config_name": "ModHayes", "version": {"version_str": "1.0.0", "description": "", "datasets_version_to_prepare": null, "major": 1, "minor": 0, "patch": 0}, "splits": {"test": {"name": "test", "num_bytes": 930193, "num_examples": 720, "dataset_name": "reuters21578"}, "train": {"name": "train", "num_bytes": 18050316, "num_examples": 18323, "dataset_name": "reuters21578"}}, "download_checksums": {"https://kdd.ics.uci.edu/databases/reuters21578/reuters21578.tar.gz": {"num_bytes": 8150596, "checksum": "3bae43c9b14e387f76a61b6d82bf98a4fb5d3ef99ef7e7075ff2ccbcf59f9d30"}}, "download_size": 8150596, "dataset_size": 18980509, "size_in_bytes": 27131105}, "ModLewis": {"description": "The Reuters-21578 dataset is one of the most widely used data collections for text\ncategorization research. It is collected from the Reuters financial newswire service in 1987.\n", "citation": "@article{APTE94,\nauthor = {Chidanand Apt{'{e}} and Fred Damerau and Sholom M. Weiss},\ntitle = {Automated Learning of Decision Rules for Text Categorization},\njournal = {ACM Transactions on Information Systems},\nyear = {1994}, \nnote = {To appear.}\n}\n\n@inproceedings{APTE94b,\nauthor = {Chidanand Apt{'{e}} and Fred Damerau and Sholom M. Weiss},\ntitle = {Toward Language Independent Automated Learning of Text Categorization Models},\nbooktitle = {sigir94},\nyear = {1994},\nnote = {To appear.}\n}\n\n@inproceedings{HAYES8},\nauthor = {Philip J. Hayes and Peggy M. Anderson and Irene B. Nirenburg and \nLinda M. Schmandt},\ntitle = {{TCS}: A Shell for Content-Based Text Categorization},\nbooktitle = {IEEE Conference on Artificial Intelligence Applications},\nyear = {1990}\n}\n\n@inproceedings{HAYES90b,\nauthor = {Philip J. Hayes and Steven P. Weinstein},\ntitle = {{CONSTRUE/TIS:} A System for Content-Based Indexing of a \nDatabase of News Stories},\nbooktitle = {Second Annual Conference on Innovative Applications of\nArtificial Intelligence},\nyear = {1990}\n}\n\n@incollection{HAYES92 ,\nauthor = {Philip J. Hayes},\ntitle = {Intelligent High-Volume Text Processing using Shallow,\nDomain-Specific Techniques},\nbooktitle = {Text-Based Intelligent Systems},\npublisher = {Lawrence Erlbaum},\naddress = {Hillsdale, NJ},\nyear = {1992},\neditor = {Paul S. Jacobs}\n}\n\n@inproceedings{LEWIS91c ,\nauthor = {David D. Lewis},\ntitle = {Evaluating Text Categorization},\nbooktitle = {Proceedings of Speech and Natural Language Workshop},\nyear = {1991},\nmonth = {feb},\norganization = {Defense Advanced Research Projects Agency},\npublisher = {Morgan Kaufmann},\npages = {312--318}\n\n}\n\n@phdthesis{LEWIS91d,\nauthor = {David Dolan Lewis},\ntitle = {Representation and Learning in Information Retrieval},\nschool = {Computer Science Dept.; Univ. of Massachusetts; Amherst, MA 01003},\nyear = 1992},\nnote = {Technical Report 91--93.}\n}\n\n@inproceedings{LEWIS91e,\nauthor = {David D. Lewis},\ntitle = {Data Extraction as Text Categorization: An Experiment with\nthe {MUC-3} Corpus},\nbooktitle = {Proceedings of the Third Message Understanding Evaluation\nand Conference},\nyear = {1991},\nmonth = {may},\norganization = {Defense Advanced Research Projects Agency},\npublisher = {Morgan Kaufmann},\naddress = {Los Altos, CA}\n\n}\n\n@inproceedings{LEWIS92b,\nauthor = {David D. Lewis},\ntitle = {An Evaluation of Phrasal and Clustered Representations on a Text\nCategorization Task},\nbooktitle = {Fifteenth Annual International ACM SIGIR Conference on\nResearch and Development in Information Retrieval},\nyear = {1992},\npages = {37--50}\n}\n\n@inproceedings{LEWIS92d ,\nauthor = {David D. Lewis and Richard M. Tong},\ntitle = {Text Filtering in {MUC-3} and {MUC-4}},\nbooktitle = {Proceedings of the Fourth Message Understanding Conference ({MUC-4})},\nyear = {1992},\nmonth = {jun},\norganization = {Defense Advanced Research Projects Agency},\npublisher = {Morgan Kaufmann},\naddress = {Los Altos, CA}\n}\n\n@inproceedings{LEWIS92e,\nauthor = {David D. Lewis},\ntitle = {Feature Selection and Feature Extraction for Text Categorization},\nbooktitle = {Proceedings of Speech and Natural Language Workshop},\nyear = {1992},\nmonth = {feb} ,\norganization = {Defense Advanced Research Projects Agency},\npublisher = {Morgan Kaufmann},\npages = {212--217}\n}\n\n@inproceedings{LEWIS94b,\nauthor = {David D. Lewis and Marc Ringuette},\ntitle = {A Comparison of Two Learning Algorithms for Text Categorization},\nbooktitle = {Symposium on Document Analysis and Information Retrieval},\nyear = {1994},\norganization = {ISRI; Univ. of Nevada, Las Vegas},\naddress = {Las Vegas, NV},\nmonth = {apr},\npages = {81--93}\n}\n\n@article{LEWIS94d, \nauthor = {David D. Lewis and Philip J. Hayes}, \ntitle = {Guest Editorial}, \njournal = {ACM Transactions on Information Systems}, \nyear = {1994}, \nvolume = {12}, \nnumber = {3}, \npages = {231}, \nmonth = {jul}\n}\n\n@article{SPARCKJONES76,\nauthor = {K. {Sparck Jones} and C. J. {van Rijsbergen}},\ntitle = {Information Retrieval Test Collections},\njournal = {Journal of Documentation},\nyear = {1976},\nvolume = {32},\nnumber = {1},\npages = {59--75}\n}\n\n@book{WEISS91,\nauthor = {Sholom M. Weiss and Casimir A. Kulikowski},\ntitle = {Computer Systems That Learn},\npublisher = {Morgan Kaufmann},\nyear = {1991},\naddress = {San Mateo, CA}\n}\n", "homepage": "https://kdd.ics.uci.edu/databases/reuters21578/reuters21578.html", "license": "", "features": {"text": {"dtype": "string", "id": null, "_type": "Value"}, "topics": {"feature": {"dtype": "string", "id": null, "_type": "Value"}, "length": -1, "id": null, "_type": "Sequence"}, "lewis_split": {"dtype": "string", "id": null, "_type": "Value"}, "cgis_split": {"dtype": "string", "id": null, "_type": "Value"}, "old_id": {"dtype": "string", "id": null, "_type": "Value"}, "new_id": {"dtype": "string", "id": null, "_type": "Value"}, "places": {"feature": {"dtype": "string", "id": null, "_type": "Value"}, "length": -1, "id": null, "_type": "Sequence"}, "people": {"feature": {"dtype": "string", "id": null, "_type": "Value"}, "length": -1, "id": null, "_type": "Sequence"}, "orgs": {"feature": {"dtype": "string", "id": null, "_type": "Value"}, "length": -1, "id": null, "_type": "Sequence"}, "exchanges": {"feature": {"dtype": "string", "id": null, "_type": "Value"}, "length": -1, "id": null, "_type": "Sequence"}, "date": {"dtype": "string", "id": null, "_type": "Value"}, "title": {"dtype": "string", "id": null, "_type": "Value"}}, "supervised_keys": null, "builder_name": "reuters21578", "config_name": "ModLewis", "version": {"version_str": "1.0.0", "description": "", "datasets_version_to_prepare": null, "major": 1, "minor": 0, "patch": 0}, "splits": {"test": {"name": "test", "num_bytes": 5172249, "num_examples": 5458, "dataset_name": "reuters21578"}, "train": {"name": "train", "num_bytes": 12496933, "num_examples": 12449, "dataset_name": "reuters21578"}, "unused": {"name": "unused", "num_bytes": 930193, "num_examples": 720, "dataset_name": "reuters21578"}}, "download_checksums": {"https://kdd.ics.uci.edu/databases/reuters21578/reuters21578.tar.gz": {"num_bytes": 8150596, "checksum": "3bae43c9b14e387f76a61b6d82bf98a4fb5d3ef99ef7e7075ff2ccbcf59f9d30"}}, "download_size": 8150596, "dataset_size": 18599375, "size_in_bytes": 26749971}, "ModApte": {"description": "The Reuters-21578 dataset is one of the most widely used data collections for text\ncategorization research. It is collected from the Reuters financial newswire service in 1987.\n", "citation": "@article{APTE94,\nauthor = {Chidanand Apt{'{e}} and Fred Damerau and Sholom M. Weiss},\ntitle = {Automated Learning of Decision Rules for Text Categorization},\njournal = {ACM Transactions on Information Systems},\nyear = {1994}, \nnote = {To appear.}\n}\n\n@inproceedings{APTE94b,\nauthor = {Chidanand Apt{'{e}} and Fred Damerau and Sholom M. Weiss},\ntitle = {Toward Language Independent Automated Learning of Text Categorization Models},\nbooktitle = {sigir94},\nyear = {1994},\nnote = {To appear.}\n}\n\n@inproceedings{HAYES8},\nauthor = {Philip J. Hayes and Peggy M. Anderson and Irene B. Nirenburg and \nLinda M. Schmandt},\ntitle = {{TCS}: A Shell for Content-Based Text Categorization},\nbooktitle = {IEEE Conference on Artificial Intelligence Applications},\nyear = {1990}\n}\n\n@inproceedings{HAYES90b,\nauthor = {Philip J. Hayes and Steven P. Weinstein},\ntitle = {{CONSTRUE/TIS:} A System for Content-Based Indexing of a \nDatabase of News Stories},\nbooktitle = {Second Annual Conference on Innovative Applications of\nArtificial Intelligence},\nyear = {1990}\n}\n\n@incollection{HAYES92 ,\nauthor = {Philip J. Hayes},\ntitle = {Intelligent High-Volume Text Processing using Shallow,\nDomain-Specific Techniques},\nbooktitle = {Text-Based Intelligent Systems},\npublisher = {Lawrence Erlbaum},\naddress = {Hillsdale, NJ},\nyear = {1992},\neditor = {Paul S. Jacobs}\n}\n\n@inproceedings{LEWIS91c ,\nauthor = {David D. Lewis},\ntitle = {Evaluating Text Categorization},\nbooktitle = {Proceedings of Speech and Natural Language Workshop},\nyear = {1991},\nmonth = {feb},\norganization = {Defense Advanced Research Projects Agency},\npublisher = {Morgan Kaufmann},\npages = {312--318}\n\n}\n\n@phdthesis{LEWIS91d,\nauthor = {David Dolan Lewis},\ntitle = {Representation and Learning in Information Retrieval},\nschool = {Computer Science Dept.; Univ. of Massachusetts; Amherst, MA 01003},\nyear = 1992},\nnote = {Technical Report 91--93.}\n}\n\n@inproceedings{LEWIS91e,\nauthor = {David D. Lewis},\ntitle = {Data Extraction as Text Categorization: An Experiment with\nthe {MUC-3} Corpus},\nbooktitle = {Proceedings of the Third Message Understanding Evaluation\nand Conference},\nyear = {1991},\nmonth = {may},\norganization = {Defense Advanced Research Projects Agency},\npublisher = {Morgan Kaufmann},\naddress = {Los Altos, CA}\n\n}\n\n@inproceedings{LEWIS92b,\nauthor = {David D. Lewis},\ntitle = {An Evaluation of Phrasal and Clustered Representations on a Text\nCategorization Task},\nbooktitle = {Fifteenth Annual International ACM SIGIR Conference on\nResearch and Development in Information Retrieval},\nyear = {1992},\npages = {37--50}\n}\n\n@inproceedings{LEWIS92d ,\nauthor = {David D. Lewis and Richard M. Tong},\ntitle = {Text Filtering in {MUC-3} and {MUC-4}},\nbooktitle = {Proceedings of the Fourth Message Understanding Conference ({MUC-4})},\nyear = {1992},\nmonth = {jun},\norganization = {Defense Advanced Research Projects Agency},\npublisher = {Morgan Kaufmann},\naddress = {Los Altos, CA}\n}\n\n@inproceedings{LEWIS92e,\nauthor = {David D. Lewis},\ntitle = {Feature Selection and Feature Extraction for Text Categorization},\nbooktitle = {Proceedings of Speech and Natural Language Workshop},\nyear = {1992},\nmonth = {feb} ,\norganization = {Defense Advanced Research Projects Agency},\npublisher = {Morgan Kaufmann},\npages = {212--217}\n}\n\n@inproceedings{LEWIS94b,\nauthor = {David D. Lewis and Marc Ringuette},\ntitle = {A Comparison of Two Learning Algorithms for Text Categorization},\nbooktitle = {Symposium on Document Analysis and Information Retrieval},\nyear = {1994},\norganization = {ISRI; Univ. of Nevada, Las Vegas},\naddress = {Las Vegas, NV},\nmonth = {apr},\npages = {81--93}\n}\n\n@article{LEWIS94d, \nauthor = {David D. Lewis and Philip J. Hayes}, \ntitle = {Guest Editorial}, \njournal = {ACM Transactions on Information Systems}, \nyear = {1994}, \nvolume = {12}, \nnumber = {3}, \npages = {231}, \nmonth = {jul}\n}\n\n@article{SPARCKJONES76,\nauthor = {K. {Sparck Jones} and C. J. {van Rijsbergen}},\ntitle = {Information Retrieval Test Collections},\njournal = {Journal of Documentation},\nyear = {1976},\nvolume = {32},\nnumber = {1},\npages = {59--75}\n}\n\n@book{WEISS91,\nauthor = {Sholom M. Weiss and Casimir A. Kulikowski},\ntitle = {Computer Systems That Learn},\npublisher = {Morgan Kaufmann},\nyear = {1991},\naddress = {San Mateo, CA}\n}\n", "homepage": "https://kdd.ics.uci.edu/databases/reuters21578/reuters21578.html", "license": "", "features": {"text": {"dtype": "string", "id": null, "_type": "Value"}, "topics": {"feature": {"dtype": "string", "id": null, "_type": "Value"}, "length": -1, "id": null, "_type": "Sequence"}, "lewis_split": {"dtype": "string", "id": null, "_type": "Value"}, "cgis_split": {"dtype": "string", "id": null, "_type": "Value"}, "old_id": {"dtype": "string", "id": null, "_type": "Value"}, "new_id": {"dtype": "string", "id": null, "_type": "Value"}, "places": {"feature": {"dtype": "string", "id": null, "_type": "Value"}, "length": -1, "id": null, "_type": "Sequence"}, "people": {"feature": {"dtype": "string", "id": null, "_type": "Value"}, "length": -1, "id": null, "_type": "Sequence"}, "orgs": {"feature": {"dtype": "string", "id": null, "_type": "Value"}, "length": -1, "id": null, "_type": "Sequence"}, "exchanges": {"feature": {"dtype": "string", "id": null, "_type": "Value"}, "length": -1, "id": null, "_type": "Sequence"}, "date": {"dtype": "string", "id": null, "_type": "Value"}, "title": {"dtype": "string", "id": null, "_type": "Value"}}, "supervised_keys": null, "builder_name": "reuters21578", "config_name": "ModApte", "version": {"version_str": "1.0.0", "description": "", "datasets_version_to_prepare": null, "major": 1, "minor": 0, "patch": 0}, "splits": {"test": {"name": "test", "num_bytes": 2848935, "num_examples": 3009, "dataset_name": "reuters21578"}, "train": {"name": "train", "num_bytes": 8778391, "num_examples": 8762, "dataset_name": "reuters21578"}, "unused": {"name": "unused", "num_bytes": 930193, "num_examples": 720, "dataset_name": "reuters21578"}}, "download_checksums": {"https://kdd.ics.uci.edu/databases/reuters21578/reuters21578.tar.gz": {"num_bytes": 8150596, "checksum": "3bae43c9b14e387f76a61b6d82bf98a4fb5d3ef99ef7e7075ff2ccbcf59f9d30"}}, "download_size": 8150596, "dataset_size": 12557519, "size_in_bytes": 20708115}}
|
dummy/ModApte/1.0.0/dummy_data.zip
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:0860062df325d712b51a16719baa51a8371812d65a36378928b6b0329aec8ae1
|
| 3 |
+
size 22278
|
dummy/ModHayes/1.0.0/dummy_data.zip
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:0860062df325d712b51a16719baa51a8371812d65a36378928b6b0329aec8ae1
|
| 3 |
+
size 22278
|
dummy/ModLewis/1.0.0/dummy_data.zip
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:0860062df325d712b51a16719baa51a8371812d65a36378928b6b0329aec8ae1
|
| 3 |
+
size 22278
|
reuters21578.py
ADDED
|
@@ -0,0 +1,402 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 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 |
+
"""Reuters 21578"""
|
| 18 |
+
|
| 19 |
+
from __future__ import absolute_import, division, print_function
|
| 20 |
+
|
| 21 |
+
import os
|
| 22 |
+
from textwrap import dedent
|
| 23 |
+
|
| 24 |
+
import datasets
|
| 25 |
+
|
| 26 |
+
|
| 27 |
+
_CITATION = """\
|
| 28 |
+
@article{APTE94,
|
| 29 |
+
author = {Chidanand Apt{\'{e}} and Fred Damerau and Sholom M. Weiss},
|
| 30 |
+
title = {Automated Learning of Decision Rules for Text Categorization},
|
| 31 |
+
journal = {ACM Transactions on Information Systems},
|
| 32 |
+
year = {1994},
|
| 33 |
+
note = {To appear.}
|
| 34 |
+
}
|
| 35 |
+
|
| 36 |
+
@inproceedings{APTE94b,
|
| 37 |
+
author = {Chidanand Apt{\'{e}} and Fred Damerau and Sholom M. Weiss},
|
| 38 |
+
title = {Toward Language Independent Automated Learning of Text Categorization Models},
|
| 39 |
+
booktitle = {sigir94},
|
| 40 |
+
year = {1994},
|
| 41 |
+
note = {To appear.}
|
| 42 |
+
}
|
| 43 |
+
|
| 44 |
+
@inproceedings{HAYES8},
|
| 45 |
+
author = {Philip J. Hayes and Peggy M. Anderson and Irene B. Nirenburg and
|
| 46 |
+
Linda M. Schmandt},
|
| 47 |
+
title = {{TCS}: A Shell for Content-Based Text Categorization},
|
| 48 |
+
booktitle = {IEEE Conference on Artificial Intelligence Applications},
|
| 49 |
+
year = {1990}
|
| 50 |
+
}
|
| 51 |
+
|
| 52 |
+
@inproceedings{HAYES90b,
|
| 53 |
+
author = {Philip J. Hayes and Steven P. Weinstein},
|
| 54 |
+
title = {{CONSTRUE/TIS:} A System for Content-Based Indexing of a
|
| 55 |
+
Database of News Stories},
|
| 56 |
+
booktitle = {Second Annual Conference on Innovative Applications of
|
| 57 |
+
Artificial Intelligence},
|
| 58 |
+
year = {1990}
|
| 59 |
+
}
|
| 60 |
+
|
| 61 |
+
@incollection{HAYES92 ,
|
| 62 |
+
author = {Philip J. Hayes},
|
| 63 |
+
title = {Intelligent High-Volume Text Processing using Shallow,
|
| 64 |
+
Domain-Specific Techniques},
|
| 65 |
+
booktitle = {Text-Based Intelligent Systems},
|
| 66 |
+
publisher = {Lawrence Erlbaum},
|
| 67 |
+
address = {Hillsdale, NJ},
|
| 68 |
+
year = {1992},
|
| 69 |
+
editor = {Paul S. Jacobs}
|
| 70 |
+
}
|
| 71 |
+
|
| 72 |
+
@inproceedings{LEWIS91c ,
|
| 73 |
+
author = {David D. Lewis},
|
| 74 |
+
title = {Evaluating Text Categorization},
|
| 75 |
+
booktitle = {Proceedings of Speech and Natural Language Workshop},
|
| 76 |
+
year = {1991},
|
| 77 |
+
month = {feb},
|
| 78 |
+
organization = {Defense Advanced Research Projects Agency},
|
| 79 |
+
publisher = {Morgan Kaufmann},
|
| 80 |
+
pages = {312--318}
|
| 81 |
+
|
| 82 |
+
}
|
| 83 |
+
|
| 84 |
+
@phdthesis{LEWIS91d,
|
| 85 |
+
author = {David Dolan Lewis},
|
| 86 |
+
title = {Representation and Learning in Information Retrieval},
|
| 87 |
+
school = {Computer Science Dept.; Univ. of Massachusetts; Amherst, MA 01003},
|
| 88 |
+
year = 1992},
|
| 89 |
+
note = {Technical Report 91--93.}
|
| 90 |
+
}
|
| 91 |
+
|
| 92 |
+
@inproceedings{LEWIS91e,
|
| 93 |
+
author = {David D. Lewis},
|
| 94 |
+
title = {Data Extraction as Text Categorization: An Experiment with
|
| 95 |
+
the {MUC-3} Corpus},
|
| 96 |
+
booktitle = {Proceedings of the Third Message Understanding Evaluation
|
| 97 |
+
and Conference},
|
| 98 |
+
year = {1991},
|
| 99 |
+
month = {may},
|
| 100 |
+
organization = {Defense Advanced Research Projects Agency},
|
| 101 |
+
publisher = {Morgan Kaufmann},
|
| 102 |
+
address = {Los Altos, CA}
|
| 103 |
+
|
| 104 |
+
}
|
| 105 |
+
|
| 106 |
+
@inproceedings{LEWIS92b,
|
| 107 |
+
author = {David D. Lewis},
|
| 108 |
+
title = {An Evaluation of Phrasal and Clustered Representations on a Text
|
| 109 |
+
Categorization Task},
|
| 110 |
+
booktitle = {Fifteenth Annual International ACM SIGIR Conference on
|
| 111 |
+
Research and Development in Information Retrieval},
|
| 112 |
+
year = {1992},
|
| 113 |
+
pages = {37--50}
|
| 114 |
+
}
|
| 115 |
+
|
| 116 |
+
@inproceedings{LEWIS92d ,
|
| 117 |
+
author = {David D. Lewis and Richard M. Tong},
|
| 118 |
+
title = {Text Filtering in {MUC-3} and {MUC-4}},
|
| 119 |
+
booktitle = {Proceedings of the Fourth Message Understanding Conference ({MUC-4})},
|
| 120 |
+
year = {1992},
|
| 121 |
+
month = {jun},
|
| 122 |
+
organization = {Defense Advanced Research Projects Agency},
|
| 123 |
+
publisher = {Morgan Kaufmann},
|
| 124 |
+
address = {Los Altos, CA}
|
| 125 |
+
}
|
| 126 |
+
|
| 127 |
+
@inproceedings{LEWIS92e,
|
| 128 |
+
author = {David D. Lewis},
|
| 129 |
+
title = {Feature Selection and Feature Extraction for Text Categorization},
|
| 130 |
+
booktitle = {Proceedings of Speech and Natural Language Workshop},
|
| 131 |
+
year = {1992},
|
| 132 |
+
month = {feb} ,
|
| 133 |
+
organization = {Defense Advanced Research Projects Agency},
|
| 134 |
+
publisher = {Morgan Kaufmann},
|
| 135 |
+
pages = {212--217}
|
| 136 |
+
}
|
| 137 |
+
|
| 138 |
+
@inproceedings{LEWIS94b,
|
| 139 |
+
author = {David D. Lewis and Marc Ringuette},
|
| 140 |
+
title = {A Comparison of Two Learning Algorithms for Text Categorization},
|
| 141 |
+
booktitle = {Symposium on Document Analysis and Information Retrieval},
|
| 142 |
+
year = {1994},
|
| 143 |
+
organization = {ISRI; Univ. of Nevada, Las Vegas},
|
| 144 |
+
address = {Las Vegas, NV},
|
| 145 |
+
month = {apr},
|
| 146 |
+
pages = {81--93}
|
| 147 |
+
}
|
| 148 |
+
|
| 149 |
+
@article{LEWIS94d,
|
| 150 |
+
author = {David D. Lewis and Philip J. Hayes},
|
| 151 |
+
title = {Guest Editorial},
|
| 152 |
+
journal = {ACM Transactions on Information Systems},
|
| 153 |
+
year = {1994},
|
| 154 |
+
volume = {12},
|
| 155 |
+
number = {3},
|
| 156 |
+
pages = {231},
|
| 157 |
+
month = {jul}
|
| 158 |
+
}
|
| 159 |
+
|
| 160 |
+
@article{SPARCKJONES76,
|
| 161 |
+
author = {K. {Sparck Jones} and C. J. {van Rijsbergen}},
|
| 162 |
+
title = {Information Retrieval Test Collections},
|
| 163 |
+
journal = {Journal of Documentation},
|
| 164 |
+
year = {1976},
|
| 165 |
+
volume = {32},
|
| 166 |
+
number = {1},
|
| 167 |
+
pages = {59--75}
|
| 168 |
+
}
|
| 169 |
+
|
| 170 |
+
@book{WEISS91,
|
| 171 |
+
author = {Sholom M. Weiss and Casimir A. Kulikowski},
|
| 172 |
+
title = {Computer Systems That Learn},
|
| 173 |
+
publisher = {Morgan Kaufmann},
|
| 174 |
+
year = {1991},
|
| 175 |
+
address = {San Mateo, CA}
|
| 176 |
+
}
|
| 177 |
+
"""
|
| 178 |
+
|
| 179 |
+
_DESCRIPTION = """\
|
| 180 |
+
The Reuters-21578 dataset is one of the most widely used data collections for text
|
| 181 |
+
categorization research. It is collected from the Reuters financial newswire service in 1987.
|
| 182 |
+
"""
|
| 183 |
+
|
| 184 |
+
_DATA_URL = "https://kdd.ics.uci.edu/databases/reuters21578/reuters21578.tar.gz"
|
| 185 |
+
|
| 186 |
+
|
| 187 |
+
class Reuters21578Config(datasets.BuilderConfig):
|
| 188 |
+
"""BuilderConfig for reuters-21578."""
|
| 189 |
+
|
| 190 |
+
def __init__(self, **kwargs):
|
| 191 |
+
"""BuilderConfig for Reuters21578.
|
| 192 |
+
|
| 193 |
+
Args:
|
| 194 |
+
**kwargs: keyword arguments forwarded to super.
|
| 195 |
+
"""
|
| 196 |
+
super(Reuters21578Config, self).__init__(version=datasets.Version("1.0.0", ""), **kwargs)
|
| 197 |
+
|
| 198 |
+
|
| 199 |
+
class Reuters21578(datasets.GeneratorBasedBuilder):
|
| 200 |
+
"""Reuters 21578"""
|
| 201 |
+
|
| 202 |
+
BUILDER_CONFIGS = [
|
| 203 |
+
Reuters21578Config(
|
| 204 |
+
name="ModHayes",
|
| 205 |
+
description=dedent(
|
| 206 |
+
"""Training Set (20856 docs): CGISPLIT="TRAINING-SET"
|
| 207 |
+
Test Set (722 docs): CGISPLIT="PUBLISHED-TESTSET"
|
| 208 |
+
Unused (0 docs)"""
|
| 209 |
+
),
|
| 210 |
+
),
|
| 211 |
+
Reuters21578Config(
|
| 212 |
+
name="ModLewis",
|
| 213 |
+
description=dedent(
|
| 214 |
+
"""Training Set (13,625 docs): LEWISSPLIT="TRAIN"; TOPICS="YES" or "NO"
|
| 215 |
+
Test Set (6,188 docs): LEWISSPLIT="TEST"; TOPICS="YES" or "NO"
|
| 216 |
+
Unused (1,765): LEWISSPLIT="NOT-USED" or TOPICS="BYPASS"""
|
| 217 |
+
),
|
| 218 |
+
),
|
| 219 |
+
Reuters21578Config(
|
| 220 |
+
name="ModApte",
|
| 221 |
+
description=dedent(
|
| 222 |
+
"""Training Set (9,603 docs): LEWISSPLIT="TRAIN"; TOPICS="YES"
|
| 223 |
+
Test Set (3,299 docs): LEWISSPLIT="TEST"; TOPICS="YES"
|
| 224 |
+
Unused (8,676 docs): LEWISSPLIT="NOT-USED"; TOPICS="YES" or TOPICS="NO" or TOPICS="BYPASS" """
|
| 225 |
+
),
|
| 226 |
+
),
|
| 227 |
+
]
|
| 228 |
+
|
| 229 |
+
def _info(self):
|
| 230 |
+
return datasets.DatasetInfo(
|
| 231 |
+
description=_DESCRIPTION,
|
| 232 |
+
features=datasets.Features(
|
| 233 |
+
{
|
| 234 |
+
"text": datasets.Value("string"),
|
| 235 |
+
"topics": datasets.Sequence(datasets.Value("string")),
|
| 236 |
+
"lewis_split": datasets.Value("string"),
|
| 237 |
+
"cgis_split": datasets.Value("string"),
|
| 238 |
+
"old_id": datasets.Value("string"),
|
| 239 |
+
"new_id": datasets.Value("string"),
|
| 240 |
+
"places": datasets.Sequence(datasets.Value("string")),
|
| 241 |
+
"people": datasets.Sequence(datasets.Value("string")),
|
| 242 |
+
"orgs": datasets.Sequence(datasets.Value("string")),
|
| 243 |
+
"exchanges": datasets.Sequence(datasets.Value("string")),
|
| 244 |
+
"date": datasets.Value("string"),
|
| 245 |
+
"title": datasets.Value("string"),
|
| 246 |
+
}
|
| 247 |
+
),
|
| 248 |
+
# No default supervised_keys (as we have to pass both premise
|
| 249 |
+
# and hypothesis as input).
|
| 250 |
+
supervised_keys=None,
|
| 251 |
+
homepage="https://kdd.ics.uci.edu/databases/reuters21578/reuters21578.html",
|
| 252 |
+
citation=_CITATION,
|
| 253 |
+
)
|
| 254 |
+
|
| 255 |
+
def _split_generators(self, dl_manager):
|
| 256 |
+
dl_dir = dl_manager.download_and_extract(_DATA_URL)
|
| 257 |
+
files = [os.path.join(dl_dir, "reut2-" + "%03d" % i + ".sgm") for i in range(22)]
|
| 258 |
+
if self.config.name == "ModHayes":
|
| 259 |
+
return [
|
| 260 |
+
datasets.SplitGenerator(
|
| 261 |
+
name=datasets.Split.TEST,
|
| 262 |
+
gen_kwargs={
|
| 263 |
+
"filepath": files,
|
| 264 |
+
"split": "PUBLISHED-TESTSET",
|
| 265 |
+
},
|
| 266 |
+
),
|
| 267 |
+
datasets.SplitGenerator(
|
| 268 |
+
name=datasets.Split.TRAIN,
|
| 269 |
+
gen_kwargs={
|
| 270 |
+
"filepath": files,
|
| 271 |
+
"split": "TRAINING-SET",
|
| 272 |
+
},
|
| 273 |
+
),
|
| 274 |
+
]
|
| 275 |
+
else:
|
| 276 |
+
return [
|
| 277 |
+
datasets.SplitGenerator(
|
| 278 |
+
name=datasets.Split.TEST,
|
| 279 |
+
gen_kwargs={
|
| 280 |
+
"filepath": files,
|
| 281 |
+
"split": "TEST",
|
| 282 |
+
},
|
| 283 |
+
),
|
| 284 |
+
datasets.SplitGenerator(name=datasets.Split.TRAIN, gen_kwargs={"filepath": files, "split": "TRAIN"}),
|
| 285 |
+
datasets.SplitGenerator(name="unused", gen_kwargs={"filepath": files, "split": "NOT-USED"}),
|
| 286 |
+
]
|
| 287 |
+
|
| 288 |
+
def _generate_examples(self, filepath, split):
|
| 289 |
+
"""This function returns the examples in the raw (text) form."""
|
| 290 |
+
for file in filepath:
|
| 291 |
+
with open(
|
| 292 |
+
file, encoding="utf-8", errors="ignore"
|
| 293 |
+
) as f: # only the file reut2-017 has one line non UTF-8 encoded so we can ignore it
|
| 294 |
+
line = f.readline()
|
| 295 |
+
lewis_split = ""
|
| 296 |
+
cgis_split = ""
|
| 297 |
+
old_id = ""
|
| 298 |
+
new_id = ""
|
| 299 |
+
topics = []
|
| 300 |
+
places = []
|
| 301 |
+
people = []
|
| 302 |
+
orgs = []
|
| 303 |
+
exchanges = []
|
| 304 |
+
date = ""
|
| 305 |
+
title = ""
|
| 306 |
+
while line:
|
| 307 |
+
if line.startswith("<REUTERS"):
|
| 308 |
+
line = line.split()
|
| 309 |
+
lewis_split = line[2].split("=")[1]
|
| 310 |
+
cgis_split = line[3].split("=")[1]
|
| 311 |
+
old_id = line[4].split("=")[1]
|
| 312 |
+
new_id = line[5].split("=")[1][:-1]
|
| 313 |
+
has_topic = line[1].split("=")[1]
|
| 314 |
+
line = f.readline()
|
| 315 |
+
if (
|
| 316 |
+
(self.config.name == "ModHayes" and split not in cgis_split)
|
| 317 |
+
or (
|
| 318 |
+
self.config.name == "ModLewis"
|
| 319 |
+
and (
|
| 320 |
+
(split not in lewis_split)
|
| 321 |
+
or (split == "TRAIN" and has_topic not in ['"YES"', '"NO"'])
|
| 322 |
+
or (split == "TEST" and has_topic not in ['"YES"', '"NO"'])
|
| 323 |
+
or (split == "NOT-USED" and has_topic not in ['"YES"', '"NO"', '"BYPASS"'])
|
| 324 |
+
)
|
| 325 |
+
)
|
| 326 |
+
or (
|
| 327 |
+
self.config.name == "ModApte"
|
| 328 |
+
and (
|
| 329 |
+
split not in lewis_split
|
| 330 |
+
or (split == "TRAIN" and has_topic != '"YES"')
|
| 331 |
+
or (split == "TEST" and has_topic != '"YES"')
|
| 332 |
+
or (split == "NOT-USED" and has_topic not in ['"YES"', '"NO"', '"BYPASS"'])
|
| 333 |
+
)
|
| 334 |
+
)
|
| 335 |
+
): # skip example that are not in the current split
|
| 336 |
+
li = line
|
| 337 |
+
while li and not li.startswith("<REUTERS"):
|
| 338 |
+
li = f.readline()
|
| 339 |
+
if li:
|
| 340 |
+
line = li
|
| 341 |
+
elif line.startswith("<TOPICS>"):
|
| 342 |
+
if line.replace("\n", "") != "<TOPICS></TOPICS>":
|
| 343 |
+
line = line.split("<D>")
|
| 344 |
+
topics = [topic.replace("</D>", "") for topic in line[1:-1]]
|
| 345 |
+
topics = [topic.replace("</TOPICS>", "") for topic in topics]
|
| 346 |
+
line = f.readline()
|
| 347 |
+
elif line.startswith("<PLACES>"):
|
| 348 |
+
if line.replace("\n", "") != "<PLACES></PLACES>":
|
| 349 |
+
line = line.split("<D>")
|
| 350 |
+
places = [place.replace("</D>", "") for place in line[1:-1]]
|
| 351 |
+
places = [place.replace("</PLACES>", "") for place in places]
|
| 352 |
+
line = f.readline()
|
| 353 |
+
elif line.startswith("<PEOPLE>"):
|
| 354 |
+
if line.replace("\n", "") != "<PEOPLE></PEOPLE>":
|
| 355 |
+
line = line.split("<D>")
|
| 356 |
+
people = [p.replace("</D>", "") for p in line[1:-1]]
|
| 357 |
+
people = [p.replace("</PEOPLE>", "") for p in people]
|
| 358 |
+
line = f.readline()
|
| 359 |
+
elif line.startswith("<ORGS>"):
|
| 360 |
+
if line.replace("\n", "") != "<ORGS></ORGS>":
|
| 361 |
+
line = line.split("<D>")
|
| 362 |
+
orgs = [org.replace("</D>", "") for org in line[1:-1]]
|
| 363 |
+
orgs = [org.replace("</ORGS>", "") for org in orgs]
|
| 364 |
+
line = f.readline()
|
| 365 |
+
elif line.startswith("<EXCHANGES>"):
|
| 366 |
+
if line.replace("\n", "") != "<EXCHANGES></EXCHANGES>":
|
| 367 |
+
line = line.split("<D>")
|
| 368 |
+
exchanges = [ex.replace("</D>", "") for ex in line[1:-1]]
|
| 369 |
+
exchanges = [ex.replace("</EXCHANGES>", "") for ex in exchanges]
|
| 370 |
+
line = f.readline()
|
| 371 |
+
elif line.startswith("<DATE>"):
|
| 372 |
+
date = line.replace("\n", "")
|
| 373 |
+
date = line[6:-8]
|
| 374 |
+
line = f.readline()
|
| 375 |
+
elif line.startswith("<TITLE>"):
|
| 376 |
+
title = line[7:-9]
|
| 377 |
+
line = f.readline()
|
| 378 |
+
elif "<BODY>" in line:
|
| 379 |
+
text = line.split("<BODY>")[1]
|
| 380 |
+
line = f.readline()
|
| 381 |
+
while "</BODY>" not in line:
|
| 382 |
+
text += line
|
| 383 |
+
line = f.readline()
|
| 384 |
+
|
| 385 |
+
yield new_id, {
|
| 386 |
+
"lewis_split": lewis_split,
|
| 387 |
+
"cgis_split": cgis_split,
|
| 388 |
+
"old_id": old_id,
|
| 389 |
+
"new_id": new_id,
|
| 390 |
+
"topics": topics,
|
| 391 |
+
"places": places,
|
| 392 |
+
"people": people,
|
| 393 |
+
"orgs": orgs,
|
| 394 |
+
"exchanges": exchanges,
|
| 395 |
+
"date": date,
|
| 396 |
+
"title": title,
|
| 397 |
+
"text": text,
|
| 398 |
+
}
|
| 399 |
+
line = f.readline()
|
| 400 |
+
|
| 401 |
+
else:
|
| 402 |
+
line = f.readline()
|