lmc (1301B)
1 #!/bin/bash 2 # 3 # DESCRIPTION 4 # 5 # Given a list of sentences, create a statistical language model. 6 # 7 # (Produces a binary language model from plain sentence list. Invokes 8 # CMU-created perl script located in /opt/vmc/lib. Saves file in given 9 # directory.) 10 # 11 # USAGE: 12 # 13 # lmc sentence-list lm-filename save-directory 14 # 15 # VARIABLES =================================================================== 16 17 sentence_list_path=$1 18 lm_filename=$2 19 save_directory=$3 20 21 lib_dir=/opt/vmc/lib 22 23 # CHECK IF HELP NEEDED ======================================================== 24 25 if [[ -z $1 ]]; then 26 echo -e "\nUSAGE: \tlmc " 27 echo -e "\n\tsentence_list_file\t(input file with sample sentences)" 28 echo -e "\toutput_lm_file_name\t(desired base name of output lm file)" 29 echo -e "\tsave_directory\t\t(location to save the ouput file into)\n" 30 exit 1 31 fi 32 33 # COMMANDS ==================================================================== 34 35 # run perl script to create language model 36 perl $lib_dir/quick_lm.pl -s $sentence_list_path #&> /dev/null 37 38 # rename output 39 mv "$sentence_list_path.arpabo" "$save_directory/$lm_filename.lm" 40 41 # convert lm from text to binary 42 filenamedir=$save_directory/$lm_filename.lm 43 sphinx_lm_convert -i $filenamedir -o $filenamedir.bin &> /dev/null