1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
|
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html lang="en">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
<title>LCOV - lcov.info - /usr/include/xapian/termgenerator.h</title>
<link rel="stylesheet" type="text/css" href="../../../gcov.css">
</head>
<body>
<table width="100%" border=0 cellspacing=0 cellpadding=0>
<tr><td class="title">LTP GCOV extension - code coverage report</td></tr>
<tr><td class="ruler"><img src="../../../glass.png" width=3 height=3 alt=""></td></tr>
<tr>
<td width="100%">
<table cellpadding=1 border=0 width="100%">
<tr>
<td class="headerItem" width="20%">Current view:</td>
<td class="headerValue" width="80%" colspan=4><a href="../../../index.html">directory</a> - <a href="index.html">usr/include/xapian</a> - termgenerator.h</td>
</tr>
<tr>
<td class="headerItem" width="20%">Test:</td>
<td class="headerValue" width="80%" colspan=4>lcov.info</td>
</tr>
<tr>
<td class="headerItem" width="20%">Date:</td>
<td class="headerValue" width="20%">2008-08-14</td>
<td width="20%"></td>
<td class="headerItem" width="20%">Instrumented lines:</td>
<td class="headerValue" width="20%">2</td>
</tr>
<tr>
<td class="headerItem" width="20%">Code covered:</td>
<td class="headerValue" width="20%">100.0 %</td>
<td width="20%"></td>
<td class="headerItem" width="20%">Executed lines:</td>
<td class="headerValue" width="20%">2</td>
</tr>
</table>
</td>
</tr>
<tr><td class="ruler"><img src="../../../glass.png" width=3 height=3 alt=""></td></tr>
</table>
<table cellpadding=0 cellspacing=0 border=0>
<tr>
<td><br></td>
</tr>
<tr>
<td><pre class="source">
<span class="lineNum"> 1 </span> : /** @file termgenerator.h
<span class="lineNum"> 2 </span> : * @brief parse free text and generate terms
<span class="lineNum"> 3 </span> : */
<span class="lineNum"> 4 </span> : /* Copyright (C) 2007 Olly Betts
<span class="lineNum"> 5 </span> : *
<span class="lineNum"> 6 </span> : * This program is free software; you can redistribute it and/or modify
<span class="lineNum"> 7 </span> : * it under the terms of the GNU General Public License as published by
<span class="lineNum"> 8 </span> : * the Free Software Foundation; either version 2 of the License, or
<span class="lineNum"> 9 </span> : * (at your option) any later version.
<span class="lineNum"> 10 </span> : *
<span class="lineNum"> 11 </span> : * This program is distributed in the hope that it will be useful,
<span class="lineNum"> 12 </span> : * but WITHOUT ANY WARRANTY; without even the implied warranty of
<span class="lineNum"> 13 </span> : * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
<span class="lineNum"> 14 </span> : * GNU General Public License for more details.
<span class="lineNum"> 15 </span> : *
<span class="lineNum"> 16 </span> : * You should have received a copy of the GNU General Public License
<span class="lineNum"> 17 </span> : * along with this program; if not, write to the Free Software
<span class="lineNum"> 18 </span> : * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
<span class="lineNum"> 19 </span> : */
<span class="lineNum"> 20 </span> :
<span class="lineNum"> 21 </span> : #ifndef XAPIAN_INCLUDED_TERMGENERATOR_H
<span class="lineNum"> 22 </span> : #define XAPIAN_INCLUDED_TERMGENERATOR_H
<span class="lineNum"> 23 </span> :
<span class="lineNum"> 24 </span> : #include <xapian/base.h>
<span class="lineNum"> 25 </span> : #include <xapian/types.h>
<span class="lineNum"> 26 </span> : #include <xapian/unicode.h>
<span class="lineNum"> 27 </span> : #include <xapian/visibility.h>
<span class="lineNum"> 28 </span> :
<span class="lineNum"> 29 </span> : #include <string>
<span class="lineNum"> 30 </span> :
<span class="lineNum"> 31 </span> : namespace Xapian {
<span class="lineNum"> 32 </span> :
<span class="lineNum"> 33 </span> : class Document;
<span class="lineNum"> 34 </span> : class Stem;
<span class="lineNum"> 35 </span> : class Stopper;
<span class="lineNum"> 36 </span> : class WritableDatabase;
<span class="lineNum"> 37 </span> :
<span class="lineNum"> 38 </span> : /** Parses a piece of text and generate terms.
<span class="lineNum"> 39 </span> : *
<span class="lineNum"> 40 </span> : * This module takes a piece of text and parses it to produce words which are
<span class="lineNum"> 41 </span> : * then used to generate suitable terms for indexing. The terms generated are
<span class="lineNum"> 42 </span> : * suitable for use with Query objects produced by the QueryParser class.
<span class="lineNum"> 43 </span> : */
<span class="lineNum"> 44 </span> : class XAPIAN_VISIBILITY_DEFAULT TermGenerator {
<span class="lineNum"> 45 </span> : public:
<span class="lineNum"> 46 </span> : /// @private @internal Class representing the TermGenerator internals.
<span class="lineNum"> 47 </span> : class Internal;
<span class="lineNum"> 48 </span> : /// @private @internal Reference counted internals.
<span class="lineNum"> 49 </span> : Xapian::Internal::RefCntPtr<Internal> internal;
<span class="lineNum"> 50 </span> :
<span class="lineNum"> 51 </span> : /// Copy constructor.
<span class="lineNum"> 52 </span> : TermGenerator(const TermGenerator & o);
<span class="lineNum"> 53 </span> :
<span class="lineNum"> 54 </span> : /// Assignment.
<span class="lineNum"> 55 </span> : TermGenerator & operator=(const TermGenerator & o);
<span class="lineNum"> 56 </span> :
<span class="lineNum"> 57 </span> : /// Default constructor.
<span class="lineNum"> 58 </span> : TermGenerator();
<span class="lineNum"> 59 </span> :
<span class="lineNum"> 60 </span> : /// Destructor.
<span class="lineNum"> 61 </span> : ~TermGenerator();
<span class="lineNum"> 62 </span> :
<span class="lineNum"> 63 </span> : /// Set the Xapian::Stem object to be used for generating stemmed terms.
<span class="lineNum"> 64 </span> : void set_stemmer(const Xapian::Stem & stemmer);
<span class="lineNum"> 65 </span> :
<span class="lineNum"> 66 </span> : /// Set the Xapian::Stopper object to be used for identifying stopwords.
<span class="lineNum"> 67 </span> : void set_stopper(const Xapian::Stopper *stop = NULL);
<span class="lineNum"> 68 </span> :
<span class="lineNum"> 69 </span> : /// Set the current document.
<span class="lineNum"> 70 </span> : void set_document(const Xapian::Document & doc);
<span class="lineNum"> 71 </span> :
<span class="lineNum"> 72 </span> : /// Get the current document.
<span class="lineNum"> 73 </span> : const Xapian::Document & get_document() const;
<span class="lineNum"> 74 </span> :
<span class="lineNum"> 75 </span> : /// Set the database to index spelling data to.
<span class="lineNum"> 76 </span> : void set_database(const Xapian::WritableDatabase &db);
<span class="lineNum"> 77 </span> :
<span class="lineNum"> 78 </span> : /// Flags to OR together and pass to TermGenerator::set_flags().
<span class="lineNum"> 79 </span> : enum flags {
<span class="lineNum"> 80 </span> : /// Index data required for spelling correction.
<span class="lineNum"> 81 </span> : FLAG_SPELLING = 128 // Value matches QueryParser flag.
<span class="lineNum"> 82 </span> : };
<span class="lineNum"> 83 </span> :
<span class="lineNum"> 84 </span> : /** Set flags.
<span class="lineNum"> 85 </span> : *
<span class="lineNum"> 86 </span> : * The new value of flags is: (flags & mask) ^ toggle
<span class="lineNum"> 87 </span> : *
<span class="lineNum"> 88 </span> : * To just set the flags, pass the new flags in toggle and the
<span class="lineNum"> 89 </span> : * default value for mask.
<span class="lineNum"> 90 </span> : *
<span class="lineNum"> 91 </span> : * @param toggle Flags to XOR.
<span class="lineNum"> 92 </span> : * @param mask Flags to AND with first.
<span class="lineNum"> 93 </span> : *
<span class="lineNum"> 94 </span> : * @return The old flags setting.
<span class="lineNum"> 95 </span> : */
<span class="lineNum"> 96 </span> : flags set_flags(flags toggle, flags mask = flags(0));
<span class="lineNum"> 97 </span> :
<span class="lineNum"> 98 </span> : /** Index some text.
<span class="lineNum"> 99 </span> : *
<span class="lineNum"> 100 </span> : * @param weight The wdf increment (default 1).
<span class="lineNum"> 101 </span> : * @param prefix The term prefix to use (default is no prefix).
<span class="lineNum"> 102 </span> : */
<span class="lineNum"> 103 </span> : void index_text(const Xapian::Utf8Iterator & itor,
<span class="lineNum"> 104 </span> : Xapian::termcount weight = 1,
<span class="lineNum"> 105 </span> : const std::string & prefix = "");
<span class="lineNum"> 106 </span> :
<span class="lineNum"> 107 </span> : /** Index some text in a std::string.
<span class="lineNum"> 108 </span> : *
<span class="lineNum"> 109 </span> : * @param weight The wdf increment (default 1).
<span class="lineNum"> 110 </span> : * @param prefix The term prefix to use (default is no prefix).
<span class="lineNum"> 111 </span> : */
<span class="lineNum"> 112 </span> : void index_text(const std::string & text,
<span class="lineNum"> 113 </span> : Xapian::termcount weight = 1,
<span class="lineNum"> 114 </span> : const std::string & prefix = "") {
<span class="lineNum"> 115 </span> : return index_text(Utf8Iterator(text), weight, prefix);
<span class="lineNum"> 116 </span> : }
<span class="lineNum"> 117 </span> :
<span class="lineNum"> 118 </span> : /** Index some text without positional information.
<span class="lineNum"> 119 </span> : *
<span class="lineNum"> 120 </span> : * Just like index_text, but no positional information is generated. This
<span class="lineNum"> 121 </span> : * means that the database will be significantly smaller, but that phrase
<span class="lineNum"> 122 </span> : * searching and NEAR won't be supported.
<span class="lineNum"> 123 </span> : */
<span class="lineNum"> 124 </span> : void index_text_without_positions(const Xapian::Utf8Iterator & itor,
<span class="lineNum"> 125 </span> : Xapian::termcount weight = 1,
<span class="lineNum"> 126 </span> : const std::string & prefix = "");
<span class="lineNum"> 127 </span> :
<span class="lineNum"> 128 </span> : /** Index some text in a std::string without positional information.
<span class="lineNum"> 129 </span> : *
<span class="lineNum"> 130 </span> : * Just like index_text, but no positional information is generated. This
<span class="lineNum"> 131 </span> : * means that the database will be significantly smaller, but that phrase
<span class="lineNum"> 132 </span> : * searching and NEAR won't be supported.
<span class="lineNum"> 133 </span> : */
<span class="lineNum"> 134 </span> : void index_text_without_positions(const std::string & text,
<span class="lineNum"> 135 </span> : Xapian::termcount weight = 1,
<span class="lineNum"> 136 </span><span class="lineCov"> 5208 : const std::string & prefix = "") {</span>
<span class="lineNum"> 137 </span><span class="lineCov"> 5208 : return index_text_without_positions(Utf8Iterator(text), weight, prefix);</span>
<span class="lineNum"> 138 </span> : }
<span class="lineNum"> 139 </span> :
<span class="lineNum"> 140 </span> : /** Increase the termpos used by index_text by @a delta.
<span class="lineNum"> 141 </span> : *
<span class="lineNum"> 142 </span> : * This can be used to prevent phrase searches from spanning two
<span class="lineNum"> 143 </span> : * unconnected blocks of text (e.g. the title and body text).
<span class="lineNum"> 144 </span> : */
<span class="lineNum"> 145 </span> : void increase_termpos(Xapian::termcount delta = 100);
<span class="lineNum"> 146 </span> :
<span class="lineNum"> 147 </span> : /// Get the current term position.
<span class="lineNum"> 148 </span> : Xapian::termcount get_termpos() const;
<span class="lineNum"> 149 </span> :
<span class="lineNum"> 150 </span> : /// Set the current term position.
<span class="lineNum"> 151 </span> : void set_termpos(Xapian::termcount termpos);
<span class="lineNum"> 152 </span> :
<span class="lineNum"> 153 </span> : /// Return a string describing this object.
<span class="lineNum"> 154 </span> : std::string get_description() const;
<span class="lineNum"> 155 </span> : };
<span class="lineNum"> 156 </span> :
<span class="lineNum"> 157 </span> : }
<span class="lineNum"> 158 </span> :
<span class="lineNum"> 159 </span> : #endif // XAPIAN_INCLUDED_TERMGENERATOR_H
</pre>
</td>
</tr>
</table>
<br>
<table width="100%" border=0 cellspacing=0 cellpadding=0>
<tr><td class="ruler"><img src="../../../glass.png" width=3 height=3 alt=""></td></tr>
<tr><td class="versionInfo">Generated by: <a href="http://ltp.sourceforge.net/coverage/lcov.php" target="_parent">LTP GCOV extension version 1.6</a></td></tr>
</table>
<br>
</body>
</html>
|