Sponsored Content
Homework and Emergencies Homework & Coursework Questions Unix Spell Checker Assignment Post 302468468 by bravens52 on Wednesday 3rd of November 2010 05:47:59 PM
Old 11-03-2010
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 simple spell checker. The general format for invocation is:
niuspell file
where "niuspell" is the name of the executable file that contains your shell script, and "file" refers to the file to be checked word-by-word for spelling. Your are encouraged to take advantage of the "ispell -l" command. It produces a list of misspelled words from standard input.
Specification:

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.
Here is an example of an invocation of the niuspell script with a testfile:



ok so i made 2 separate files one called niuspell and one called testfile. My test file I have is a random paragraph that has a few misspelled words. My niuspell file i am confused on how i set it up. I started with my #! /bin/bash and im stuck. Could anyone give me a hint on how i move forward.

---------- Post updated 11-03-10 at 04:47 PM ---------- Previous update was 11-02-10 at 07:51 PM ----------

can anyone please help

The output my teacher gave us:

% ls
testfile niuspell
% cat testfile
I was going about my business quite nicely
when I was acosted by the mail man
whio insisted that my name is Raimund Ege
but I did not believe him
% ./niuspell testfile

'acosted' is mispelled. Press "Enter" to keep
this spelling, or type a correction here: accosted

'whio' is mispelled. Press "Enter" to keep
this spelling, or type a correction here: who

'Raimund' is mispelled. Press "Enter" to keep
this spelling, or type a correction here:

'Ege' is mispelled. Press "Enter" to keep
this spelling, or type a correction here:

MISPELLED: CORRECTIONS:

acosted accosted
whio who

% ./niuspell testfile

'acosted' is mispelled. Press "Enter" to keep
this spelling, or type a correction here: accosted

'whio' is mispelled. Press "Enter" to keep
this spelling, or type a correction here: who

MISPELLED: CORRECTIONS:

acosted accosted
whio who

% cat ~/.niuspelled
Raimund
Ege
% cat testfile
I was going about my business quite nicely
when I was acosted by the mail man
whio insisted that my name is Raimund Ege
but I did not believe him
 

10 More Discussions You Might Find Interesting

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

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

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

4. UNIX for Dummies Questions & Answers

Unix Assignment, need help!

I have been working on this for the past hour and I can not figure it out :( What command would you give to produce a listing of the names of all the text files in ~/UnixCourse or its subdirectories (possibly nested several layers deep) followed immediately by the first line of text within that... (10 Replies)
Discussion started by: gordonheimer
10 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- Database creating/viewing/updating assignment

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: I have posted the assignment below, I am new to unix programming and am having a very hard time knowing where... (5 Replies)
Discussion started by: student1989
5 Replies

7. Homework & Coursework Questions

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... (1 Reply)
Discussion started by: Jeffthrow5
1 Replies

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

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

10. UNIX for Dummies Questions & Answers

UNIX assignment or value returns

Hi Folks, In UNIX, I am quite confused on how to use or when to use ${} $() $ . For Example , if i use variable called "i" then when do i use, ${i} $(i) $i or sometime with arithmetic operations $(i+1) like this or ${i}+1 quite confused... Please help... ... (1 Reply)
Discussion started by: Nandy
1 Replies
SPELL(1)						    BSD General Commands Manual 						  SPELL(1)

NAME
spell -- find spelling errors SYNOPSIS
spell [-biltvx] [-d list] [-h spellhist] [-m a | e | l | m | s] [-s stop] [+extra_list] [file ...] DESCRIPTION
spell collects words from the named documents and looks them up in a spelling list. Words that neither occur among nor are derivable (by applying certain inflections, prefixes or suffixes) from words in the spelling list are printed on the standard output. If no files are named, words are collected from the standard input. spell ignores most troff(1), tbl(1), eqn(1), and pic(1) constructions. Copies of all output may be accumulated in the history file, if one is specified. By default, spell (like deroff(1)) follows chains of included files (``.so'' and ``.nx'' commands)). The default spelling list is based on Webster's Second International dictionary and should be fairly complete. Words that appear in the ``stop list'' are immediately flagged as misspellings, regardless of whether or not they exist in one of the word lists. This helps filter out misspellings (e.g. thier=thy-y+ier) that would otherwise pass. Additionally, the british file is also used as a stop list unless the -b option is specified. Site administrators may add words to the local word list, /usr/local/share/dict/words or the local stop list, /usr/local/share/dict/stop. All word (and stop) lists must be sorted in lexicographical order with case folded. The simplest way to achieve this is to use ``sort -df''. If the word files are incorrectly sorted, spell will not be able to operate correctly. The options are as follows: -b Check British spelling. Besides preferring centre, colour, speciality, travelled, etc., this option insists upon -ise in words like standardise, Fowler and the OED to the contrary notwithstanding. In this mode, American variants of words are added to the stop list. -d word_list Use the specified word list instead of the default system word list. The word list must be sorted as specified above. -h spellhist Store misspelled words in the specified history file. The output of who -m is appended to the history file after the list of mis- spelled words. -i Instruct deroff(1) to ignore ``.so'' and ``.nx'' commands. -l Use delatex instead of deroff(1) if it is present on the system. -m Enable support for common troff(1) macro packages; this option is passed verbatim to deroff(1). Refer to the --m description in deroff(1) for details. -s stop_list Use the specified stop list instead of the default system stop list. The stop list must be sorted as specified above. -t Use detex instead of deroff(1) if it is present on the system. -v Print all words not literally in the spelling list in addition to plausible derivations from spelling list words. -x Print every plausible stem, prefixed with '='. +extra_list Use extra_list in addition to the default word list. The extra word list must be sorted as specified above. FILES
/usr/share/dict/words Default spelling list /usr/share/dict/american American spelling of certain words /usr/share/dict/british British spelling of certain words /usr/share/dict/stop Default stop list. /usr/local/share/dict/words Local spelling list (optional) /usr/local/share/dict/stop Local stop list (optional) /usr/libexec/spellprog Binary executed by the shell script /usr/bin/spell. SEE ALSO
deroff(1), look(1), sed(1), sort(1), tee(1), troff(1) HISTORY
The spell command appeared in Version 6 AT&T UNIX. Unlike historic versions, the NetBSD spell command does not use hashed word files. Instead, it uses lexicographically sorted files and the same technique as look(1). BUGS
The spelling list lacks many technical terms; new installations will probably wish to monitor the output for several months to gather local additions. British spelling was done by an American. In -x mode it would be nicer if the stems were grouped with the appropriate word. BSD
April 18, 1994 BSD
All times are GMT -4. The time now is 09:39 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy