added support for preventing dashed words to be broken in the word injestion scripts
This commit is contained in:
parent
4b7cef763a
commit
e58af0d45f
2 changed files with 38 additions and 23 deletions
|
|
@ -1,8 +1,8 @@
|
|||
#!/bin/bash
|
||||
|
||||
if [ $# -lt 4 ]; then
|
||||
echo "Usage: $0 LOCALE base-dictionary-file.csv new-words-file.txt frequency-file.csv"
|
||||
echo 'Cleans up and adds new words to a dictionary file.'
|
||||
echo "Usage: $0 LOCALE base-dictionary-file.csv new-words-file.txt frequency-file.csv [ignore-split-list.txt]"
|
||||
echo 'Cleans up and adds new words to a dictionary file. Optionally, it could skip splitting the words from "ignore-split-list.txt"'
|
||||
echo 'LOCALE could be any valid JS locale, for exmaple: en, en-US, etc...'
|
||||
exit 1
|
||||
fi
|
||||
|
|
@ -22,15 +22,17 @@ if ! [[ -f $4 ]]; then
|
|||
exit 2
|
||||
fi
|
||||
|
||||
|
||||
LOCALE=$1
|
||||
DICTIONARY_FILE=$2
|
||||
NEW_WORDS_FILE=$3
|
||||
FREQUENCY_FILE=$4
|
||||
IGNORE_SPLIT_LIST_FILE=$5
|
||||
WORK_DIR="/tmp/TT9_$(uuidgen)"
|
||||
|
||||
mkdir -p $WORK_DIR && \
|
||||
sed -E 's/[\t0-9]+//g' $DICTIONARY_FILE > $WORK_DIR/_TT9_base.txt \
|
||||
&& node scripts/injest-words.js $NEW_WORDS_FILE > $WORK_DIR/_TT9_1.txt \
|
||||
&& node scripts/injest-words.js $NEW_WORDS_FILE $IGNORE_SPLIT_LIST_FILE > $WORK_DIR/_TT9_1.txt \
|
||||
&& node scripts/remove-foreign-words.js $LOCALE $WORK_DIR/_TT9_1.txt $LOCALE $WORK_DIR/_TT9_base.txt > $WORK_DIR/_TT9_2.txt \
|
||||
&& cp $WORK_DIR/_TT9_base.txt $WORK_DIR/_TT9_combined.txt \
|
||||
&& echo >> $WORK_DIR/_TT9_combined.txt \
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue