Main Page   Namespace List   Class Hierarchy   Alphabetical List   Compound List   File List   Namespace Members   Compound Members   File Members  

mootLexfreqsCompiler.h

Go to the documentation of this file.
00001 /* -*- Mode: C++ -*- */
00002 
00003 /*
00004    libmoot : moocow's part-of-speech tagging library
00005    Copyright (C) 2003-2004 by Bryan Jurish <moocow@ling.uni-potsdam.de>
00006 
00007    This program is free software; you can redistribute it and/or modify
00008    it under the terms of the GNU General Public License as published by
00009    the Free Software Foundation; either version 2 of the License, or
00010    (at your option) any later version.
00011 
00012    This program is distributed in the hope that it will be useful,
00013    but WITHOUT ANY WARRANTY; without even the implied warranty of
00014    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00015    GNU General Public License for more details.
00016 
00017    You should have received a copy of the GNU General Public License
00018    along with this program; if not, write to the Free Software
00019    Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
00020 */
00021 
00022 /*============================================================================
00023  * File: mootLexfreqsCompiler.h
00024  * Author:  Bryan Jurish <moocow@ling.uni-potsdam.de>
00025  * Description:
00026  *    Compiler for TnT-style lexical-frequency parameter files for moot PoS tagger
00027  *============================================================================*/
00028 
00029 #ifndef _moot_LEXFREQS_COMPILER_H
00030 #define _moot_LEXFREQS_COMPILER_H
00031 
00032 #include <stdio.h>
00033 #include <string.h>
00034 
00035 //#include <FSM.h>
00036 
00037 #include "mootLexfreqsLexer.h"
00038 #include "mootLexfreqsParser.h"
00039 
00040 moot_BEGIN_NAMESPACE
00041 
00049 class mootLexfreqsCompiler : public mootLexfreqsParser {
00050  public:
00051   // -- public data
00053   mootLexfreqsLexer theLexer;
00054 
00059   char *objname;
00060 
00065   char *srcname;
00066 
00067  public:
00068   // -- public methods: CONSTRUCTORS / DESTRUCTORS
00070   mootLexfreqsCompiler() : objname(NULL), srcname(NULL) {};
00072   virtual ~mootLexfreqsCompiler() {};
00073 
00074   // -- high-level parsing methods
00075 
00077   inline mootLexfreqs *parse_from_file(FILE *file, const char *filename=NULL) {
00078       select_streams(file,stdout);
00079       return parse_lexfreqs();
00080   };
00081 
00083   inline mootLexfreqs *parse_from_string(const char *string, const char *srcname=NULL) {
00084     select_string(string,srcname);
00085     return parse_lexfreqs();
00086   };
00087 
00088   // -- low-level public methods: INPUT SELECTION
00090   void select_streams(FILE *in, FILE *out, const char *my_srcname=NULL) {
00091     theLexer.select_streams(in,out);
00092     srcname = (char *)my_srcname;
00093   };
00094 
00099   void select_string(const char *in, const char *my_srcname=NULL) {
00100     theLexer.select_string(in);
00101     srcname = (char *)my_srcname;
00102   };
00103 
00104   // -- low-level public methods: PARSING
00105   virtual int yylex();
00106 
00111   mootLexfreqs *parse_lexfreqs();
00112 
00113   // -- low-level public methods: ERRORS & WARNINGS
00115   virtual void yyerror(const char *msg);
00116 
00118   virtual void yywarn(const char *msg);
00119 };
00120 
00121 moot_END_NAMESPACE
00122 
00123 #endif /* _moot_LEXFREQS_COMPILER_H */

Generated on Wed Jul 28 15:48:03 2004 for libmoot by doxygen1.2.15