一.生成bpe模型和词典
subword-nmt learn-joint-bpe-and-vocab --input corpus.path -s 30000 --output en.bpe --wirte-vovocabulary dict.en.txt
#corpus.path:语料路径
#en.bpe:bpe模型
#dict.en.txt:英文词典
二.根据bpe模型对语料进行切分
subword-nmt apply-bpe -c en.bpe < corpus.path > corpus.bpe
#corpus.bpe:bpe后的语料
三.使用fairseq根据词典和语料训练模型
1.将corpus切分出训练集、验证集、测试集
sed -n 1,1000000p corpus.bpe > train.en
2.执行preprocess文件
python $FILE/preprocess.py \
--source-lang en --target-lang zh \
--trainpref $DATA/train --validpref $DATA \
--destdir $DATA/preprocess \
--srcdict dict.en.txt \
--tgtdict dict.zh.txt \