You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
26 lines
607 B
26 lines
607 B
#!/usr/bin/env python |
|
import pathlib |
|
|
|
import segment_zh |
|
import segment_ja |
|
import segmenter_lib |
|
|
|
|
|
def _Run(tokenizer, path): |
|
with open(path, 'rb') as f: |
|
input = f.readlines() |
|
|
|
output = segmenter_lib.SegmentPo(input, tokenizer) |
|
|
|
with open(path, 'wb') as f: |
|
f.write(b''.join(output)) |
|
|
|
|
|
root = pathlib.Path(__file__).resolve().parent.parent.parent |
|
|
|
zh_tokenizer = segment_zh.ZhTokenizer() |
|
_Run(zh_tokenizer, root.joinpath("Translations/zh_CN.po")) |
|
_Run(zh_tokenizer, root.joinpath("Translations/zh_TW.po")) |
|
|
|
ja_tokenizer = segment_ja.JaTokenizer() |
|
_Run(ja_tokenizer, root.joinpath("Translations/ja.po"))
|
|
|