wasteTypes.h
Go to the documentation of this file.
1 /* -*- Mode: C++; coding: utf-8; c-basic-offset: 2; -*- */
2 /*
3  libmoot : moocow's part-of-speech tagging library
4  Copyright (C) 2013-2017 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 
21 /*--------------------------------------------------------------------------
22  * File: wasteTypes.h
23  * Author: Bryan Jurish <moocow@cpan.org>, Kay-Michael Würzner
24  * Description:
25  * + moot PoS tagger : WASTE HMM tokenizer: common definitions
26  *--------------------------------------------------------------------------*/
27 
32 #ifndef _WASTE_TYPES_H
33 #define _WASTE_TYPES_H
34 
35 #include <string>
36 #include <stdexcept>
37 
38 namespace moot {
39 
60 };
62 
64 extern const char *wasteScannerTypeNames[NwScanTypes];
65 
66 
100 };
102 
104 extern const char *wasteLexerTypeNames[NwLexerTypes];
105 
106 //--------------------------------------------------------------------------
108 
109 
112  wtap_w = 1, //-- 'w': beginning-of-word
113  wtap_S = 4, //-- 'S': end-of-sentence
114  wtap_s = 7 //-- 's': beginning-of-sentence
115 };
117 
121 inline bool waste_tag_attr_get(const std::string &tagstr, size_t rpos, bool mydefault=false)
122 {
123  return tagstr.size() > rpos ? (tagstr[tagstr.size()-rpos]!='0') : mydefault;
124 };
125 
129 inline void waste_tag_attr_set(std::string &tagstr, size_t rpos, bool val)
130 {
131  if (tagstr.size() <= rpos) throw std::overflow_error("waste_tag_attr_set(): tag string too short");
132  tagstr[tagstr.size()-rpos] = (val ? '1' : '0');
133 };
134 
136 
137 //--------------------------------------------------------------------------
139 
140 
142 wasteLexerTypeE waste_casetype(const std::string &tok_text);
143 
145 wasteLexerTypeE waste_lexertype(const std::string &tok_text);
147 
148 }; /*--/namespace moot --*/
149 
150 #endif /* _WASTE_TYPES_H */
151 
Definition: mootAssocVector.h:39
Definition: wasteTypes.h:74
Definition: wasteTypes.h:55
Definition: wasteTypes.h:93
void waste_tag_attr_set(std::string &tagstr, size_t rpos, bool val)
Definition: wasteTypes.h:129
wasteTagAttrPosE wasteTagAttrPos
Definition: wasteTypes.h:116
wasteLexerTypeE wasteLexerType
Definition: wasteTypes.h:101
wasteLexerTypeE
Definition: wasteTypes.h:68
Definition: wasteTypes.h:44
Definition: wasteTypes.h:92
Definition: wasteTypes.h:70
Definition: wasteTypes.h:82
Definition: wasteTypes.h:45
Definition: wasteTypes.h:94
wasteScannerTypeE wasteScannerType
Definition: wasteTypes.h:61
Definition: wasteTypes.h:90
Definition: wasteTypes.h:75
Definition: wasteTypes.h:59
Definition: wasteTypes.h:78
wasteLexerTypeE waste_casetype(const std::string &tok_text)
Definition: wasteTypes.h:48
Definition: wasteTypes.h:112
bool waste_tag_attr_get(const std::string &tagstr, size_t rpos, bool mydefault=false)
Definition: wasteTypes.h:121
Definition: wasteTypes.h:57
Definition: wasteTypes.h:46
const char * wasteLexerTypeNames[NwLexerTypes]
Definition: wasteTypes.h:80
Definition: wasteTypes.h:81
Definition: wasteTypes.h:73
Definition: wasteTypes.h:99
Definition: wasteTypes.h:89
Definition: wasteTypes.h:85
Definition: wasteTypes.h:53
Definition: wasteTypes.h:43
Definition: wasteTypes.h:51
const char * wasteScannerTypeNames[NwScanTypes]
Definition: wasteTypes.h:76
Definition: wasteTypes.h:71
wasteTagAttrPosE
Definition: wasteTypes.h:111
wasteLexerTypeE waste_lexertype(const std::string &tok_text)
Definition: wasteTypes.h:56
Definition: wasteTypes.h:83
Definition: wasteTypes.h:72
Definition: wasteTypes.h:54
Definition: wasteTypes.h:52
Definition: wasteTypes.h:42
Definition: wasteTypes.h:47
Definition: wasteTypes.h:77
wasteScannerTypeE
Definition: wasteTypes.h:41
Definition: wasteTypes.h:114
Definition: wasteTypes.h:86
Definition: wasteTypes.h:69
Definition: wasteTypes.h:88
Definition: wasteTypes.h:95
Definition: wasteTypes.h:58
Definition: wasteTypes.h:49
Definition: wasteTypes.h:50
Definition: wasteTypes.h:113
Definition: wasteTypes.h:97
Definition: wasteTypes.h:79