mootClassfreqsCompiler.h
Go to the documentation of this file.
1 /* -*- Mode: C++ -*- */
2 
3 /*
4  libmoot : moocow's part-of-speech tagging library
5  Copyright (C) 2003-2009 by Bryan Jurish <moocow@cpan.org>
6 
7  This library is free software; you can redistribute it and/or
8  modify it under the terms of the GNU Lesser General Public
9  License as published by the Free Software Foundation; either
10  version 3 of the License, or (at your option) any later version.
11 
12  This library is distributed in the hope that it will be useful,
13  but WITHOUT ANY WARRANTY; without even the implied warranty of
14  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
15  Lesser General Public License for more details.
16 
17  You should have received a copy of the GNU Lesser General Public
18  License along with this library; if not, write to the Free Software
19  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
20 */
21 
22 /*============================================================================
23  * File: mootClassfreqsCompiler.h
24  * Author: Bryan Jurish <moocow@cpan.org>
25  * Description:
26  * Compiler for lexical-class-frequency parameter files for moot tagger
27  *============================================================================*/
28 
33 #ifndef _moot_CLASSFREQS_COMPILER_H
34 #define _moot_CLASSFREQS_COMPILER_H
35 
36 #include "mootClassfreqsLexer.h"
37 //#include "mootClassfreqsParser.h" //-- used by mootClassFreqsLexer.h
38 
39 moot_BEGIN_NAMESPACE
40 
49  public:
50  // -- public data
53 
58  const char *objname;
59 
64  const char *srcname;
65 
66  public:
67  // -- public methods: CONSTRUCTORS / DESTRUCTORS
69  mootClassfreqsCompiler() : objname(NULL), srcname(NULL) {};
71  virtual ~mootClassfreqsCompiler() {};
72 
73  // -- high-level parsing methods
74 
76  inline mootClassfreqs *parse_from_file(FILE *file, const char *filename=NULL) {
77  select_streams(file,stdout);
78  return parse_classfreqs();
79  };
80 
82  inline mootClassfreqs *parse_from_string(const char *string, const char *srcname=NULL) {
83  select_string(string,srcname);
84  return parse_classfreqs();
85  };
86 
87  // -- low-level public methods: INPUT SELECTION
89  void select_streams(FILE *in, FILE *out, const char *my_srcname=NULL) {
90  theLexer.select_streams(in,out);
91  srcname = my_srcname;
92  };
93 
98  void select_string(const char *in, const char *my_srcname=NULL) {
99  theLexer.select_string(in);
100  srcname = my_srcname;
101  };
102 
103  // -- low-level public methods: PARSING
104  virtual int yylex();
105 
110  mootClassfreqs *parse_classfreqs();
111 
112  // -- low-level public methods: ERRORS & WARNINGS
114  virtual void yyerror(const char *msg);
115 
117  virtual void yywarn(const char *msg);
118 };
119 
120 moot_END_NAMESPACE
121 
122 #endif /* _moot_CLASSFREQS_COMPILER_H */
flex++ lexical-class-frequency parameter file lexer: autogenerated header
const char * srcname
Definition: mootClassfreqsCompiler.h:64
mootClassfreqsCompiler()
Definition: mootClassfreqsCompiler.h:69
Class for storage and retrieval of raw lexical-class frequencies.
Definition: mootClassfreqs.h:44
const char * objname
Definition: mootClassfreqsCompiler.h:58
void select_string(const char *in, FILE *out=stderr, const char *myname=__null)
Definition: mootGenericLexer.h:231
flex++ lexer for (TnT-style) moot lexical-class-frequency parameter files
Definition: mootClassfreqsLexer.h:51
mootClassfreqsLexer theLexer
Definition: mootClassfreqsCompiler.h:52
void select_streams(FILE *in, FILE *out=stdout, const char *myname=__null)
Definition: mootGenericLexer.h:220
Lexical-class frequency parameter-file compiler.
Definition: mootClassfreqsCompiler.h:48
bison++ parser for (TnT-style) moot lexical-class-frequency parameter files
Definition: mootClassfreqsParser.h:63