00001
00002
00003
00004
00005
00006
00007
00008 #include <iostream>
00009 #include <iomanip>
00010 #include "AspellWrapperClass.hpp"
00011
00012 int main( int argc, char** argv )
00013 {
00014 if( argc == 2 )
00015 {
00016 AspellWrapper speller("en_US");
00017
00018 cout << speller.error << endl;
00019
00020
00021 speller.addWords("hydrowords");
00022
00023 string passedArg = argv[1];
00024 cout << "Spelling for: " << passedArg << endl;
00025
00026 if( passedArg.find(" ") != string::npos )
00027 {
00028 wordlist badWords;
00029 if( speller.checkText( passedArg, badWords ) )
00030 {
00031 cout << "Your spelling is good!" << endl;
00032 }
00033 else
00034 {
00035 cout << "Might we suggest... " << endl;
00036 for( int i = 0; i < badWords.size(); i++ )
00037 {
00038 string & badWord = badWords[i];
00039 cout << "FOR " << badWord << ":" << endl;
00040 alternatives & list = speller.suggestWords(badWord);
00041 for( int l=0; l < list.size(); ++l )
00042 {
00043 cout << list[l] << endl;
00044 }
00045 }
00046 }
00047 }
00048 else
00049 {
00050 if( speller.checkWord( passedArg ) )
00051 {
00052 cout << "Your spelling is good!" << endl;
00053 }
00054 else
00055 {
00056 cout << "Might we suggest: " << endl;
00057 alternatives & list = speller.suggestWords(argv[1]);
00058 for( int l=0; l < list.size(); ++l )
00059 {
00060 cout << list[l] << endl;
00061 }
00062 }
00063 }
00064 }
00065 return 0;
00066 }
00067
00068