Click here to Skip to main content
Click here to Skip to main content

Secor Spell checker

, 18 Oct 2004 GPL3
Rate this:
Please Sign up or sign in to vote.
Interactive spell check system.

Introduction

Secor is an interactive spell check system. It was designed to test a technique which uses the Trigram method as a filter to reduce the size of the dictionary. Once the selection is done, an edit distance method is used to rank the list of words. The algorithm will keep only those words whose distance is minimum and they will be presented as suggestions to replace the wrong word.

Technical

Usually these algorithms are included in an application, so this system was designed as an API (Application Programming Interface) that provide an easy way to include a spell checker in your application.

The Secor library contains one main class and several complementary classes. This main class is Secor and is used to set the initial configuration and to check if a word is in the dictionary, and coming up with suggestions if this word wasn't spelled correctly.

Usage

To use Secor in your application, you must include the files named "estructuras.h" and "secor.h". To link the project, you must add the file named "secor.lib" into the "Object/library modules" option in "Project Settings".

When your application first starts, you should create a Secor class and configure it with the command:

    Secor secor;
    int secor.Init("dictionary", "codes");

The Init function has two parameters: "dictionary" specifies the name and path of the file with the dictionary and "code" specifies the name and path of the file with the trigrams codes. If for some reason the configuration process fails, Init will return "-1", otherwise, "0".

Once the configuration process is finished you can start to use the spell checker. The first step is to verify if a word is correct by looking for it in the dictionary.

      bool isCorrect("word"); 

If the word is in the dictionary, the function will return "true" and it can be considered correct, but if the word isn't in the dictionary, the word is considered wrong and will return "false".

If the word is not correct, "getSuggestions" can be used to create a list of suggestions.

      int getSuggestions("wrong_word");

This function will return the number of found suggestions. To be able to see them you must use the command "getNextSuggestion"; this function will return one by one the suggestions found by the last command.

      int getNextSuggestion(char *suggestion);

This way, each time you use this function you will get the next suggestion until the list gets to the end, when this happens the function will return "-1", otherwise, it will return "0".

Finally there is one last function to talk about. It is not part of the spell checking process but it is very important. This API has the ability to import a new dictionary, this can be done by using the command:

      int ImportDict("list_words")

"list_words" specifies the name and path of the file that stores the list of word that will be used to create the new dictionary; besides, this function will create a file with the trigrams codes that are necessary to work with this new dictionary.

The new dictionary will have ".dic" extension and the trigram codes file will have the extension ".tri".

License

This article, along with any associated source code and files, is licensed under The GNU General Public License (GPLv3)

Share

About the Author

Diego Barrientos

Argentina Argentina
No Biography provided

Comments and Discussions

 
Questionerror message while integration.. PinmemberPro_Dev18-Jul-12 20:56 
GeneralUseful project PinmemberFranc Morales24-Jul-08 20:33 
GeneralRe: Useful project PinmemberPro_Dev18-Jul-12 20:55 
GeneralRe: Useful project PinmemberDiego Barrientos19-Jul-12 3:31 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.

| Advertise | Privacy | Mobile
Web01 | 2.8.141022.2 | Last Updated 18 Oct 2004
Article Copyright 2004 by Diego Barrientos
Everything else Copyright © CodeProject, 1999-2014
Terms of Service
Layout: fixed | fluid