| 1 |
#!/bin/bash |
| 2 |
# Copyright (C) 2009-2011 Antonio Bonafonte |
| 3 |
# Universitat Politècnica de Catalunya, Barcelona, Spain |
| 4 |
# |
| 5 |
# This script is free software; you can redistribute it and/or |
| 6 |
# modify it under the terms of the GNU Lesser General Public |
| 7 |
# License as published by the Free Software Foundation, |
| 8 |
# version 2.1 of the License. |
| 9 |
# |
| 10 |
# This library is distributed in the hope that it will be useful, |
| 11 |
# but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 12 |
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
| 13 |
# Lesser General Public License for more details. |
| 14 |
# |
| 15 |
# You should have received a copy of the GNU Lesser General Public |
| 16 |
# License along with this library; if not, write to the Free Software |
| 17 |
# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA |
| 18 |
|
| 19 |
if [ ! -f "${NGRAM_BUILD}" ]; then |
| 20 |
if [ ! -d "$ESTDIR" ];then |
| 21 |
NGRAM_BUILD=$(which ngram_build) || ( echo "Could not find ngram_build"; exit 1 ) |
| 22 |
else |
| 23 |
NGRAM_BUILD="$ESTDIR/bin/ngram_build" |
| 24 |
fi |
| 25 |
fi |
| 26 |
|
| 27 |
infile1="$1" |
| 28 |
infile2="$2" |
| 29 |
outfile="$3" |
| 30 |
${NGRAM_BUILD} "${infile1}" -o "${outfile}" -otype cstr_bin -w "${infile2}" -order 3 -smooth 15 -input_format sentence_per_line -dense -backoff 3 -floor 100 -freqsmooth 15 -oov_mode use_oov_marker -default_tags || exit 1 |