Manually add a local Dictionary

Source: Internet
Author: User
Manually add a local Dictionary 01 #! /Bin/sh0203 # spelldict. sh -- use the & amp; #39; aspell & amp; #39; feature and some filters for 04 # Allow command line spelling to check the given input file 0506 # unavoidable, you will find that some words are incorrect, but you think 07 # they are correct... manually add a local Dictionary 01 #! /Bin/sh02 03 # spelldict. sh -- use the 'aspell 'feature and some filters for 04 # Allow command line spelling to check the given input file 05 06 # inevitably, you will find that some words are incorrect, but you think 07 # they are correct. Simply save them in a file, one line at 08 #, and make sure the variable 'okayword' points to the file. 09 10 okaywords = "$ HOME/okaywords" 11 tempout = "/tmp/spell. tmp. $"12 spell =" aspell "# modify 13 14 traps as needed"/bin/rm-f $ tempout "EXIT15 16 if [-z" $1 "]; then17 echo "Usage: spell file | URL"> & 218 exit 119 elif [! -F $ okaywords]; then20 echo "No personal dictionary found. create one and return this command. & amp; 221 echo & quot; Your dictionary file: $ okaywords "> & 222 exit 123 fi24 25 for filename26 do27 $ spell-a <$ filename | \ 28 grep-v '@(#) '| sed "s/\' // g" | \ 29 awk '{if (length ($0)> 15 & length ($2)> 2) print $2} '| \ 30 grep-vif $ okaywords | \ 31 grep' [[: lower:] '| grep-v' [[: digit:] '| sort-u | \ 32 se D's/^ // '> $ tempout33 34 if [-s $ tempout]; then35 sed's/^/$ {filename }: /'$ tempout36 fi37 done38 39 exit 0 run the script: this script requires one or more file names to run on the command line: 01 first, an empty personal dictionary, the txt content is excerpted from Alice's travel notes: 02 $ spelldict syntax: herrself04ragged.txt: teacups05ragged.txt: syntax: clamour07 08. two words are misspelled. Therefore, you must use the echo command to add them to the okay: 09 10 $ echo "Gryphon" >> ~ /. Okaywords11 $ echo "teacups" >> ~ /. Okaywords12 13 check results after extending the Dictionary File: 14 15 $ spelldict ragged.txt16ragged.txt: herrself17ragged.txt: clamor
Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.