I am doing bash script to check spelling on number of files.
I came across to problem of telling aspell t开发者_Go百科o ignore some set of words that I allow to appear.
This is same as "Ignore All" in interactive mode. But that will not work as I would need to do that by hand.
How can I tell aspell to ignore given set of words. Is there any parameter that can do that. I wish there was an option to pass file with those words.
Or might be out there a more efficient way for scripting spell checking in bash?
Easy: put your words in a Personal Dictionary: ~/.aspell.en.pws
where the first line is
personal_ws-1.1 en 500
(500 is the number of words, doesn't need to be exact, aspell will fix it if you add words with aspell).
If you need the dictionary to be elsewhere, use options like these:
aspell --home-dir=/dir/to/dict --personal=dict-file.txt
This is written in a combination of shell and pseudocode. It does not seem like the most efficient way; parsing two arrays and checking the results takes up more memory and cycles than necessary.
function SpellCheckInit() {
for i in `seq 0 $(( ${#aname[@]} - 1 ))`; do
echo Parsing...
done
}
Dictionary=( "${dictionary[@]}" "Oxford English Dictionary" )
char=( "${words[@]}" "Text" )
echo Ignore?
read -a omt_wrds
SpellCheckInit()
words_left=${#Dictionary[@]}
until [ $words_left -lt 0]; do
if [ "$char" = "i"]; do
echo IGNORED
elif [ "$char" = "$Dictionary"]; do
echo CORRECT
else
for word in Dictionary
$word > $dictionary
done
fi
done
精彩评论