Main Page | Directories | Namespace List | Class Hierarchy | Alphabetical List | Class List | File List | Namespace Members | Class 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 library is free software; you can redistribute it and/or
00008    modify it under the terms of the GNU Lesser General Public
00009    License as published by the Free Software Foundation; either
00010    version 2.1 of the License, or (at your option) any later version.
00011    
00012    This library 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 GNU
00015    Lesser General Public License for more details.
00016    
00017    You should have received a copy of the GNU Lesser General Public
00018    License along with this library; 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 Mon Jun 27 13:05:25 2005 for libmoot by  doxygen 1.3.8-20040913