Skip to content

Instantly share code, notes, and snippets.

@prostoiChelovek
Created June 18, 2019 06:56
Show Gist options
  • Save prostoiChelovek/5214cfb66aabb632a81ed18aa10e8c31 to your computer and use it in GitHub Desktop.
Save prostoiChelovek/5214cfb66aabb632a81ed18aa10e8c31 to your computer and use it in GitHub Desktop.
simple script that makes custom dict using big language dict
#!/usr/bin/env bash
while read p; do
word=`echo $p | sed 's/ .*//'`
if [[ ${word} == "" ]]; then
continue
fi
if [[ ${word} == *"("* ]]; then
continue
fi
wordInDict=`sed -n -e "/^${word} /p" ${2}`
alt=`sed -n -e "/^${word}(/p" ${2}`
echo ${word}
if [[ ${wordInDict} != "" ]]; then
echo ${wordInDict}
echo ${wordInDict} >> ${3}
else
echo ${p}
echo ${p} >> ${3}
fi
if [[ ${alt} != "" ]]; then
echo ${alt}
echo ${alt} >> ${3}
fi
done <${1}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment