Kyubyong / neural_japanese_transliterator
- понедельник, 12 июня 2017 г. в 03:11:31
Python
Can neural networks transliterate Romaji into Japanese correctly?
In this project, I examine how well neural networks can convert Roman letters into the Japanese script, i.e., Hiragana, Katakana, or Kanji. The accuracy evaluation results for 896 Japanese test sentences outperform the SwiftKey™ keyboard, a well-known smartphone multilingual keyboard, by a small margin. It seems that neural networks can learn this task easily and quickly.
I frame the problem as a seq2seq task.
Inputs: nihongo。
Outputs: 日本語。
data/test.csv
.I adopted the encoder and the first decoder architecture of Tacotron, a speech synthesis model.
hyperparams.py
contains hyperparameters. You can change the value if necessary.annotate.py
makes Romaji-Japanese parallel sentences.prepro.py
defines and makes vocabulary and training data.modules.py
has building blocks for networks.networks.py
has encoding and decoding networks.data_load.py
covers some functions regarding data loading.utils.py
has utility functions.train.py
is about training.eval.py
is about evaluation.jpn_news_2005-2008_1M-sentences.txt
to data/
folder.hyperparams.py
if necessary.python annotate.py
.python prepro.py
. Or download the preprocessed files.train.py
. Or download the pretrained files.eval.py
.The training curve looks like this.
The evaluation metric is CER (Character Error Rate). Its formula is
The following is the results after five epochs. Details are available in results/*.csv
.
Mine (Greedy decoding) | Mine (Beam decoding) | SwiftKey 6.4.8.57 |
---|---|---|
1618/12057=0.13 | 1576/12057=0.13 | 1640/12057=0.13 |