danpovey / pocolm

Small language toolkit for creation, interpolation and pruning of ARPA language models
Other
90 stars 48 forks source link

add work_dir argument to train_lm.py #66

Closed wantee closed 7 years ago

wantee commented 8 years ago

Addressing issue #65.

Only change the final lm_dir to the user specified dir, while keeping the internal names of subdir in work_dir. Since it could easily make mistakes when skipping or cleaning up some dirs if we rely on the name provide by user(e.g. after trained a 3-gram model, the user decide to train a 4-gram model, but forget to change the lm_dir name, train_lm.py will skip the training). However, now it will make the user harder to find the corresponding working dir for their lm.

For the 'epilog', the argparse.ArgumentDefaultsHelpFormatter in python will not show the newlines and spaces in our help text. I found some solutions in here, but there is no simple solution, we have to subclass the argparse.HelpFormatter. Do we need to do that?

danpovey commented 8 years ago

Oh I see that argparse does strip out the newlines.
The easiest fix may be just to format the usage message in such a way that doesn't rely on the spaces in it, e.g. enclose example command lines in single quotes.

wantee commented 8 years ago

Make the '--lm-dir' an optional argument.

If it is OK now, I should squash the commits before merging.