#!/bin/sh

#
# spellchecker.sh
#
# Developed by Em Tonkin <e.tonkinISAACNEWTON@ukoln.ac.uk>
# Copyright (c) 2006 UNKNOWN Company
# Licensed under terms of GNU General Public License.
# All rights reserved.
#
# Changelog:
# 2006-11-28 - created
#

# $Platon$

#  tr 'A-Z' 'a-z' |  sed -e 's/\ /\n/g'|  sed -e 's/[^A-Za-z\ ].//g' | sed -e 's/[\.,?]//g' 
#for foo in `cat $1 | tr 'A-Z' 'a-z' | sed -e 's/\ /\n/g' | sed -e 's/[^A-Za-z\ ]//g | sed -e 's/[\.,?]//g'`;

for foo in `cat $1 | tr 'A-Z' 'a-z' | sed -e 's/\ /\n/g' | sed -e 's/[\.,?]//g' | sed -e 's/[^a-z\ ].//g' `; 
do 
	MYRESPONSE=`grep /usr/share/dict/words -e "^$foo$" | wc -l `
	if [ $MYRESPONSE -gt 0 ] ; then
		#echo "Word $foo OK"	
		true
	else
		echo "Word $foo misspelt?"
	fi
done

