00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024 #ifndef MF_LMMACRO_H
00025 #define MF_LMMACRO_H
00026
00027 #ifndef WIN32
00028 #include <sys/types.h>
00029 #include <sys/mman.h>
00030 #endif
00031
00032 #include "util.h"
00033 #include "ngramcache.h"
00034 #include "dictionary.h"
00035 #include "n_gram.h"
00036 #include "lmtable.h"
00037
00038 #define MAX_TOKEN_N_MAP 3
00039
00040 class lmmacro: public lmtable {
00041
00042 public:
00043
00044 dictionary *dict;
00045 int *microMacroMap;
00046 int microMacroMapN;
00047 int selectedField;
00048 int *lexicaltoken2classMap;
00049 int lexicaltoken2classMapN;
00050
00051 lmmacro(std::string lmfilename, std::istream& inp, std::istream& inpMap);
00052 ~lmmacro() {}
00053
00054 bool loadmap(std::string lmfilename, std::istream& inp, std::istream& inpMap);
00055 double lprob(ngram ng);
00056 double clprob(ngram ng);
00057
00058 const char *maxsuffptr(ngram ong, unsigned int* size=NULL);
00059 const char *cmaxsuffptr(ngram ong, unsigned int* size=NULL);
00060
00061 void map(ngram *in, ngram *out);
00062 void One2OneMapping(ngram *in, ngram *out);
00063 void Micro2MacroMapping(ngram *in, ngram *out);
00064 void Micro2MacroMapping(ngram *in, ngram *out, char **lemma);
00065 void cutLex(ngram *in, ngram *out);
00066 void loadLexicalClasses(const char *fn);
00067
00068 inline dictionary* getDict() {
00069 return dict;
00070 }
00071
00072 };
00073
00074
00075
00076 #endif
00077