wasteLexicon.h
Go to the documentation of this file.
1 /* -*- Mode: C++; coding: utf-8; c-basic-offset: 2; -*- */
2 /*
3  libmoot : moot part-of-speech tagging library
4  Copyright (C) 2013 by Bryan Jurish <moocow@cpan.org> and Kay-Michael Würzner
5 
6  This library is free software; you can redistribute it and/or
7  modify it under the terms of the GNU Lesser General Public
8  License as published by the Free Software Foundation; either
9  version 3 of the License, or (at your option) any later version.
10 
11  This library is distributed in the hope that it will be useful,
12  but WITHOUT ANY WARRANTY; without even the implied warranty of
13  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14  Lesser General Public License for more details.
15 
16  You should have received a copy of the GNU Lesser General Public
17  License along with this library; if not, write to the Free Software
18  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
19 */
20 
32 #ifndef _WASTE_LEXICON_H
33 #define _WASTE_LEXICON_H
34 
35 #include <mootTokenIO.h>
36 
37 moot_BEGIN_NAMESPACE
38 
39 /*============================================================================
40  * wasteLexicon
41  */
44 {
45  public:
46  typedef moot_STL_NAMESPACE::hash_set<std::string> Lexicon;
47  Lexicon lex;
49  //------------------------------------------------------------
51 
52 
54  {};
55 
58  {};
59 
61  inline void clear()
62  {
63  lex.clear();
64  };
66 
67  //------------------------------------------------------------
69 
70 
71  inline bool lookup(const std::string &word) const
72  {
73  return (lex.find(word) != lex.end());
74  };
75 
77  inline void insert(const std::string &word)
78  {
79  lex.insert(word);
80  };
82 
83  //------------------------------------------------------------
85 
86 
89  bool load(moot::TokenReader *reader);
90 
94  bool load(mootio::mistream *mis);
95 
99  bool load(const char *filename);
101 };
102 
103 moot_END_NAMESPACE
104 
105 #endif /* _WASTE_LEXICON_H */
106 
void insert(const std::string &word)
Definition: wasteLexicon.h:77
~wasteLexicon()
Definition: wasteLexicon.h:57
Abstract class for token input.
Definition: mootTokenIO.h:208
wasteLexicon()
Definition: wasteLexicon.h:53
bool lookup(const std::string &word) const
Definition: wasteLexicon.h:71
simple hash_set<>-based lexicon class
Definition: wasteLexicon.h:43
Abstract and native classes for I/O of moot::mootToken objects.
__gnu_cxx::hash_set< std::string > Lexicon
Definition: wasteLexicon.h:46
Lexicon lex
Definition: wasteLexicon.h:47
void clear()
Definition: wasteLexicon.h:61
Abstract base class for input stream wrappers.
Definition: mootIO.h:129