recommend subword_nmt.py as alternative to pip install in README

This commit is contained in:
Rico Sennrich 2018-05-16 16:32:55 +01:00
parent bbf885decb
commit 748377374e
3 changed files with 15 additions and 9 deletions

View File

@ -34,6 +34,9 @@ The original segmentation can be restored with a simple replacement:
sed -r 's/(@@ )|(@@ ?$)//g'
If you cloned the repository and did not install a package, you can also run `subword_nmt.py` as a script:
./subword-nmt/subword_nmt.py learn-bpe -s {num_operations} < {train_file} > {codes_file}
BEST PRACTICE ADVICE FOR BYTE PAIR ENCODING IN NMT
--------------------------------------------------

View File

@ -19,7 +19,7 @@ setup(
test_suite='setup.test_suite',
packages=find_packages(),
entry_points={
'console_scripts': ['subword-nmt=subword_nmt.command_line:main'],
'console_scripts': ['subword-nmt=subword_nmt.subword_nmt:main'],
},
include_package_data=True
)

View File

@ -1,17 +1,20 @@
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import io
import sys
import codecs
import argparse
from subword_nmt.learn_bpe import learn_bpe
from subword_nmt.apply_bpe import BPE, read_vocabulary
from subword_nmt.get_vocab import get_vocab
from subword_nmt.learn_joint_bpe_and_vocab import learn_joint_bpe_and_vocab
from learn_bpe import learn_bpe
from apply_bpe import BPE, read_vocabulary
from get_vocab import get_vocab
from learn_joint_bpe_and_vocab import learn_joint_bpe_and_vocab
from subword_nmt.learn_bpe import create_parser as create_learn_bpe_parser
from subword_nmt.apply_bpe import create_parser as create_apply_bpe_parser
from subword_nmt.get_vocab import create_parser as create_get_vocab_parser
from subword_nmt.learn_joint_bpe_and_vocab import create_parser as create_learn_joint_bpe_and_vocab_parser
from learn_bpe import create_parser as create_learn_bpe_parser
from apply_bpe import create_parser as create_apply_bpe_parser
from get_vocab import create_parser as create_get_vocab_parser
from learn_joint_bpe_and_vocab import create_parser as create_learn_joint_bpe_and_vocab_parser
# hack for python2/3 compatibility
argparse.open = io.open