Write vocab file to disk. Vocab files have one token per line. The file ends in a newline. Reserved tokens are written to the vocab file as well. Args: filename: Full path of the file to store the vocab to.
(self, filename)
| 288 | return self.seg_index |
| 289 | |
| 290 | def store_to_file(self, filename): |
| 291 | """Write vocab file to disk. |
| 292 | |
| 293 | Vocab files have one token per line. The file ends in a newline. Reserved |
| 294 | tokens are written to the vocab file as well. |
| 295 | |
| 296 | Args: |
| 297 | filename: Full path of the file to store the vocab to. |
| 298 | """ |
| 299 | with open(filename, "w") as f: |
| 300 | for i in range(len(self._id_to_token)): |
| 301 | f.write(self._id_to_token[i] + "\n") |
| 302 | |
| 303 | def sil_phonemes(self): |
| 304 | return [p for p in self._id_to_token.values() if not p[0].isalpha()] |
nothing calls this directly
no outgoing calls
no test coverage detected