Sponsored Content
Full Discussion: spell checker script
Homework and Emergencies Homework & Coursework Questions spell checker script Post 302470369 by Jeffthrow5 on Wednesday 10th of November 2010 12:33:36 AM
Old 11-10-2010
spell checker script

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:
When "niuspell" is invoked from the command line it reads "file" and checks it for spelling of the words it contains. For each word that is found to be incorrect, the invoker is asked for either:
  • to insist on the spelling of the word.
  • to provide a replacement spelling
If the invoker insists on the spelling of the word, then niuspell will remember it. niuspell remembers words in the file ".niuspelled" in the invoker's home directory. Any further invocation of niuspell by the same invoker will consider the word to be correct. Otherwise, the invoker is prompted for a replacement spelling. As output, niuspell produces a 2-column-ed list of words, the left column lists incorrectly spelled words, the right column lists their replacement as given by the invoker. The list is produced after the invoker has answered to all incorrectly spelled words....



Everything works fine except the "insisted on words" appear in the "misspelled" column after the first invocation and they are not supposed to. The subsequent invocations don't list the insisted on words in the column, just the actual misspelled words. Any help will be appreciated.




2. Relevant commands, code, scripts, algorithms:



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

#variables
corSpel=()
let count=1

#array for spell checker
checker=(`ispell -l -p ~/.checked < $1`)

echo ""

#for loop to correct mispelled words
for i in ${checker[*]}; do
        read -p "$i is mispelled. Press \"Enter\" to keep
this spelling, or type a correction here: " corIn
        if [[ "$corIn" = "" ]] ; then
                echo $i >> ~/.niuspelled
        else
                corSpel[$count]=$corIn
        fi
 count+=1
echo ""
done

#for loop to print the corrected words
printf "MISPELLED %20s\n" CORRECTIONS
echo ""
let counter=1
for i in ${checker[*]}; do
        printf "%-20s%s\n" "$i" "${corSpel[$counter]}"            
 counter+=1
done

4. Complete Name of School (University), City (State), Country, Name of Professor, and Course Number (Link to Course):
Northern Illinois University, Mr. Ege, csci 330

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).
 

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Shell script syntax checker

I have a rather big script that i have written in ksh and it is falling over in two places with a 'test argument' error. I know this usually means that the if statement is not correct, but it is fine. I have looked through the rest of the script for any odd brackets or ` marks, but can't see... (2 Replies)
Discussion started by: handak9
2 Replies

2. Shell Programming and Scripting

spell checker program

2.I need shell script to list all the 'words' in a given file (text) that are not listed in a specified dictionary. Let us call this utility 'spell-check'. 'spell-check' will be called as follows. $ spell-check letter Lucent UNIX UNIX OS a $ dictionary words are listed in lower... (2 Replies)
Discussion started by: ksjanakan
2 Replies

3. UNIX for Advanced & Expert Users

spell

Hi, I found the following line in a shell script. $spell -a < $filename | \ grep -v '@(#)' | sed "s/\'//g" | \ awk '{ if (length($0) > 15 && length($2) > 2) print $2 }' | \ grep -vif $okaywords | \ grep ']' | grep -v ']' | sort -u | \ sed 's/^/ /' > $tempout can... (2 Replies)
Discussion started by: ravi raj kumar
2 Replies

4. Shell Programming and Scripting

Shell Sript - Spell Checker Assign

Hi Folks. I am currently working on a script that has to spell check a file and print the output to the screen in 2 columns like this. INCORRECT CORRECTION whio who weahter weather The file will allow the user to override the ispell command and save any... (9 Replies)
Discussion started by: ccfc1986
9 Replies

5. Shell Programming and Scripting

Need your help for the spell checker in unix or python

Hi, Want to know is there any command to correct the spelling using unix or python? Unix command "spell" will give only the list of the incorrect words . But i want the output along with the corrected word . Thanks in advance (1 Reply)
Discussion started by: vini
1 Replies

6. Homework & Coursework Questions

Unix Spell Checker Assignment

hello, im a new member to the forum and im doing a assignment for unix command and we have to make a spell checker and im a little confused about the directions .. ill post them below and continue.. Northern Illinois University CSCI 330-Unix Command Write a shell script that implements a... (1 Reply)
Discussion started by: bravens52
1 Replies

7. Shell Programming and Scripting

Help with Bash Shell Script Spell Checker program.

I have a majority of this problem done but seem to be struggling on the last couple of steps. Here is the whole problem to help you guys get a better understanding. Write a shell script that implements a simple spell checker. The filename you will use for your script will be your Z-id followed... (1 Reply)
Discussion started by: DsmRacer2k14
1 Replies

8. Debian

Getting a better spell checker

Guys I am new to Linux in general and want to know what is the use of the following files-: /usr/share/dict/words /usr/share/dict/words.pre-dictionaries-common Are they used by the spell checker to find potential typos ? If so are there any better larger word lists out there ? I am sure... (2 Replies)
Discussion started by: sreyan32
2 Replies

9. Shell Programming and Scripting

IP list specific port checker script

Hello again people, I currently searching for a code/script that will allow it to check if a specific port is open, lets say 123. Found a public script on a ftp but I dont know how and what to modify in it to suit my needs. (I think this is a evil code and I want to use it as an example). ... (3 Replies)
Discussion started by: galford
3 Replies

10. Shell Programming and Scripting

Help Needed with File Checker Korn Shell Script

I am attempting to write a korn shell script that does the following, but I am getting errors. I'm new to korn shell scripting and am not sure what I am doing wrong. Please help with example scripts. Thanks. 1) check for day of the week 2) if day of the week is Monday then check for the... (4 Replies)
Discussion started by: ijmoore
4 Replies
DEBCONF-MERGETEMPLATE(1)					      Debconf						  DEBCONF-MERGETEMPLATE(1)

NAME
debconf-mergetemplate - merge together multiple debconf template files SYNOPSIS
debconf-mergetemplate [options] [templates.ll ...] templates DESCRIPTION
Note: This utility is deprecated. You should switch to using po-debconf's po2debconf program. This program is useful if you have multiple debconf templates files which you want to merge together into one big file. All the specified files will be read in, merged, and output to standard output. This can be especially useful if you are dealing with translated template files. In this case, you might have your main template file, plus several other files provided by the translators. These files will have translated fields in them, and maybe the translators left in the english versions of the fields they translated, for their reference. So, you want to merge together all the translated templates files with your main templates file. Any fields that are unique to the translated files need to be added in to the correct templates, but any fields they have in common should be superseded by the fields in the main file (which might be more up-to-date). This program handles that case properly, just list each of the translated templates files, and then your main templates file last. OPTIONS
--outdated Merge in even outdated translations. The default is to drop them with a warning message. --drop-old-templates If a translation has an entire template that is not in the master file (and thus is probably an old template), drop that entire template. SEE ALSO
debconf-getlang(1) AUTHOR
Joey Hess <joeyh@debian.org> 2012-09-10 DEBCONF-MERGETEMPLATE(1)
All times are GMT -4. The time now is 10:35 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy