Sponsored Content
Full Discussion: Writing a script for aspell
Homework and Emergencies Homework & Coursework Questions Writing a script for aspell Post 302865815 by gamernerd101 on Sunday 20th of October 2013 01:18:35 AM
Old 10-20-2013
Writing a script for aspell

Use and complete the template provided. The entire template must be completed. If you don't, your post may be deleted!

1. The problem statement, all variables and given/known data:
The scirpt I have is meant to check the strings read in from a file with the aspell subroutine in the UNIX bash shell. I don't seem to have a problem reading it and checking it. Only printing it correctly.

I'm having some trouble with my script/understanding it fully. I want to print out all of the items stored in uncorrect in the mispelled columns I have set under the mispelled table. Then print out the values corrected with user input. Am I not storing them correctly? Or am I not calling them correctly in my last echo statement? I'm really just lost for syntax. Forgive me I'm new at this and am just having trouble understanding it. Thanks so much for your help in advance.


2. Relevant commands, code, scripts, algorithms:
It was recommended in my assignment that we use the ASPELL LIST command, but I didn't know how to properly implement it.


3. The attempts at a solution (include all code and scripts):
Code:
#! /bin/bash

#empty array's created to store the new spelling and old ones.
reSpell=()
uncorrect=()
# now check the spellings
let count=1

check=(`aspell list -p ~/.checked < $1`)
# for each mispelled word in the file is entered into i and put into the new directory memory if corrected
for i in ${check[*]} ; do
   uncorrect[$count]=$i
   read -p "$i is mispelled. Press \"Enter\" to keep this spelling or type your new spelling here: " newSpell

   # unfixed spellings are ignored and not replaced and are left where they are in the fiexedspell array
if [ "$newSpell"="" ]; then
   echo $i>> ~/.memory

else
   reSpell[$count]=$newSpell
fi
   count+=1
   echo ""

done


printf "MISPELLED %20s\n" CORRECTIONS
echo ""
let counter=1
for i in ${reSpell[*]}; do

   echo "{uncorrect[$counter]} %-20s%s\n" "${reSpell[$counter]}"

   counter+=1
done



4.
NIU, Dekalb, Il , Ege, CSCI330

Note: Without school/professor/course information, you will be banned if you post here! You must complete the entire template (not just parts of it).

Last edited by Don Cragun; 10-20-2013 at 03:06 AM.. Reason: Add CODE tags.
 

2 More Discussions You Might Find Interesting

1. UNIX for Advanced & Expert Users

redirecting the output of aspell

Hi, I have 2 identical servers both running aspell but for some reason I can't redirect the output to a file on one of them. This is what I'm trying to do: echo feck | aspell -l > errors.txt On one machine this works fine but the other it doesn't (the file is created but it is empty). ... (6 Replies)
Discussion started by: leekb
6 Replies

2. UNIX for Dummies Questions & Answers

Trouble getting aspell to work

Hi: I've tried to get aspell to work to check a latex document I have. I get this error message: Error: No word lists can be found for the language "en_CA". Can anyone offer any suggestions? I'm trying to get a good spell-checker set up for my latex documents. Excalibur does not work all... (1 Reply)
Discussion started by: spindoctor
1 Replies
PREZIP-BIN(1)						 Aspell Abbreviated User's Manual					     PREZIP-BIN(1)

NAME
prezip-bin - prefix zip delta word list compressor/decompressor SYNOPSIS
prezip-bin [ -V | -d | -z ] DESCRIPTION
prezip-bin compresses/decompresses sorted word lists from standard input to standard output. Prezip-bin is similar to word-list-compress(1) but it allows a larger character set of {0x00...0x09, 0x0B, 0x0C, 0x0E...0xFF} and multi-words larger than 255 characters in length. It can also decompress word-list-compress(1) compatible files. COMMANDS
Prezip-bin accepts only one of these commands. -V Display prezip-bin version number to standard output. -d Read a compressed word list from standard input and decompress it to standard output. This can be a word-list-compress(1) or a prezip-bin compressed file. -z Read a binary word list from standard input and compress it to standard output. EXAMPLES
prezip-bin -d <wordlist.cwl >wordlist.txt Decompress file wordlist.cwl to text file wordlist.txt prezip-bin -z <wordlist.txt >wordlist.pz 2>errors.txt Compress wordlist.txt to binary file wordlist.pz and send any error messages to a text file named errors.txt LC_COLLATE=C sort -u <wordlist.txt | prezip-bin -z >wordlist.pz Sort a word list, then pipe it to prezip-bin to create a compressed binary wordlist.pz file. prezip-bin -d <words.pz | aspell create master ./words.rws Decompress a wordlist, then pipe it to aspell(1) to create a spelling list. Please check the aspell(1) info manual for proper usage and options. TIPS
Prezip-bin is best used with sorted word list type files. It is not a general purpose compression program since resulting files may actu- ally increase in size. Unlike word-list-compress(1) if your word list has leading or trailing blank spaces for formatting purposes, you should remove them first before you compress your list using prezip-bin -z , otherwise those spaces will be included in the compressed binary output. DIAGNOSTICS
Prezip-bin normally exits with a return code of 0. If it encounters an error, a message is sent to standard error output (stderr), and prezip-bin exits with a non-zero return value. Error messages are listed below: (display help/usage message) Unknown command given on the command line so prezip-bin displays a usage message to standard error output. unknown format The input file appears not to be an expected format, or may possibly be a more advanced format. The output file will be empty. corrupt input This is only for the decompression command -d. The input file appeared to be of a correct format, but something appears wrong now. There may be some valid data in output, but due to input corruption, the rest of the file can not be completed. unexpected EOF The input file appeared okay but ended sooner than expected, therefore the output file is not complete. SEE ALSO
aspell(1), run-with-aspell(1), word-list-compress(1) Aspell is fully documented in its Texinfo manual. See the `aspell' entry in info for more complete documentation. REPORTING BUGS
For help, see the Aspell homepage at <http://aspell.net>. Send bug reports/comments to the Aspell user list at the above address. AUTHOR
This info page was written by Jose Da Silva <digital@joescat.com>. prezip-bin-0.1.2 2005-09-30 PREZIP-BIN(1)
All times are GMT -4. The time now is 05:10 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy