00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028
00029
00030 #ifndef _moot_MORPH_H_
00031 #define _moot_MORPH_H_
00032
00036 #define moot_MORPH_DEBUG
00037
00038
00041 #define MOOT_HAVE_HASH_STRING
00042
00043 #include <stdio.h>
00044
00045 #include <mootToken.h>
00046 #include <mootTokenIO.h>
00047
00048 #include <mootFSMBase.h>
00049 #include <mootFSMPotsdam.h>
00050 #include <mootFSMgfsm.h>
00051 #include <mootFSMRWTH.h>
00052
00053 namespace mootm {
00054 using namespace std;
00055 using namespace moot;
00056
00057
00058
00059
00060
00064 class mootMorph {
00065 public:
00066
00068 typedef enum {
00069 vlSilent=0,
00070 vlErrors=10,
00071 vlWarnings=20,
00072 vlEverything=127
00073 } VerbosityLevel;
00074
00075 public:
00076
00077
00078
00080
00081
00092 mootFSM mfsm;
00094
00095
00096
00097
00098
00099
00103 bool want_avm;
00104
00106 bool force_reanalysis;
00107
00109 bool first_analysis_is_best;
00110
00115 bool ignore_first_analysis;
00116
00118 int verbose;
00120
00121
00122
00123
00124
00128 unsigned int ntokens;
00129
00131 unsigned int nanalyzed;
00132
00134 unsigned int nunknown;
00135
00140 unsigned int nprogress;
00142
00143
00144 public:
00145
00146
00147
00148
00152 mootMorph(void) :
00153 want_avm(false),
00154 force_reanalysis(false),
00155 first_analysis_is_best(false),
00156 ignore_first_analysis(false),
00157 verbose(vlErrors),
00158 ntokens(0),
00159 nanalyzed(0),
00160 nunknown(0),
00161 nprogress(0)
00162 {};
00163
00165 ~mootMorph() {};
00167
00168
00169
00170
00171
00174
00176 bool load(const string &fst_filename, const string &syms_filename="")
00177 { return mfsm.load(fst_filename, syms_filename); };
00178
00180 bool valid(void) const
00181 { return mfsm.valid(); };
00182
00184
00185
00186
00187
00188
00191
00193 bool analyze_io(TokenReader *reader, TokenWriter *writer);
00194
00196 bool analyze_stream(FILE *in=stdin, FILE *out=stdout, const char *srcname=NULL);
00197
00199 bool analyze_strings(int argc, char **argv, FILE *out=stdout, const char *srcname=NULL);
00200
00209 inline mootToken& analyze_token(mootToken &tok)
00210 {
00211
00212 mfsm.analyze_token(tok, want_avm, (verbose >= vlWarnings));
00213
00214
00215 nanalyzed++;
00216 if (tok.analyses().empty()) nunknown++;
00217
00218 return tok;
00219 };
00220
00222
00223
00224
00225
00226
00227
00228
00231
00233 void carp(char *fmt, ...) const;
00234
00236 };
00237
00238 };
00239
00240 #ifdef HAVE_CONFIG_H
00241 # include <mootmUnConfig.h>
00242 #endif
00243
00244 #endif // _moot_MORPH_H_