|
// Ternary DAG spellchecker
// (c) Peter Kankowski, 2008. kankowski@narod.ru
#pragma pack(push)
#pragma pack(1)
// Dictionary node stored in file
struct ST_FILE_NODE {
char ch;
char _padding;
unsigned short left;
unsigned short right;
unsigned short middle;
};
typedef struct ST_FILE_NODE ST_FILE_NODE;
#pragma pack(pop)
#define ST_DICT_SIGNATURE "Aba dict"
#define ST_MAX_WORD 100
// Open a dictionary, returns NULL in case of error
ST_FILE_NODE * ST_open_dict (const char * filename);
// Returns a non-zero value if the word is present in the dictionary
int ST_find_exact (ST_FILE_NODE * dict, const char * word);
// Enumerate spelling suggestions (fuzzy matches)
void ST_enum_suggestions (ST_FILE_NODE * dict, const char * word,
void (* enumproc)(const char*, void*), void * param);
// Close the dictionary
void ST_close_dict (ST_FILE_NODE * dict);
|
By viewing downloads associated with this article you agree to the Terms of Service and the article's licence.
If a file you wish to view isn't highlighted, and is a text file (not binary), please
let us know and we'll add colourisation support for it.
Peter is the developer of
Aba Search and Replace, a tool for replacing text in multiple files. He likes to program in C with a bit of C++, also in x86 assembly language, Python, and PHP.