Libspellcheck

Table of Contents

Because this is a long document, I have provided a table of contents to let you know what is in this document.
  1. Compiling libspellcheck
  2. Using libspellcheck in your applications
  3. Libspellcheck functions
  4. Dictionaries
  5. Getting The Latest Code
  6. What's Next

Compiling libspellcheck

Please refer to: Compiling Libspellcheck

Using libspellcheck in your applications

To access libspellcheck functions, you must use the spellcheck.h header file:

#include <spellcheck.h>

When linking your application, use the -lspellcheck option:

g++ -o myapp myapp.cpp -lspellcheck

Libspellcheck functions

check_spelling(char *dict, char *word) Version Required To Use: v1.05

This function will return true if the word char *word is spelled correctly, and false if it is not. char *dict is the filename of the dictionary to check against.

add_word(char *dict, char *word) Version Required To Use: v1.05

This function returns nothing. It adds the word char *word to the dictionary with the filename char *dict .

lib_version() Version Required To Use: v1.05

This function returns the version of libspellcheck you linked against at compile time as a double.

check_spelling_string(char *dict, string wordList) Version Required To Use: v1.10

Please refer to this page: Checking The Spelling Of An Entire String.

string correctSpelling(string word, string dict) Version Required To Use: v1.20

This function returns a string which contains the suggested correction for misspelled string word and uses the dictionary with a location of string dict . If string word is spelled correctly, the return string will be equal to string word . If no suggestions are available, the return string will be blank.

Dictionaries

A dictionary used by libspellcheck is very simple. A dictionary is a text file that contains a list of words each separated by a newline. An example of a dictionary could be:

a
abacus
air
airplane


If your application needs an english dictionary, you can use the included english.dict, which is also used by the spellcheck application.

Getting The Latest Code

Follow the instructions in Compiling Development Versions of Libspellcheck to get the most up to date code for libspellcheck.

What's Next

Please refer to this page: Todo (What's Next)

Last edited Jul 31, 2013 at 2:59 PM by iankbhb, version 14

Comments

No comments yet.