Commit
•
abbd3d3
0
Parent(s):
Update files from the datasets library (from 1.2.0)
Browse filesRelease notes: https://github.com/huggingface/datasets/releases/tag/1.2.0
- .gitattributes +27 -0
- README.md +170 -0
- dataset_infos.json +1 -0
- dummy/en-fr/1.0.0/dummy_data.zip +3 -0
- dummy/en-it/1.0.0/dummy_data.zip +3 -0
- dummy/fi-nl/1.0.0/dummy_data.zip +3 -0
- dummy/it-ro/1.0.0/dummy_data.zip +3 -0
- dummy/nl-sv/1.0.0/dummy_data.zip +3 -0
- php.py +130 -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
|
README.md
ADDED
@@ -0,0 +1,170 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
---
|
2 |
+
annotations_creators:
|
3 |
+
- found
|
4 |
+
language_creators:
|
5 |
+
- found
|
6 |
+
languages:
|
7 |
+
- cs
|
8 |
+
- de
|
9 |
+
- en
|
10 |
+
- es
|
11 |
+
- fi
|
12 |
+
- fr
|
13 |
+
- he
|
14 |
+
- hu
|
15 |
+
- it
|
16 |
+
- ja
|
17 |
+
- ko
|
18 |
+
- nl
|
19 |
+
- pl
|
20 |
+
- pt_BR
|
21 |
+
- ro
|
22 |
+
- ru
|
23 |
+
- sk
|
24 |
+
- sl
|
25 |
+
- sv
|
26 |
+
- tr
|
27 |
+
- tw
|
28 |
+
- zh
|
29 |
+
- zh_TW
|
30 |
+
licenses:
|
31 |
+
- unknown
|
32 |
+
multilinguality:
|
33 |
+
- multilingual
|
34 |
+
size_categories:
|
35 |
+
- 10K<n<100K
|
36 |
+
source_datasets:
|
37 |
+
- original
|
38 |
+
task_categories:
|
39 |
+
- conditional-text-generation
|
40 |
+
task_ids:
|
41 |
+
- machine-translation
|
42 |
+
---
|
43 |
+
|
44 |
+
# Dataset Card Creation Guide
|
45 |
+
|
46 |
+
## Table of Contents
|
47 |
+
- [Dataset Description](#dataset-description)
|
48 |
+
- [Dataset Summary](#dataset-summary)
|
49 |
+
- [Supported Tasks](#supported-tasks-and-leaderboards)
|
50 |
+
- [Languages](#languages)
|
51 |
+
- [Dataset Structure](#dataset-structure)
|
52 |
+
- [Data Instances](#data-instances)
|
53 |
+
- [Data Fields](#data-instances)
|
54 |
+
- [Data Splits](#data-instances)
|
55 |
+
- [Dataset Creation](#dataset-creation)
|
56 |
+
- [Curation Rationale](#curation-rationale)
|
57 |
+
- [Source Data](#source-data)
|
58 |
+
- [Annotations](#annotations)
|
59 |
+
- [Personal and Sensitive Information](#personal-and-sensitive-information)
|
60 |
+
- [Considerations for Using the Data](#considerations-for-using-the-data)
|
61 |
+
- [Social Impact of Dataset](#social-impact-of-dataset)
|
62 |
+
- [Discussion of Biases](#discussion-of-biases)
|
63 |
+
- [Other Known Limitations](#other-known-limitations)
|
64 |
+
- [Additional Information](#additional-information)
|
65 |
+
- [Dataset Curators](#dataset-curators)
|
66 |
+
- [Licensing Information](#licensing-information)
|
67 |
+
- [Citation Information](#citation-information)
|
68 |
+
|
69 |
+
## Dataset Description
|
70 |
+
|
71 |
+
- **Homepage:** http://opus.nlpl.eu/PHP.php
|
72 |
+
- **Repository:** None
|
73 |
+
- **Paper:** http://www.lrec-conf.org/proceedings/lrec2012/pdf/463_Paper.pdf
|
74 |
+
- **Leaderboard:** [More Information Needed]
|
75 |
+
- **Point of Contact:** [More Information Needed]
|
76 |
+
|
77 |
+
### Dataset Summary
|
78 |
+
|
79 |
+
|
80 |
+
To load a language pair which isn't part of the config, all you need to do is specify the language code as pairs.
|
81 |
+
You can find the valid pairs in Homepage section of Dataset Description: http://opus.nlpl.eu/PHP.php
|
82 |
+
E.g.
|
83 |
+
|
84 |
+
`dataset = load_dataset("php", lang1="it", lang2="pl")`
|
85 |
+
|
86 |
+
|
87 |
+
### Supported Tasks and Leaderboards
|
88 |
+
|
89 |
+
[More Information Needed]
|
90 |
+
|
91 |
+
### Languages
|
92 |
+
|
93 |
+
[More Information Needed]
|
94 |
+
|
95 |
+
## Dataset Structure
|
96 |
+
|
97 |
+
### Data Instances
|
98 |
+
|
99 |
+
Here are some examples of questions and facts:
|
100 |
+
|
101 |
+
|
102 |
+
### Data Fields
|
103 |
+
|
104 |
+
[More Information Needed]
|
105 |
+
|
106 |
+
### Data Splits
|
107 |
+
|
108 |
+
[More Information Needed]
|
109 |
+
|
110 |
+
## Dataset Creation
|
111 |
+
|
112 |
+
### Curation Rationale
|
113 |
+
|
114 |
+
[More Information Needed]
|
115 |
+
|
116 |
+
### Source Data
|
117 |
+
|
118 |
+
[More Information Needed]
|
119 |
+
|
120 |
+
#### Initial Data Collection and Normalization
|
121 |
+
|
122 |
+
[More Information Needed]
|
123 |
+
|
124 |
+
#### Who are the source language producers?
|
125 |
+
|
126 |
+
[More Information Needed]
|
127 |
+
|
128 |
+
### Annotations
|
129 |
+
|
130 |
+
[More Information Needed]
|
131 |
+
|
132 |
+
#### Annotation process
|
133 |
+
|
134 |
+
[More Information Needed]
|
135 |
+
|
136 |
+
#### Who are the annotators?
|
137 |
+
|
138 |
+
[More Information Needed]
|
139 |
+
|
140 |
+
### Personal and Sensitive Information
|
141 |
+
|
142 |
+
[More Information Needed]
|
143 |
+
|
144 |
+
## Considerations for Using the Data
|
145 |
+
|
146 |
+
### Social Impact of Dataset
|
147 |
+
|
148 |
+
[More Information Needed]
|
149 |
+
|
150 |
+
### Discussion of Biases
|
151 |
+
|
152 |
+
[More Information Needed]
|
153 |
+
|
154 |
+
### Other Known Limitations
|
155 |
+
|
156 |
+
[More Information Needed]
|
157 |
+
|
158 |
+
## Additional Information
|
159 |
+
|
160 |
+
### Dataset Curators
|
161 |
+
|
162 |
+
[More Information Needed]
|
163 |
+
|
164 |
+
### Licensing Information
|
165 |
+
|
166 |
+
[More Information Needed]
|
167 |
+
|
168 |
+
### Citation Information
|
169 |
+
|
170 |
+
[More Information Needed]
|
dataset_infos.json
ADDED
@@ -0,0 +1 @@
|
|
|
|
|
1 |
+
{"fi-nl": {"description": "A parallel corpus originally extracted from http://se.php.net/download-docs.php. The original documents are written in English and have been partly translated into 21 languages. The original manuals contain about 500,000 words. The amount of actually translated texts varies for different languages between 50,000 and 380,000 words. The corpus is rather noisy and may include parts from the English original in some of the translations. The corpus is tokenized and each language pair has been sentence aligned.\n\n23 languages, 252 bitexts\ntotal number of files: 71,414\ntotal number of tokens: 3.28M\ntotal number of sentence fragments: 1.38M\n", "citation": "@InProceedings{TIEDEMANN12.463,\n author = {J\ufffdrg Tiedemann},\n title = {Parallel Data, Tools and Interfaces in OPUS},\n booktitle = {Proceedings of the Eight International Conference on Language Resources and Evaluation (LREC'12)},\n year = {2012},\n month = {may},\n date = {23-25},\n address = {Istanbul, Turkey},\n editor = {Nicoletta Calzolari (Conference Chair) and Khalid Choukri and Thierry Declerck and Mehmet Ugur Dogan and Bente Maegaard and Joseph Mariani and Jan Odijk and Stelios Piperidis},\n publisher = {European Language Resources Association (ELRA)},\n isbn = {978-2-9517408-7-7},\n language = {english}\n }\n", "homepage": "http://opus.nlpl.eu/PHP.php", "license": "", "features": {"id": {"dtype": "string", "id": null, "_type": "Value"}, "translation": {"languages": ["fi", "nl"], "id": null, "_type": "Translation"}}, "post_processed": null, "supervised_keys": null, "builder_name": "php", "config_name": "fi-nl", "version": {"version_str": "1.0.0", "description": "", "major": 1, "minor": 0, "patch": 0}, "splits": {"train": {"name": "train", "num_bytes": 1197502, "num_examples": 27870, "dataset_name": "php"}}, "download_checksums": {"https://object.pouta.csc.fi/OPUS-PHP/v1/moses/fi-nl.txt.zip": {"num_bytes": 43228, "checksum": "6b2bb485e1adf455fd13c86919b0f9cbddb90134b2f50f6feb72d05f542d6ac3"}}, "download_size": 43228, "post_processing_size": null, "dataset_size": 1197502, "size_in_bytes": 1240730}, "it-ro": {"description": "A parallel corpus originally extracted from http://se.php.net/download-docs.php. The original documents are written in English and have been partly translated into 21 languages. The original manuals contain about 500,000 words. The amount of actually translated texts varies for different languages between 50,000 and 380,000 words. The corpus is rather noisy and may include parts from the English original in some of the translations. The corpus is tokenized and each language pair has been sentence aligned.\n\n23 languages, 252 bitexts\ntotal number of files: 71,414\ntotal number of tokens: 3.28M\ntotal number of sentence fragments: 1.38M\n", "citation": "@InProceedings{TIEDEMANN12.463,\n author = {J\ufffdrg Tiedemann},\n title = {Parallel Data, Tools and Interfaces in OPUS},\n booktitle = {Proceedings of the Eight International Conference on Language Resources and Evaluation (LREC'12)},\n year = {2012},\n month = {may},\n date = {23-25},\n address = {Istanbul, Turkey},\n editor = {Nicoletta Calzolari (Conference Chair) and Khalid Choukri and Thierry Declerck and Mehmet Ugur Dogan and Bente Maegaard and Joseph Mariani and Jan Odijk and Stelios Piperidis},\n publisher = {European Language Resources Association (ELRA)},\n isbn = {978-2-9517408-7-7},\n language = {english}\n }\n", "homepage": "http://opus.nlpl.eu/PHP.php", "license": "", "features": {"id": {"dtype": "string", "id": null, "_type": "Value"}, "translation": {"languages": ["it", "ro"], "id": null, "_type": "Translation"}}, "post_processed": null, "supervised_keys": null, "builder_name": "php", "config_name": "it-ro", "version": {"version_str": "1.0.0", "description": "", "major": 1, "minor": 0, "patch": 0}, "splits": {"train": {"name": "train", "num_bytes": 1422966, "num_examples": 28507, "dataset_name": "php"}}, "download_checksums": {"https://object.pouta.csc.fi/OPUS-PHP/v1/moses/it-ro.txt.zip": {"num_bytes": 108885, "checksum": "5fe607608a7cd100c2a831dcaa379d49023c91067be364bf869019f5e6884e1b"}}, "download_size": 108885, "post_processing_size": null, "dataset_size": 1422966, "size_in_bytes": 1531851}, "nl-sv": {"description": "A parallel corpus originally extracted from http://se.php.net/download-docs.php. The original documents are written in English and have been partly translated into 21 languages. The original manuals contain about 500,000 words. The amount of actually translated texts varies for different languages between 50,000 and 380,000 words. The corpus is rather noisy and may include parts from the English original in some of the translations. The corpus is tokenized and each language pair has been sentence aligned.\n\n23 languages, 252 bitexts\ntotal number of files: 71,414\ntotal number of tokens: 3.28M\ntotal number of sentence fragments: 1.38M\n", "citation": "@InProceedings{TIEDEMANN12.463,\n author = {J\ufffdrg Tiedemann},\n title = {Parallel Data, Tools and Interfaces in OPUS},\n booktitle = {Proceedings of the Eight International Conference on Language Resources and Evaluation (LREC'12)},\n year = {2012},\n month = {may},\n date = {23-25},\n address = {Istanbul, Turkey},\n editor = {Nicoletta Calzolari (Conference Chair) and Khalid Choukri and Thierry Declerck and Mehmet Ugur Dogan and Bente Maegaard and Joseph Mariani and Jan Odijk and Stelios Piperidis},\n publisher = {European Language Resources Association (ELRA)},\n isbn = {978-2-9517408-7-7},\n language = {english}\n }\n", "homepage": "http://opus.nlpl.eu/PHP.php", "license": "", "features": {"id": {"dtype": "string", "id": null, "_type": "Value"}, "translation": {"languages": ["nl", "sv"], "id": null, "_type": "Translation"}}, "post_processed": null, "supervised_keys": null, "builder_name": "php", "config_name": "nl-sv", "version": {"version_str": "1.0.0", "description": "", "major": 1, "minor": 0, "patch": 0}, "splits": {"train": {"name": "train", "num_bytes": 1298041, "num_examples": 28079, "dataset_name": "php"}}, "download_checksums": {"https://object.pouta.csc.fi/OPUS-PHP/v1/moses/nl-sv.txt.zip": {"num_bytes": 58495, "checksum": "37f41509924b20f89213852ee34da970dc0a86a2b39f79537f83795ec13aa963"}}, "download_size": 58495, "post_processing_size": null, "dataset_size": 1298041, "size_in_bytes": 1356536}, "en-it": {"description": "A parallel corpus originally extracted from http://se.php.net/download-docs.php. The original documents are written in English and have been partly translated into 21 languages. The original manuals contain about 500,000 words. The amount of actually translated texts varies for different languages between 50,000 and 380,000 words. The corpus is rather noisy and may include parts from the English original in some of the translations. The corpus is tokenized and each language pair has been sentence aligned.\n\n23 languages, 252 bitexts\ntotal number of files: 71,414\ntotal number of tokens: 3.28M\ntotal number of sentence fragments: 1.38M\n", "citation": "@InProceedings{TIEDEMANN12.463,\n author = {J\ufffdrg Tiedemann},\n title = {Parallel Data, Tools and Interfaces in OPUS},\n booktitle = {Proceedings of the Eight International Conference on Language Resources and Evaluation (LREC'12)},\n year = {2012},\n month = {may},\n date = {23-25},\n address = {Istanbul, Turkey},\n editor = {Nicoletta Calzolari (Conference Chair) and Khalid Choukri and Thierry Declerck and Mehmet Ugur Dogan and Bente Maegaard and Joseph Mariani and Jan Odijk and Stelios Piperidis},\n publisher = {European Language Resources Association (ELRA)},\n isbn = {978-2-9517408-7-7},\n language = {english}\n }\n", "homepage": "http://opus.nlpl.eu/PHP.php", "license": "", "features": {"id": {"dtype": "string", "id": null, "_type": "Value"}, "translation": {"languages": ["en", "it"], "id": null, "_type": "Translation"}}, "post_processed": null, "supervised_keys": null, "builder_name": "php", "config_name": "en-it", "version": {"version_str": "1.0.0", "description": "", "major": 1, "minor": 0, "patch": 0}, "splits": {"train": {"name": "train", "num_bytes": 2758463, "num_examples": 35538, "dataset_name": "php"}}, "download_checksums": {"https://object.pouta.csc.fi/OPUS-PHP/v1/moses/en-it.txt.zip": {"num_bytes": 478646, "checksum": "ef92df20636cc67a8d58dd8761553b713269a51d4b94e62c57d5b0d65f71c9bf"}}, "download_size": 478646, "post_processing_size": null, "dataset_size": 2758463, "size_in_bytes": 3237109}, "en-fr": {"description": "A parallel corpus originally extracted from http://se.php.net/download-docs.php. The original documents are written in English and have been partly translated into 21 languages. The original manuals contain about 500,000 words. The amount of actually translated texts varies for different languages between 50,000 and 380,000 words. The corpus is rather noisy and may include parts from the English original in some of the translations. The corpus is tokenized and each language pair has been sentence aligned.\n\n23 languages, 252 bitexts\ntotal number of files: 71,414\ntotal number of tokens: 3.28M\ntotal number of sentence fragments: 1.38M\n", "citation": "@InProceedings{TIEDEMANN12.463,\n author = {J\ufffdrg Tiedemann},\n title = {Parallel Data, Tools and Interfaces in OPUS},\n booktitle = {Proceedings of the Eight International Conference on Language Resources and Evaluation (LREC'12)},\n year = {2012},\n month = {may},\n date = {23-25},\n address = {Istanbul, Turkey},\n editor = {Nicoletta Calzolari (Conference Chair) and Khalid Choukri and Thierry Declerck and Mehmet Ugur Dogan and Bente Maegaard and Joseph Mariani and Jan Odijk and Stelios Piperidis},\n publisher = {European Language Resources Association (ELRA)},\n isbn = {978-2-9517408-7-7},\n language = {english}\n }\n", "homepage": "http://opus.nlpl.eu/PHP.php", "license": "", "features": {"id": {"dtype": "string", "id": null, "_type": "Value"}, "translation": {"languages": ["en", "fr"], "id": null, "_type": "Translation"}}, "post_processed": null, "supervised_keys": null, "builder_name": "php", "config_name": "en-fr", "version": {"version_str": "1.0.0", "description": "", "major": 1, "minor": 0, "patch": 0}, "splits": {"train": {"name": "train", "num_bytes": 4288513, "num_examples": 42222, "dataset_name": "php"}}, "download_checksums": {"https://object.pouta.csc.fi/OPUS-PHP/v1/moses/en-fr.txt.zip": {"num_bytes": 905396, "checksum": "8333c4eb66abb019578197d78238b15e1c32f20805a1f4ce76ac084a43a3b866"}}, "download_size": 905396, "post_processing_size": null, "dataset_size": 4288513, "size_in_bytes": 5193909}}
|
dummy/en-fr/1.0.0/dummy_data.zip
ADDED
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
1 |
+
version https://git-lfs.github.com/spec/v1
|
2 |
+
oid sha256:990a3fc7484362850c604f58d4c0f3755f3f6ca3400137193cc3378c1e9fc8b3
|
3 |
+
size 651
|
dummy/en-it/1.0.0/dummy_data.zip
ADDED
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
1 |
+
version https://git-lfs.github.com/spec/v1
|
2 |
+
oid sha256:e6eca91ddc27cb2ebfca3be151f9027698119fec451e80709c0090e34bdaa2e3
|
3 |
+
size 653
|
dummy/fi-nl/1.0.0/dummy_data.zip
ADDED
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
1 |
+
version https://git-lfs.github.com/spec/v1
|
2 |
+
oid sha256:63d811d2d7da9c59063cf1ae76f16debf57d79af91f84343c664382d7a5f16cd
|
3 |
+
size 639
|
dummy/it-ro/1.0.0/dummy_data.zip
ADDED
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
1 |
+
version https://git-lfs.github.com/spec/v1
|
2 |
+
oid sha256:01aaa2b6f05a499f27714b5908f09d7ae6b295fa39c7dda8c0eafe876f5ed64e
|
3 |
+
size 669
|
dummy/nl-sv/1.0.0/dummy_data.zip
ADDED
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
1 |
+
version https://git-lfs.github.com/spec/v1
|
2 |
+
oid sha256:d67f48cb3d5160f902c691cc2988ca8297934986ed84021dcace72ff091e0922
|
3 |
+
size 641
|
php.py
ADDED
@@ -0,0 +1,130 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
# coding=utf-8
|
2 |
+
# Copyright 2020 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 |
+
import os
|
18 |
+
|
19 |
+
import datasets
|
20 |
+
|
21 |
+
|
22 |
+
_DESCRIPTION = """\
|
23 |
+
A parallel corpus originally extracted from http://se.php.net/download-docs.php. The original documents are written in English and have been partly translated into 21 languages. The original manuals contain about 500,000 words. The amount of actually translated texts varies for different languages between 50,000 and 380,000 words. The corpus is rather noisy and may include parts from the English original in some of the translations. The corpus is tokenized and each language pair has been sentence aligned.
|
24 |
+
|
25 |
+
23 languages, 252 bitexts
|
26 |
+
total number of files: 71,414
|
27 |
+
total number of tokens: 3.28M
|
28 |
+
total number of sentence fragments: 1.38M
|
29 |
+
"""
|
30 |
+
_HOMEPAGE_URL = "http://opus.nlpl.eu/PHP.php"
|
31 |
+
_CITATION = """\
|
32 |
+
@InProceedings{TIEDEMANN12.463,
|
33 |
+
author = {J{\"o}rg Tiedemann},
|
34 |
+
title = {Parallel Data, Tools and Interfaces in OPUS},
|
35 |
+
booktitle = {Proceedings of the Eight International Conference on Language Resources and Evaluation (LREC'12)},
|
36 |
+
year = {2012},
|
37 |
+
month = {may},
|
38 |
+
date = {23-25},
|
39 |
+
address = {Istanbul, Turkey},
|
40 |
+
editor = {Nicoletta Calzolari (Conference Chair) and Khalid Choukri and Thierry Declerck and Mehmet Ugur Dogan and Bente Maegaard and Joseph Mariani and Jan Odijk and Stelios Piperidis},
|
41 |
+
publisher = {European Language Resources Association (ELRA)},
|
42 |
+
isbn = {978-2-9517408-7-7},
|
43 |
+
language = {english}
|
44 |
+
}
|
45 |
+
"""
|
46 |
+
|
47 |
+
_VERSION = "1.0.0"
|
48 |
+
_BASE_NAME = "PHP.{}.{}"
|
49 |
+
_BASE_URL = "https://object.pouta.csc.fi/OPUS-PHP/v1/moses/{}-{}.txt.zip"
|
50 |
+
|
51 |
+
# Please note that only few pairs are shown here. You can use config to generate data for all language pairs
|
52 |
+
_LANGUAGE_PAIRS = [
|
53 |
+
("fi", "nl"),
|
54 |
+
("it", "ro"),
|
55 |
+
("nl", "sv"),
|
56 |
+
("en", "it"),
|
57 |
+
("en", "fr"),
|
58 |
+
]
|
59 |
+
|
60 |
+
|
61 |
+
class PhpConfig(datasets.BuilderConfig):
|
62 |
+
def __init__(self, *args, lang1=None, lang2=None, **kwargs):
|
63 |
+
super().__init__(
|
64 |
+
*args,
|
65 |
+
name=f"{lang1}-{lang2}",
|
66 |
+
**kwargs,
|
67 |
+
)
|
68 |
+
self.lang1 = lang1
|
69 |
+
self.lang2 = lang2
|
70 |
+
|
71 |
+
|
72 |
+
class Php(datasets.GeneratorBasedBuilder):
|
73 |
+
BUILDER_CONFIGS = [
|
74 |
+
PhpConfig(
|
75 |
+
lang1=lang1,
|
76 |
+
lang2=lang2,
|
77 |
+
description=f"Translating {lang1} to {lang2} or vice versa",
|
78 |
+
version=datasets.Version(_VERSION),
|
79 |
+
)
|
80 |
+
for lang1, lang2 in _LANGUAGE_PAIRS
|
81 |
+
]
|
82 |
+
BUILDER_CONFIG_CLASS = PhpConfig
|
83 |
+
|
84 |
+
def _info(self):
|
85 |
+
return datasets.DatasetInfo(
|
86 |
+
description=_DESCRIPTION,
|
87 |
+
features=datasets.Features(
|
88 |
+
{
|
89 |
+
"id": datasets.Value("string"),
|
90 |
+
"translation": datasets.Translation(languages=(self.config.lang1, self.config.lang2)),
|
91 |
+
},
|
92 |
+
),
|
93 |
+
supervised_keys=None,
|
94 |
+
homepage=_HOMEPAGE_URL,
|
95 |
+
citation=_CITATION,
|
96 |
+
)
|
97 |
+
|
98 |
+
def _split_generators(self, dl_manager):
|
99 |
+
def _base_url(lang1, lang2):
|
100 |
+
return _BASE_URL.format(lang1, lang2)
|
101 |
+
|
102 |
+
download_url = _base_url(self.config.lang1, self.config.lang2)
|
103 |
+
path = dl_manager.download_and_extract(download_url)
|
104 |
+
return [
|
105 |
+
datasets.SplitGenerator(
|
106 |
+
name=datasets.Split.TRAIN,
|
107 |
+
gen_kwargs={"datapath": path},
|
108 |
+
)
|
109 |
+
]
|
110 |
+
|
111 |
+
def _generate_examples(self, datapath):
|
112 |
+
l1, l2 = self.config.lang1, self.config.lang2
|
113 |
+
folder = l1 + "-" + l2
|
114 |
+
l1_file = _BASE_NAME.format(folder, l1)
|
115 |
+
l2_file = _BASE_NAME.format(folder, l2)
|
116 |
+
l1_path = os.path.join(datapath, l1_file)
|
117 |
+
l2_path = os.path.join(datapath, l2_file)
|
118 |
+
with open(l1_path, encoding="utf-8") as f1, open(l2_path, encoding="utf-8") as f2:
|
119 |
+
for sentence_counter, (x, y) in enumerate(zip(f1, f2)):
|
120 |
+
x = x.strip()
|
121 |
+
y = y.strip()
|
122 |
+
result = (
|
123 |
+
sentence_counter,
|
124 |
+
{
|
125 |
+
"id": str(sentence_counter),
|
126 |
+
"translation": {l1: x, l2: y},
|
127 |
+
},
|
128 |
+
)
|
129 |
+
sentence_counter += 1
|
130 |
+
yield result
|