Back to index

lightning-sunbird  0.9+nobinonly
suggestmgr.hxx
Go to the documentation of this file.
00001 #ifndef _SUGGESTMGR_HXX_
00002 #define _SUGGESTMGR_HXX_
00003 
00004 #define MAXSWL 100
00005 #define MAX_ROOTS 10
00006 #define MAX_WORDS 500
00007 #define MAX_GUESS 10
00008 
00009 #define NGRAM_IGNORE_LENGTH 0
00010 #define NGRAM_LONGER_WORSE  1
00011 #define NGRAM_ANY_MISMATCH  2
00012 
00013 
00014 #include "atypes.hxx"
00015 #include "affixmgr.hxx"
00016 #include "hashmgr.hxx"
00017 
00018 class SuggestMgr
00019 {
00020   char *          ctry;
00021   int             ctryl;
00022   AffixMgr*       pAMgr;
00023   int             maxSug;
00024   bool            nosplitsugs;
00025 
00026 public:
00027   SuggestMgr(const char * tryme, int maxn, AffixMgr *aptr);
00028   ~SuggestMgr();
00029 
00030   int suggest(char** wlst, int ns, const char * word);
00031   int check(const char *, int);
00032   int ngsuggest(char ** wlst, char * word, HashMgr* pHMgr);
00033 
00034 private:
00035    int replchars(char**, const char *, int);
00036    int mapchars(char**, const char *, int);
00037    int map_related(const char *, int, char ** wlst, int, const mapentry*, int);
00038    int forgotchar(char **, const char *, int);
00039    int swapchar(char **, const char *, int);
00040    int extrachar(char **, const char *, int);
00041    int badchar(char **, const char *, int);
00042    int twowords(char **, const char *, int);
00043    int ngram(int n, char * s1, const char * s2, int uselen);
00044    void bubblesort( char ** rwd, int * rsc, int n);
00045 };
00046 
00047 #endif
00048