Get WMT data into data_dir, create vocabularies and tokenize data. Args: data_dir: directory in which the data sets will be stored. en_vocabulary_size: size of the English vocabulary to create and use. fr_vocabulary_size: size of the French vocabulary to create and use. tokenizer:
(data_dir, en_vocabulary_size, fr_vocabulary_size, tokenizer=None)
| 209 | |
| 210 | |
| 211 | def prepare_wmt_data(data_dir, en_vocabulary_size, fr_vocabulary_size, tokenizer=None): |
| 212 | """Get WMT data into data_dir, create vocabularies and tokenize data. |
| 213 | |
| 214 | Args: |
| 215 | data_dir: directory in which the data sets will be stored. |
| 216 | en_vocabulary_size: size of the English vocabulary to create and use. |
| 217 | fr_vocabulary_size: size of the French vocabulary to create and use. |
| 218 | tokenizer: a function to use to tokenize each data sentence; |
| 219 | if None, basic_tokenizer will be used. |
| 220 | |
| 221 | Returns: |
| 222 | A tuple of 6 elements: |
| 223 | (1) path to the token-ids for English training data-set, |
| 224 | (2) path to the token-ids for French training data-set, |
| 225 | (3) path to the token-ids for English development data-set, |
| 226 | (4) path to the token-ids for French development data-set, |
| 227 | (5) path to the English vocabulary file, |
| 228 | (6) path to the French vocabulary file. |
| 229 | """ |
| 230 | # Get wmt data to the specified directory. |
| 231 | train_path = get_wmt_enfr_train_set(data_dir) |
| 232 | dev_path = get_wmt_enfr_dev_set(data_dir) |
| 233 | |
| 234 | input_train_path = train_path + ".input" |
| 235 | output_train_path = train_path + ".output" |
| 236 | input_dev_path = dev_path + ".input" |
| 237 | output_dev_path = dev_path + ".output" |
| 238 | return prepare_data(data_dir, input_train_path, output_train_path, input_dev_path, output_dev_path, en_vocabulary_size, |
| 239 | fr_vocabulary_size, tokenizer) |
| 240 | |
| 241 | |
| 242 | def prepare_data(data_dir, input_train_path, output_train_path, input_dev_path, output_dev_path, input_vocabulary_size, |
nothing calls this directly
no test coverage detected