Back to index

lightning-sunbird  0.9+nobinonly
affixmgr.hxx
Go to the documentation of this file.
00001 #ifndef _AFFIXMGR_HXX_
00002 #define _AFFIXMGR_HXX_
00003 
00004 #ifdef __SUNPRO_CC // for SunONE Studio compiler
00005 using namespace std;
00006 #endif
00007 
00008 #include "atypes.hxx"
00009 #include "baseaffix.hxx"
00010 #include "hashmgr.hxx"
00011 #include <stdio.h> 
00012 
00013 class AffixMgr
00014 {
00015 
00016   AffEntry *          pStart[SETSIZE];
00017   AffEntry *          sStart[SETSIZE];
00018   AffEntry *          pFlag[SETSIZE];
00019   AffEntry *          sFlag[SETSIZE];
00020   HashMgr *           pHMgr;
00021   char *              trystring;
00022   char *              encoding;
00023   char *              compound;
00024   int                 cpdmin;
00025   int                 numrep;
00026   replentry *         reptable;
00027   int                 nummap;
00028   mapentry *          maptable;
00029   bool                nosplitsugs;
00030 
00031 
00032 public:
00033  
00034   AffixMgr(const char * affpath, HashMgr * ptr);
00035   ~AffixMgr();
00036   struct hentry *     affix_check(const char * word, int len);
00037   struct hentry *     prefix_check(const char * word, int len);
00038   struct hentry *     suffix_check(const char * word, int len, int sfxopts, AffEntry* ppfx);
00039   int                 expand_rootword(struct guessword * wlst, int maxn, 
00040                              const char * ts, int wl, const char * ap, int al);
00041   struct hentry *     compound_check(const char * word, int len, char compound_flag);
00042   struct hentry *     lookup(const char * word);
00043   int                 get_numrep();
00044   struct replentry *  get_reptable();
00045   int                 get_nummap();
00046   struct mapentry *   get_maptable();
00047   char *              get_encoding();
00048   char *              get_try_string();
00049   char *              get_compound();
00050   bool                get_nosplitsugs();
00051              
00052 private:
00053   int  parse_file(const char * affpath);
00054   int  parse_try(char * line);
00055   int  parse_set(char * line);
00056   int  parse_cpdflag(char * line);
00057   int  parse_cpdmin(char * line);
00058   int  parse_reptable(char * line, FILE * af);
00059   int  parse_maptable(char * line, FILE * af);
00060   int  parse_affix(char * line, const char at, FILE * af);
00061 
00062   void encodeit(struct affentry * ptr, char * cs);
00063   int build_pfxtree(AffEntry* pfxptr);
00064   int build_sfxtree(AffEntry* sfxptr);
00065   AffEntry* process_sfx_in_order(AffEntry* ptr, AffEntry* nptr);
00066   AffEntry* process_pfx_in_order(AffEntry* ptr, AffEntry* nptr);
00067   int process_pfx_tree_to_list();
00068   int process_sfx_tree_to_list();
00069   int process_pfx_order();
00070   int process_sfx_order();
00071 };
00072 
00073 #endif
00074