ferret 0.11.6 → 0.11.8.4
Sign up to get free protection for your applications and to get access to all the features.
- data/README +10 -22
- data/RELEASE_CHANGES +137 -0
- data/RELEASE_NOTES +60 -0
- data/Rakefile +379 -274
- data/TODO +100 -8
- data/bin/ferret-browser +0 -0
- data/ext/BZLIB_blocksort.c +1094 -0
- data/ext/BZLIB_bzlib.c +1578 -0
- data/ext/BZLIB_compress.c +672 -0
- data/ext/BZLIB_crctable.c +104 -0
- data/ext/BZLIB_decompress.c +626 -0
- data/ext/BZLIB_huffman.c +205 -0
- data/ext/BZLIB_randtable.c +84 -0
- data/ext/{api.c → STEMMER_api.c} +7 -10
- data/ext/{libstemmer.c → STEMMER_libstemmer.c} +3 -2
- data/ext/{stem_ISO_8859_1_danish.c → STEMMER_stem_ISO_8859_1_danish.c} +123 -124
- data/ext/{stem_ISO_8859_1_dutch.c → STEMMER_stem_ISO_8859_1_dutch.c} +177 -188
- data/ext/STEMMER_stem_ISO_8859_1_english.c +1117 -0
- data/ext/{stem_ISO_8859_1_finnish.c → STEMMER_stem_ISO_8859_1_finnish.c} +276 -306
- data/ext/STEMMER_stem_ISO_8859_1_french.c +1246 -0
- data/ext/{stem_ISO_8859_1_german.c → STEMMER_stem_ISO_8859_1_german.c} +161 -170
- data/ext/STEMMER_stem_ISO_8859_1_hungarian.c +1230 -0
- data/ext/STEMMER_stem_ISO_8859_1_italian.c +1065 -0
- data/ext/STEMMER_stem_ISO_8859_1_norwegian.c +297 -0
- data/ext/{stem_ISO_8859_1_porter.c → STEMMER_stem_ISO_8859_1_porter.c} +263 -290
- data/ext/{stem_ISO_8859_1_portuguese.c → STEMMER_stem_ISO_8859_1_portuguese.c} +362 -380
- data/ext/STEMMER_stem_ISO_8859_1_spanish.c +1093 -0
- data/ext/STEMMER_stem_ISO_8859_1_swedish.c +307 -0
- data/ext/STEMMER_stem_ISO_8859_2_romanian.c +998 -0
- data/ext/{stem_KOI8_R_russian.c → STEMMER_stem_KOI8_R_russian.c} +244 -245
- data/ext/STEMMER_stem_UTF_8_danish.c +339 -0
- data/ext/{stem_UTF_8_dutch.c → STEMMER_stem_UTF_8_dutch.c} +192 -211
- data/ext/STEMMER_stem_UTF_8_english.c +1125 -0
- data/ext/{stem_UTF_8_finnish.c → STEMMER_stem_UTF_8_finnish.c} +284 -324
- data/ext/STEMMER_stem_UTF_8_french.c +1256 -0
- data/ext/{stem_UTF_8_german.c → STEMMER_stem_UTF_8_german.c} +170 -187
- data/ext/STEMMER_stem_UTF_8_hungarian.c +1234 -0
- data/ext/STEMMER_stem_UTF_8_italian.c +1073 -0
- data/ext/STEMMER_stem_UTF_8_norwegian.c +299 -0
- data/ext/{stem_UTF_8_porter.c → STEMMER_stem_UTF_8_porter.c} +271 -310
- data/ext/STEMMER_stem_UTF_8_portuguese.c +1023 -0
- data/ext/STEMMER_stem_UTF_8_romanian.c +1004 -0
- data/ext/STEMMER_stem_UTF_8_russian.c +694 -0
- data/ext/STEMMER_stem_UTF_8_spanish.c +1097 -0
- data/ext/STEMMER_stem_UTF_8_swedish.c +309 -0
- data/ext/STEMMER_stem_UTF_8_turkish.c +2205 -0
- data/ext/{utilities.c → STEMMER_utilities.c} +100 -68
- data/ext/analysis.c +276 -121
- data/ext/analysis.h +190 -143
- data/ext/api.h +3 -4
- data/ext/array.c +5 -3
- data/ext/array.h +52 -43
- data/ext/bitvector.c +38 -482
- data/ext/bitvector.h +446 -124
- data/ext/bzlib.h +282 -0
- data/ext/bzlib_private.h +503 -0
- data/ext/compound_io.c +23 -22
- data/ext/config.h +21 -11
- data/ext/document.c +43 -40
- data/ext/document.h +31 -21
- data/ext/except.c +20 -38
- data/ext/except.h +89 -76
- data/ext/extconf.rb +3 -2
- data/ext/ferret.c +49 -35
- data/ext/ferret.h +14 -11
- data/ext/field_index.c +262 -0
- data/ext/field_index.h +52 -0
- data/ext/filter.c +11 -10
- data/ext/fs_store.c +65 -47
- data/ext/global.c +245 -165
- data/ext/global.h +252 -54
- data/ext/hash.c +200 -243
- data/ext/hash.h +205 -163
- data/ext/hashset.c +118 -96
- data/ext/hashset.h +110 -82
- data/ext/header.h +19 -19
- data/ext/helper.c +11 -10
- data/ext/helper.h +14 -6
- data/ext/index.c +745 -366
- data/ext/index.h +503 -529
- data/ext/internal.h +1020 -0
- data/ext/lang.c +10 -0
- data/ext/lang.h +35 -15
- data/ext/mempool.c +5 -4
- data/ext/mempool.h +30 -22
- data/ext/modules.h +35 -7
- data/ext/multimapper.c +43 -2
- data/ext/multimapper.h +32 -23
- data/ext/posh.c +0 -0
- data/ext/posh.h +4 -38
- data/ext/priorityqueue.c +10 -12
- data/ext/priorityqueue.h +33 -21
- data/ext/q_boolean.c +22 -9
- data/ext/q_const_score.c +3 -2
- data/ext/q_filtered_query.c +15 -12
- data/ext/q_fuzzy.c +147 -135
- data/ext/q_match_all.c +3 -2
- data/ext/q_multi_term.c +28 -32
- data/ext/q_parser.c +451 -173
- data/ext/q_phrase.c +158 -79
- data/ext/q_prefix.c +16 -18
- data/ext/q_range.c +363 -31
- data/ext/q_span.c +130 -141
- data/ext/q_term.c +21 -21
- data/ext/q_wildcard.c +19 -23
- data/ext/r_analysis.c +369 -242
- data/ext/r_index.c +421 -434
- data/ext/r_qparser.c +142 -92
- data/ext/r_search.c +790 -407
- data/ext/r_store.c +44 -44
- data/ext/r_utils.c +264 -96
- data/ext/ram_store.c +29 -23
- data/ext/scanner.c +895 -0
- data/ext/scanner.h +36 -0
- data/ext/scanner_mb.c +6701 -0
- data/ext/scanner_utf8.c +4415 -0
- data/ext/search.c +210 -87
- data/ext/search.h +556 -488
- data/ext/similarity.c +17 -16
- data/ext/similarity.h +51 -44
- data/ext/sort.c +157 -354
- data/ext/stem_ISO_8859_1_hungarian.h +16 -0
- data/ext/stem_ISO_8859_2_romanian.h +16 -0
- data/ext/stem_UTF_8_hungarian.h +16 -0
- data/ext/stem_UTF_8_romanian.h +16 -0
- data/ext/stem_UTF_8_turkish.h +16 -0
- data/ext/stopwords.c +287 -278
- data/ext/store.c +57 -51
- data/ext/store.h +308 -286
- data/ext/symbol.c +10 -0
- data/ext/symbol.h +23 -0
- data/ext/term_vectors.c +14 -293
- data/ext/threading.h +22 -22
- data/ext/win32.h +12 -4
- data/lib/ferret.rb +2 -1
- data/lib/ferret/browser.rb +1 -1
- data/lib/ferret/field_symbol.rb +94 -0
- data/lib/ferret/index.rb +221 -34
- data/lib/ferret/number_tools.rb +6 -6
- data/lib/ferret/version.rb +3 -0
- data/test/{unit → long_running}/largefile/tc_largefile.rb +1 -1
- data/test/test_helper.rb +7 -2
- data/test/test_installed.rb +1 -0
- data/test/threading/thread_safety_index_test.rb +10 -1
- data/test/threading/thread_safety_read_write_test.rb +4 -7
- data/test/threading/thread_safety_test.rb +0 -0
- data/test/unit/analysis/tc_analyzer.rb +29 -27
- data/test/unit/analysis/tc_token_stream.rb +23 -16
- data/test/unit/index/tc_index.rb +116 -11
- data/test/unit/index/tc_index_reader.rb +27 -27
- data/test/unit/index/tc_index_writer.rb +10 -0
- data/test/unit/index/th_doc.rb +38 -21
- data/test/unit/search/tc_filter.rb +31 -10
- data/test/unit/search/tc_index_searcher.rb +6 -0
- data/test/unit/search/tm_searcher.rb +53 -1
- data/test/unit/store/tc_fs_store.rb +40 -2
- data/test/unit/store/tc_ram_store.rb +0 -0
- data/test/unit/store/tm_store.rb +0 -0
- data/test/unit/store/tm_store_lock.rb +7 -6
- data/test/unit/tc_field_symbol.rb +26 -0
- data/test/unit/ts_analysis.rb +0 -0
- data/test/unit/ts_index.rb +0 -0
- data/test/unit/ts_store.rb +0 -0
- data/test/unit/ts_utils.rb +0 -0
- data/test/unit/utils/tc_number_tools.rb +0 -0
- data/test/utils/content_generator.rb +226 -0
- metadata +262 -221
- data/ext/inc/lang.h +0 -48
- data/ext/inc/threading.h +0 -31
- data/ext/stem_ISO_8859_1_english.c +0 -1156
- data/ext/stem_ISO_8859_1_french.c +0 -1276
- data/ext/stem_ISO_8859_1_italian.c +0 -1091
- data/ext/stem_ISO_8859_1_norwegian.c +0 -296
- data/ext/stem_ISO_8859_1_spanish.c +0 -1119
- data/ext/stem_ISO_8859_1_swedish.c +0 -307
- data/ext/stem_UTF_8_danish.c +0 -344
- data/ext/stem_UTF_8_english.c +0 -1176
- data/ext/stem_UTF_8_french.c +0 -1296
- data/ext/stem_UTF_8_italian.c +0 -1113
- data/ext/stem_UTF_8_norwegian.c +0 -302
- data/ext/stem_UTF_8_portuguese.c +0 -1055
- data/ext/stem_UTF_8_russian.c +0 -709
- data/ext/stem_UTF_8_spanish.c +0 -1137
- data/ext/stem_UTF_8_swedish.c +0 -313
- data/lib/ferret_version.rb +0 -3
data/ext/BZLIB_huffman.c
ADDED
@@ -0,0 +1,205 @@
|
|
1
|
+
|
2
|
+
/*-------------------------------------------------------------*/
|
3
|
+
/*--- Huffman coding low-level stuff ---*/
|
4
|
+
/*--- huffman.c ---*/
|
5
|
+
/*-------------------------------------------------------------*/
|
6
|
+
|
7
|
+
/* ------------------------------------------------------------------
|
8
|
+
This file is part of bzip2/libbzip2, a program and library for
|
9
|
+
lossless, block-sorting data compression.
|
10
|
+
|
11
|
+
bzip2/libbzip2 version 1.0.4 of 20 December 2006
|
12
|
+
Copyright (C) 1996-2006 Julian Seward <jseward@bzip.org>
|
13
|
+
|
14
|
+
Please read the WARNING, DISCLAIMER and PATENTS sections in the
|
15
|
+
README file.
|
16
|
+
|
17
|
+
This program is released under the terms of the license contained
|
18
|
+
in the file LICENSE.
|
19
|
+
------------------------------------------------------------------ */
|
20
|
+
|
21
|
+
|
22
|
+
#include "bzlib_private.h"
|
23
|
+
|
24
|
+
/*---------------------------------------------------*/
|
25
|
+
#define WEIGHTOF(zz0) ((zz0) & 0xffffff00)
|
26
|
+
#define DEPTHOF(zz1) ((zz1) & 0x000000ff)
|
27
|
+
#define MYMAX(zz2,zz3) ((zz2) > (zz3) ? (zz2) : (zz3))
|
28
|
+
|
29
|
+
#define ADDWEIGHTS(zw1,zw2) \
|
30
|
+
(WEIGHTOF(zw1)+WEIGHTOF(zw2)) | \
|
31
|
+
(1 + MYMAX(DEPTHOF(zw1),DEPTHOF(zw2)))
|
32
|
+
|
33
|
+
#define UPHEAP(z) \
|
34
|
+
{ \
|
35
|
+
Int32 zz, tmp; \
|
36
|
+
zz = z; tmp = heap[zz]; \
|
37
|
+
while (weight[tmp] < weight[heap[zz >> 1]]) { \
|
38
|
+
heap[zz] = heap[zz >> 1]; \
|
39
|
+
zz >>= 1; \
|
40
|
+
} \
|
41
|
+
heap[zz] = tmp; \
|
42
|
+
}
|
43
|
+
|
44
|
+
#define DOWNHEAP(z) \
|
45
|
+
{ \
|
46
|
+
Int32 zz, yy, tmp; \
|
47
|
+
zz = z; tmp = heap[zz]; \
|
48
|
+
while (True) { \
|
49
|
+
yy = zz << 1; \
|
50
|
+
if (yy > nHeap) break; \
|
51
|
+
if (yy < nHeap && \
|
52
|
+
weight[heap[yy+1]] < weight[heap[yy]]) \
|
53
|
+
yy++; \
|
54
|
+
if (weight[tmp] < weight[heap[yy]]) break; \
|
55
|
+
heap[zz] = heap[yy]; \
|
56
|
+
zz = yy; \
|
57
|
+
} \
|
58
|
+
heap[zz] = tmp; \
|
59
|
+
}
|
60
|
+
|
61
|
+
|
62
|
+
/*---------------------------------------------------*/
|
63
|
+
void BZ2_hbMakeCodeLengths ( UChar *len,
|
64
|
+
Int32 *freq,
|
65
|
+
Int32 alphaSize,
|
66
|
+
Int32 maxLen )
|
67
|
+
{
|
68
|
+
/*--
|
69
|
+
Nodes and heap entries run from 1. Entry 0
|
70
|
+
for both the heap and nodes is a sentinel.
|
71
|
+
--*/
|
72
|
+
Int32 nNodes, nHeap, n1, n2, i, j, k;
|
73
|
+
Bool tooLong;
|
74
|
+
|
75
|
+
Int32 heap [ BZ_MAX_ALPHA_SIZE + 2 ];
|
76
|
+
Int32 weight [ BZ_MAX_ALPHA_SIZE * 2 ];
|
77
|
+
Int32 parent [ BZ_MAX_ALPHA_SIZE * 2 ];
|
78
|
+
|
79
|
+
for (i = 0; i < alphaSize; i++)
|
80
|
+
weight[i+1] = (freq[i] == 0 ? 1 : freq[i]) << 8;
|
81
|
+
|
82
|
+
while (True) {
|
83
|
+
|
84
|
+
nNodes = alphaSize;
|
85
|
+
nHeap = 0;
|
86
|
+
|
87
|
+
heap[0] = 0;
|
88
|
+
weight[0] = 0;
|
89
|
+
parent[0] = -2;
|
90
|
+
|
91
|
+
for (i = 1; i <= alphaSize; i++) {
|
92
|
+
parent[i] = -1;
|
93
|
+
nHeap++;
|
94
|
+
heap[nHeap] = i;
|
95
|
+
UPHEAP(nHeap);
|
96
|
+
}
|
97
|
+
|
98
|
+
AssertH( nHeap < (BZ_MAX_ALPHA_SIZE+2), 2001 );
|
99
|
+
|
100
|
+
while (nHeap > 1) {
|
101
|
+
n1 = heap[1]; heap[1] = heap[nHeap]; nHeap--; DOWNHEAP(1);
|
102
|
+
n2 = heap[1]; heap[1] = heap[nHeap]; nHeap--; DOWNHEAP(1);
|
103
|
+
nNodes++;
|
104
|
+
parent[n1] = parent[n2] = nNodes;
|
105
|
+
weight[nNodes] = ADDWEIGHTS(weight[n1], weight[n2]);
|
106
|
+
parent[nNodes] = -1;
|
107
|
+
nHeap++;
|
108
|
+
heap[nHeap] = nNodes;
|
109
|
+
UPHEAP(nHeap);
|
110
|
+
}
|
111
|
+
|
112
|
+
AssertH( nNodes < (BZ_MAX_ALPHA_SIZE * 2), 2002 );
|
113
|
+
|
114
|
+
tooLong = False;
|
115
|
+
for (i = 1; i <= alphaSize; i++) {
|
116
|
+
j = 0;
|
117
|
+
k = i;
|
118
|
+
while (parent[k] >= 0) { k = parent[k]; j++; }
|
119
|
+
len[i-1] = j;
|
120
|
+
if (j > maxLen) tooLong = True;
|
121
|
+
}
|
122
|
+
|
123
|
+
if (! tooLong) break;
|
124
|
+
|
125
|
+
/* 17 Oct 04: keep-going condition for the following loop used
|
126
|
+
to be 'i < alphaSize', which missed the last element,
|
127
|
+
theoretically leading to the possibility of the compressor
|
128
|
+
looping. However, this count-scaling step is only needed if
|
129
|
+
one of the generated Huffman code words is longer than
|
130
|
+
maxLen, which up to and including version 1.0.2 was 20 bits,
|
131
|
+
which is extremely unlikely. In version 1.0.3 maxLen was
|
132
|
+
changed to 17 bits, which has minimal effect on compression
|
133
|
+
ratio, but does mean this scaling step is used from time to
|
134
|
+
time, enough to verify that it works.
|
135
|
+
|
136
|
+
This means that bzip2-1.0.3 and later will only produce
|
137
|
+
Huffman codes with a maximum length of 17 bits. However, in
|
138
|
+
order to preserve backwards compatibility with bitstreams
|
139
|
+
produced by versions pre-1.0.3, the decompressor must still
|
140
|
+
handle lengths of up to 20. */
|
141
|
+
|
142
|
+
for (i = 1; i <= alphaSize; i++) {
|
143
|
+
j = weight[i] >> 8;
|
144
|
+
j = 1 + (j / 2);
|
145
|
+
weight[i] = j << 8;
|
146
|
+
}
|
147
|
+
}
|
148
|
+
}
|
149
|
+
|
150
|
+
|
151
|
+
/*---------------------------------------------------*/
|
152
|
+
void BZ2_hbAssignCodes ( Int32 *code,
|
153
|
+
UChar *length,
|
154
|
+
Int32 minLen,
|
155
|
+
Int32 maxLen,
|
156
|
+
Int32 alphaSize )
|
157
|
+
{
|
158
|
+
Int32 n, vec, i;
|
159
|
+
|
160
|
+
vec = 0;
|
161
|
+
for (n = minLen; n <= maxLen; n++) {
|
162
|
+
for (i = 0; i < alphaSize; i++)
|
163
|
+
if (length[i] == n) { code[i] = vec; vec++; };
|
164
|
+
vec <<= 1;
|
165
|
+
}
|
166
|
+
}
|
167
|
+
|
168
|
+
|
169
|
+
/*---------------------------------------------------*/
|
170
|
+
void BZ2_hbCreateDecodeTables ( Int32 *limit,
|
171
|
+
Int32 *base,
|
172
|
+
Int32 *perm,
|
173
|
+
UChar *length,
|
174
|
+
Int32 minLen,
|
175
|
+
Int32 maxLen,
|
176
|
+
Int32 alphaSize )
|
177
|
+
{
|
178
|
+
Int32 pp, i, j, vec;
|
179
|
+
|
180
|
+
pp = 0;
|
181
|
+
for (i = minLen; i <= maxLen; i++)
|
182
|
+
for (j = 0; j < alphaSize; j++)
|
183
|
+
if (length[j] == i) { perm[pp] = j; pp++; };
|
184
|
+
|
185
|
+
for (i = 0; i < BZ_MAX_CODE_LEN; i++) base[i] = 0;
|
186
|
+
for (i = 0; i < alphaSize; i++) base[length[i]+1]++;
|
187
|
+
|
188
|
+
for (i = 1; i < BZ_MAX_CODE_LEN; i++) base[i] += base[i-1];
|
189
|
+
|
190
|
+
for (i = 0; i < BZ_MAX_CODE_LEN; i++) limit[i] = 0;
|
191
|
+
vec = 0;
|
192
|
+
|
193
|
+
for (i = minLen; i <= maxLen; i++) {
|
194
|
+
vec += (base[i+1] - base[i]);
|
195
|
+
limit[i] = vec-1;
|
196
|
+
vec <<= 1;
|
197
|
+
}
|
198
|
+
for (i = minLen + 1; i <= maxLen; i++)
|
199
|
+
base[i] = ((limit[i-1] + 1) << 1) - base[i];
|
200
|
+
}
|
201
|
+
|
202
|
+
|
203
|
+
/*-------------------------------------------------------------*/
|
204
|
+
/*--- end huffman.c ---*/
|
205
|
+
/*-------------------------------------------------------------*/
|
@@ -0,0 +1,84 @@
|
|
1
|
+
|
2
|
+
/*-------------------------------------------------------------*/
|
3
|
+
/*--- Table for randomising repetitive blocks ---*/
|
4
|
+
/*--- randtable.c ---*/
|
5
|
+
/*-------------------------------------------------------------*/
|
6
|
+
|
7
|
+
/* ------------------------------------------------------------------
|
8
|
+
This file is part of bzip2/libbzip2, a program and library for
|
9
|
+
lossless, block-sorting data compression.
|
10
|
+
|
11
|
+
bzip2/libbzip2 version 1.0.4 of 20 December 2006
|
12
|
+
Copyright (C) 1996-2006 Julian Seward <jseward@bzip.org>
|
13
|
+
|
14
|
+
Please read the WARNING, DISCLAIMER and PATENTS sections in the
|
15
|
+
README file.
|
16
|
+
|
17
|
+
This program is released under the terms of the license contained
|
18
|
+
in the file LICENSE.
|
19
|
+
------------------------------------------------------------------ */
|
20
|
+
|
21
|
+
|
22
|
+
#include "bzlib_private.h"
|
23
|
+
|
24
|
+
|
25
|
+
/*---------------------------------------------*/
|
26
|
+
Int32 BZ2_rNums[512] = {
|
27
|
+
619, 720, 127, 481, 931, 816, 813, 233, 566, 247,
|
28
|
+
985, 724, 205, 454, 863, 491, 741, 242, 949, 214,
|
29
|
+
733, 859, 335, 708, 621, 574, 73, 654, 730, 472,
|
30
|
+
419, 436, 278, 496, 867, 210, 399, 680, 480, 51,
|
31
|
+
878, 465, 811, 169, 869, 675, 611, 697, 867, 561,
|
32
|
+
862, 687, 507, 283, 482, 129, 807, 591, 733, 623,
|
33
|
+
150, 238, 59, 379, 684, 877, 625, 169, 643, 105,
|
34
|
+
170, 607, 520, 932, 727, 476, 693, 425, 174, 647,
|
35
|
+
73, 122, 335, 530, 442, 853, 695, 249, 445, 515,
|
36
|
+
909, 545, 703, 919, 874, 474, 882, 500, 594, 612,
|
37
|
+
641, 801, 220, 162, 819, 984, 589, 513, 495, 799,
|
38
|
+
161, 604, 958, 533, 221, 400, 386, 867, 600, 782,
|
39
|
+
382, 596, 414, 171, 516, 375, 682, 485, 911, 276,
|
40
|
+
98, 553, 163, 354, 666, 933, 424, 341, 533, 870,
|
41
|
+
227, 730, 475, 186, 263, 647, 537, 686, 600, 224,
|
42
|
+
469, 68, 770, 919, 190, 373, 294, 822, 808, 206,
|
43
|
+
184, 943, 795, 384, 383, 461, 404, 758, 839, 887,
|
44
|
+
715, 67, 618, 276, 204, 918, 873, 777, 604, 560,
|
45
|
+
951, 160, 578, 722, 79, 804, 96, 409, 713, 940,
|
46
|
+
652, 934, 970, 447, 318, 353, 859, 672, 112, 785,
|
47
|
+
645, 863, 803, 350, 139, 93, 354, 99, 820, 908,
|
48
|
+
609, 772, 154, 274, 580, 184, 79, 626, 630, 742,
|
49
|
+
653, 282, 762, 623, 680, 81, 927, 626, 789, 125,
|
50
|
+
411, 521, 938, 300, 821, 78, 343, 175, 128, 250,
|
51
|
+
170, 774, 972, 275, 999, 639, 495, 78, 352, 126,
|
52
|
+
857, 956, 358, 619, 580, 124, 737, 594, 701, 612,
|
53
|
+
669, 112, 134, 694, 363, 992, 809, 743, 168, 974,
|
54
|
+
944, 375, 748, 52, 600, 747, 642, 182, 862, 81,
|
55
|
+
344, 805, 988, 739, 511, 655, 814, 334, 249, 515,
|
56
|
+
897, 955, 664, 981, 649, 113, 974, 459, 893, 228,
|
57
|
+
433, 837, 553, 268, 926, 240, 102, 654, 459, 51,
|
58
|
+
686, 754, 806, 760, 493, 403, 415, 394, 687, 700,
|
59
|
+
946, 670, 656, 610, 738, 392, 760, 799, 887, 653,
|
60
|
+
978, 321, 576, 617, 626, 502, 894, 679, 243, 440,
|
61
|
+
680, 879, 194, 572, 640, 724, 926, 56, 204, 700,
|
62
|
+
707, 151, 457, 449, 797, 195, 791, 558, 945, 679,
|
63
|
+
297, 59, 87, 824, 713, 663, 412, 693, 342, 606,
|
64
|
+
134, 108, 571, 364, 631, 212, 174, 643, 304, 329,
|
65
|
+
343, 97, 430, 751, 497, 314, 983, 374, 822, 928,
|
66
|
+
140, 206, 73, 263, 980, 736, 876, 478, 430, 305,
|
67
|
+
170, 514, 364, 692, 829, 82, 855, 953, 676, 246,
|
68
|
+
369, 970, 294, 750, 807, 827, 150, 790, 288, 923,
|
69
|
+
804, 378, 215, 828, 592, 281, 565, 555, 710, 82,
|
70
|
+
896, 831, 547, 261, 524, 462, 293, 465, 502, 56,
|
71
|
+
661, 821, 976, 991, 658, 869, 905, 758, 745, 193,
|
72
|
+
768, 550, 608, 933, 378, 286, 215, 979, 792, 961,
|
73
|
+
61, 688, 793, 644, 986, 403, 106, 366, 905, 644,
|
74
|
+
372, 567, 466, 434, 645, 210, 389, 550, 919, 135,
|
75
|
+
780, 773, 635, 389, 707, 100, 626, 958, 165, 504,
|
76
|
+
920, 176, 193, 713, 857, 265, 203, 50, 668, 108,
|
77
|
+
645, 990, 626, 197, 510, 357, 358, 850, 858, 364,
|
78
|
+
936, 638
|
79
|
+
};
|
80
|
+
|
81
|
+
|
82
|
+
/*-------------------------------------------------------------*/
|
83
|
+
/*--- end randtable.c ---*/
|
84
|
+
/*-------------------------------------------------------------*/
|
data/ext/{api.c → STEMMER_api.c}
RENAMED
@@ -19,43 +19,40 @@ extern struct SN_env * SN_create_env(int S_size, int I_size, int B_size)
|
|
19
19
|
z->S[i] = create_s();
|
20
20
|
if (z->S[i] == NULL) goto error;
|
21
21
|
}
|
22
|
-
z->S_size = S_size;
|
23
22
|
}
|
24
23
|
|
25
24
|
if (I_size)
|
26
25
|
{
|
27
26
|
z->I = (int *) calloc(I_size, sizeof(int));
|
28
27
|
if (z->I == NULL) goto error;
|
29
|
-
z->I_size = I_size;
|
30
28
|
}
|
31
29
|
|
32
30
|
if (B_size)
|
33
31
|
{
|
34
|
-
z->B = (
|
32
|
+
z->B = (unsigned char *) calloc(B_size, sizeof(unsigned char));
|
35
33
|
if (z->B == NULL) goto error;
|
36
|
-
z->B_size = B_size;
|
37
34
|
}
|
38
35
|
|
39
36
|
return z;
|
40
37
|
error:
|
41
|
-
SN_close_env(z);
|
38
|
+
SN_close_env(z, S_size);
|
42
39
|
return NULL;
|
43
40
|
}
|
44
41
|
|
45
|
-
extern void SN_close_env(struct SN_env * z)
|
42
|
+
extern void SN_close_env(struct SN_env * z, int S_size)
|
46
43
|
{
|
47
44
|
if (z == NULL) return;
|
48
|
-
if (
|
45
|
+
if (S_size)
|
49
46
|
{
|
50
47
|
int i;
|
51
|
-
for (i = 0; i <
|
48
|
+
for (i = 0; i < S_size; i++)
|
52
49
|
{
|
53
50
|
lose_s(z->S[i]);
|
54
51
|
}
|
55
52
|
free(z->S);
|
56
53
|
}
|
57
|
-
|
58
|
-
|
54
|
+
free(z->I);
|
55
|
+
free(z->B);
|
59
56
|
if (z->p) lose_s(z->p);
|
60
57
|
free(z);
|
61
58
|
}
|
@@ -19,7 +19,8 @@ sb_stemmer_list(void)
|
|
19
19
|
return algorithm_names;
|
20
20
|
}
|
21
21
|
|
22
|
-
static
|
22
|
+
static stemmer_encoding_t
|
23
|
+
sb_getenc(const char * charenc)
|
23
24
|
{
|
24
25
|
struct stemmer_encoding * encoding;
|
25
26
|
if (charenc == NULL) return ENC_UTF_8;
|
@@ -33,7 +34,7 @@ static stemmer_encoding sb_getenc(const char * charenc)
|
|
33
34
|
extern struct sb_stemmer *
|
34
35
|
sb_stemmer_new(const char * algorithm, const char * charenc)
|
35
36
|
{
|
36
|
-
|
37
|
+
stemmer_encoding_t enc;
|
37
38
|
struct stemmer_modules * module;
|
38
39
|
struct sb_stemmer * stemmer =
|
39
40
|
(struct sb_stemmer *) malloc(sizeof(struct sb_stemmer));
|
@@ -3,50 +3,64 @@
|
|
3
3
|
|
4
4
|
#include "header.h"
|
5
5
|
|
6
|
+
#ifdef __cplusplus
|
7
|
+
extern "C" {
|
8
|
+
#endif
|
6
9
|
extern int danish_ISO_8859_1_stem(struct SN_env * z);
|
10
|
+
#ifdef __cplusplus
|
11
|
+
}
|
12
|
+
#endif
|
7
13
|
static int r_undouble(struct SN_env * z);
|
8
14
|
static int r_other_suffix(struct SN_env * z);
|
9
15
|
static int r_consonant_pair(struct SN_env * z);
|
10
16
|
static int r_main_suffix(struct SN_env * z);
|
11
17
|
static int r_mark_regions(struct SN_env * z);
|
18
|
+
#ifdef __cplusplus
|
19
|
+
extern "C" {
|
20
|
+
#endif
|
21
|
+
|
12
22
|
|
13
23
|
extern struct SN_env * danish_ISO_8859_1_create_env(void);
|
14
24
|
extern void danish_ISO_8859_1_close_env(struct SN_env * z);
|
15
25
|
|
16
|
-
static symbol s_0_0[3] = { 'h', 'e', 'd' };
|
17
|
-
static symbol s_0_1[5] = { 'e', 't', 'h', 'e', 'd' };
|
18
|
-
static symbol s_0_2[4] = { 'e', 'r', 'e', 'd' };
|
19
|
-
static symbol s_0_3[1] = { 'e' };
|
20
|
-
static symbol s_0_4[5] = { 'e', 'r', 'e', 'd', 'e' };
|
21
|
-
static symbol s_0_5[4] = { 'e', 'n', 'd', 'e' };
|
22
|
-
static symbol s_0_6[6] = { 'e', 'r', 'e', 'n', 'd', 'e' };
|
23
|
-
static symbol s_0_7[3] = { 'e', 'n', 'e' };
|
24
|
-
static symbol s_0_8[4] = { 'e', 'r', 'n', 'e' };
|
25
|
-
static symbol s_0_9[3] = { 'e', 'r', 'e' };
|
26
|
-
static symbol s_0_10[2] = { 'e', 'n' };
|
27
|
-
static symbol s_0_11[5] = { 'h', 'e', 'd', 'e', 'n' };
|
28
|
-
static symbol s_0_12[4] = { 'e', 'r', 'e', 'n' };
|
29
|
-
static symbol s_0_13[2] = { 'e', 'r' };
|
30
|
-
static symbol s_0_14[5] = { 'h', 'e', 'd', 'e', 'r' };
|
31
|
-
static symbol s_0_15[4] = { 'e', 'r', 'e', 'r' };
|
32
|
-
static symbol s_0_16[1] = { 's' };
|
33
|
-
static symbol s_0_17[4] = { 'h', 'e', 'd', 's' };
|
34
|
-
static symbol s_0_18[2] = { 'e', 's' };
|
35
|
-
static symbol s_0_19[5] = { 'e', 'n', 'd', 'e', 's' };
|
36
|
-
static symbol s_0_20[7] = { 'e', 'r', 'e', 'n', 'd', 'e', 's' };
|
37
|
-
static symbol s_0_21[4] = { 'e', 'n', 'e', 's' };
|
38
|
-
static symbol s_0_22[5] = { 'e', 'r', 'n', 'e', 's' };
|
39
|
-
static symbol s_0_23[4] = { 'e', 'r', 'e', 's' };
|
40
|
-
static symbol s_0_24[3] = { 'e', 'n', 's' };
|
41
|
-
static symbol s_0_25[6] = { 'h', 'e', 'd', 'e', 'n', 's' };
|
42
|
-
static symbol s_0_26[5] = { 'e', 'r', 'e', 'n', 's' };
|
43
|
-
static symbol s_0_27[3] = { 'e', 'r', 's' };
|
44
|
-
static symbol s_0_28[3] = { 'e', 't', 's' };
|
45
|
-
static symbol s_0_29[5] = { 'e', 'r', 'e', 't', 's' };
|
46
|
-
static symbol s_0_30[2] = { 'e', 't' };
|
47
|
-
static symbol s_0_31[4] = { 'e', 'r', 'e', 't' };
|
48
26
|
|
49
|
-
|
27
|
+
#ifdef __cplusplus
|
28
|
+
}
|
29
|
+
#endif
|
30
|
+
static const symbol s_0_0[3] = { 'h', 'e', 'd' };
|
31
|
+
static const symbol s_0_1[5] = { 'e', 't', 'h', 'e', 'd' };
|
32
|
+
static const symbol s_0_2[4] = { 'e', 'r', 'e', 'd' };
|
33
|
+
static const symbol s_0_3[1] = { 'e' };
|
34
|
+
static const symbol s_0_4[5] = { 'e', 'r', 'e', 'd', 'e' };
|
35
|
+
static const symbol s_0_5[4] = { 'e', 'n', 'd', 'e' };
|
36
|
+
static const symbol s_0_6[6] = { 'e', 'r', 'e', 'n', 'd', 'e' };
|
37
|
+
static const symbol s_0_7[3] = { 'e', 'n', 'e' };
|
38
|
+
static const symbol s_0_8[4] = { 'e', 'r', 'n', 'e' };
|
39
|
+
static const symbol s_0_9[3] = { 'e', 'r', 'e' };
|
40
|
+
static const symbol s_0_10[2] = { 'e', 'n' };
|
41
|
+
static const symbol s_0_11[5] = { 'h', 'e', 'd', 'e', 'n' };
|
42
|
+
static const symbol s_0_12[4] = { 'e', 'r', 'e', 'n' };
|
43
|
+
static const symbol s_0_13[2] = { 'e', 'r' };
|
44
|
+
static const symbol s_0_14[5] = { 'h', 'e', 'd', 'e', 'r' };
|
45
|
+
static const symbol s_0_15[4] = { 'e', 'r', 'e', 'r' };
|
46
|
+
static const symbol s_0_16[1] = { 's' };
|
47
|
+
static const symbol s_0_17[4] = { 'h', 'e', 'd', 's' };
|
48
|
+
static const symbol s_0_18[2] = { 'e', 's' };
|
49
|
+
static const symbol s_0_19[5] = { 'e', 'n', 'd', 'e', 's' };
|
50
|
+
static const symbol s_0_20[7] = { 'e', 'r', 'e', 'n', 'd', 'e', 's' };
|
51
|
+
static const symbol s_0_21[4] = { 'e', 'n', 'e', 's' };
|
52
|
+
static const symbol s_0_22[5] = { 'e', 'r', 'n', 'e', 's' };
|
53
|
+
static const symbol s_0_23[4] = { 'e', 'r', 'e', 's' };
|
54
|
+
static const symbol s_0_24[3] = { 'e', 'n', 's' };
|
55
|
+
static const symbol s_0_25[6] = { 'h', 'e', 'd', 'e', 'n', 's' };
|
56
|
+
static const symbol s_0_26[5] = { 'e', 'r', 'e', 'n', 's' };
|
57
|
+
static const symbol s_0_27[3] = { 'e', 'r', 's' };
|
58
|
+
static const symbol s_0_28[3] = { 'e', 't', 's' };
|
59
|
+
static const symbol s_0_29[5] = { 'e', 'r', 'e', 't', 's' };
|
60
|
+
static const symbol s_0_30[2] = { 'e', 't' };
|
61
|
+
static const symbol s_0_31[4] = { 'e', 'r', 'e', 't' };
|
62
|
+
|
63
|
+
static const struct among a_0[32] =
|
50
64
|
{
|
51
65
|
/* 0 */ { 3, s_0_0, -1, 1, 0},
|
52
66
|
/* 1 */ { 5, s_0_1, 0, 1, 0},
|
@@ -82,12 +96,12 @@ static struct among a_0[32] =
|
|
82
96
|
/* 31 */ { 4, s_0_31, 30, 1, 0}
|
83
97
|
};
|
84
98
|
|
85
|
-
static symbol s_1_0[2] = { 'g', 'd' };
|
86
|
-
static symbol s_1_1[2] = { 'd', 't' };
|
87
|
-
static symbol s_1_2[2] = { 'g', 't' };
|
88
|
-
static symbol s_1_3[2] = { 'k', 't' };
|
99
|
+
static const symbol s_1_0[2] = { 'g', 'd' };
|
100
|
+
static const symbol s_1_1[2] = { 'd', 't' };
|
101
|
+
static const symbol s_1_2[2] = { 'g', 't' };
|
102
|
+
static const symbol s_1_3[2] = { 'k', 't' };
|
89
103
|
|
90
|
-
static struct among a_1[4] =
|
104
|
+
static const struct among a_1[4] =
|
91
105
|
{
|
92
106
|
/* 0 */ { 2, s_1_0, -1, -1, 0},
|
93
107
|
/* 1 */ { 2, s_1_1, -1, -1, 0},
|
@@ -95,13 +109,13 @@ static struct among a_1[4] =
|
|
95
109
|
/* 3 */ { 2, s_1_3, -1, -1, 0}
|
96
110
|
};
|
97
111
|
|
98
|
-
static symbol s_2_0[2] = { 'i', 'g' };
|
99
|
-
static symbol s_2_1[3] = { 'l', 'i', 'g' };
|
100
|
-
static symbol s_2_2[4] = { 'e', 'l', 'i', 'g' };
|
101
|
-
static symbol s_2_3[3] = { 'e', 'l', 's' };
|
102
|
-
static symbol s_2_4[4] = { 'l', 0xF8, 's', 't' };
|
112
|
+
static const symbol s_2_0[2] = { 'i', 'g' };
|
113
|
+
static const symbol s_2_1[3] = { 'l', 'i', 'g' };
|
114
|
+
static const symbol s_2_2[4] = { 'e', 'l', 'i', 'g' };
|
115
|
+
static const symbol s_2_3[3] = { 'e', 'l', 's' };
|
116
|
+
static const symbol s_2_4[4] = { 'l', 0xF8, 's', 't' };
|
103
117
|
|
104
|
-
static struct among a_2[5] =
|
118
|
+
static const struct among a_2[5] =
|
105
119
|
{
|
106
120
|
/* 0 */ { 2, s_2_0, -1, 1, 0},
|
107
121
|
/* 1 */ { 3, s_2_1, 0, 1, 0},
|
@@ -110,75 +124,63 @@ static struct among a_2[5] =
|
|
110
124
|
/* 4 */ { 4, s_2_4, -1, 2, 0}
|
111
125
|
};
|
112
126
|
|
113
|
-
static unsigned char g_v[] = { 17, 65, 16, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 48, 0, 128 };
|
127
|
+
static const unsigned char g_v[] = { 17, 65, 16, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 48, 0, 128 };
|
114
128
|
|
115
|
-
static unsigned char g_s_ending[] = { 239, 254, 42, 3, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 16 };
|
129
|
+
static const unsigned char g_s_ending[] = { 239, 254, 42, 3, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 16 };
|
116
130
|
|
117
|
-
static symbol s_0[] = { 's', 't' };
|
118
|
-
static symbol s_1[] = { 'i', 'g' };
|
119
|
-
static symbol s_2[] = { 'l', 0xF8, 's' };
|
131
|
+
static const symbol s_0[] = { 's', 't' };
|
132
|
+
static const symbol s_1[] = { 'i', 'g' };
|
133
|
+
static const symbol s_2[] = { 'l', 0xF8, 's' };
|
120
134
|
|
121
135
|
static int r_mark_regions(struct SN_env * z) {
|
122
136
|
z->I[0] = z->l;
|
123
137
|
{ int c_test = z->c; /* test, line 33 */
|
124
|
-
{ int
|
125
|
-
if (0 >
|
126
|
-
z->c =
|
138
|
+
{ int ret = z->c + 3;
|
139
|
+
if (0 > ret || ret > z->l) return 0;
|
140
|
+
z->c = ret; /* hop, line 33 */
|
127
141
|
}
|
128
142
|
z->I[1] = z->c; /* setmark x, line 33 */
|
129
143
|
z->c = c_test;
|
130
144
|
}
|
131
|
-
|
132
|
-
|
133
|
-
|
134
|
-
|
135
|
-
|
136
|
-
lab0:
|
137
|
-
z->c = c;
|
138
|
-
if (z->c >= z->l) return 0;
|
139
|
-
z->c++; /* goto, line 34 */
|
140
|
-
}
|
141
|
-
while(1) { /* gopast, line 34 */
|
142
|
-
if (!(out_grouping(z, g_v, 97, 248))) goto lab1;
|
143
|
-
break;
|
144
|
-
lab1:
|
145
|
-
if (z->c >= z->l) return 0;
|
146
|
-
z->c++; /* gopast, line 34 */
|
145
|
+
if (out_grouping(z, g_v, 97, 248, 1) < 0) return 0; /* goto */ /* grouping v, line 34 */
|
146
|
+
{ /* gopast */ /* non v, line 34 */
|
147
|
+
int ret = in_grouping(z, g_v, 97, 248, 1);
|
148
|
+
if (ret < 0) return 0;
|
149
|
+
z->c += ret;
|
147
150
|
}
|
148
151
|
z->I[0] = z->c; /* setmark p1, line 34 */
|
149
152
|
/* try, line 35 */
|
150
|
-
if (!(z->I[0] < z->I[1])) goto
|
153
|
+
if (!(z->I[0] < z->I[1])) goto lab0;
|
151
154
|
z->I[0] = z->I[1];
|
152
|
-
|
155
|
+
lab0:
|
153
156
|
return 1;
|
154
157
|
}
|
155
158
|
|
156
159
|
static int r_main_suffix(struct SN_env * z) {
|
157
160
|
int among_var;
|
158
|
-
{ int
|
159
|
-
int
|
161
|
+
{ int mlimit; /* setlimit, line 41 */
|
162
|
+
int m1 = z->l - z->c; (void)m1;
|
160
163
|
if (z->c < z->I[0]) return 0;
|
161
164
|
z->c = z->I[0]; /* tomark, line 41 */
|
162
|
-
|
163
|
-
z->c = z->l -
|
165
|
+
mlimit = z->lb; z->lb = z->c;
|
166
|
+
z->c = z->l - m1;
|
164
167
|
z->ket = z->c; /* [, line 41 */
|
168
|
+
if (z->c <= z->lb || z->p[z->c - 1] >> 5 != 3 || !((1851440 >> (z->p[z->c - 1] & 0x1f)) & 1)) { z->lb = mlimit; return 0; }
|
165
169
|
among_var = find_among_b(z, a_0, 32); /* substring, line 41 */
|
166
|
-
if (!(among_var)) { z->lb =
|
170
|
+
if (!(among_var)) { z->lb = mlimit; return 0; }
|
167
171
|
z->bra = z->c; /* ], line 41 */
|
168
|
-
z->lb =
|
172
|
+
z->lb = mlimit;
|
169
173
|
}
|
170
174
|
switch(among_var) {
|
171
175
|
case 0: return 0;
|
172
176
|
case 1:
|
173
|
-
{ int ret;
|
174
|
-
ret = slice_del(z); /* delete, line 48 */
|
177
|
+
{ int ret = slice_del(z); /* delete, line 48 */
|
175
178
|
if (ret < 0) return ret;
|
176
179
|
}
|
177
180
|
break;
|
178
181
|
case 2:
|
179
|
-
if (
|
180
|
-
{ int ret;
|
181
|
-
ret = slice_del(z); /* delete, line 50 */
|
182
|
+
if (in_grouping_b(z, g_s_ending, 97, 229, 0)) return 0;
|
183
|
+
{ int ret = slice_del(z); /* delete, line 50 */
|
182
184
|
if (ret < 0) return ret;
|
183
185
|
}
|
184
186
|
break;
|
@@ -188,24 +190,24 @@ static int r_main_suffix(struct SN_env * z) {
|
|
188
190
|
|
189
191
|
static int r_consonant_pair(struct SN_env * z) {
|
190
192
|
{ int m_test = z->l - z->c; /* test, line 55 */
|
191
|
-
{ int
|
192
|
-
int
|
193
|
+
{ int mlimit; /* setlimit, line 56 */
|
194
|
+
int m1 = z->l - z->c; (void)m1;
|
193
195
|
if (z->c < z->I[0]) return 0;
|
194
196
|
z->c = z->I[0]; /* tomark, line 56 */
|
195
|
-
|
196
|
-
z->c = z->l -
|
197
|
+
mlimit = z->lb; z->lb = z->c;
|
198
|
+
z->c = z->l - m1;
|
197
199
|
z->ket = z->c; /* [, line 56 */
|
198
|
-
if (
|
200
|
+
if (z->c - 1 <= z->lb || (z->p[z->c - 1] != 100 && z->p[z->c - 1] != 116)) { z->lb = mlimit; return 0; }
|
201
|
+
if (!(find_among_b(z, a_1, 4))) { z->lb = mlimit; return 0; } /* substring, line 56 */
|
199
202
|
z->bra = z->c; /* ], line 56 */
|
200
|
-
z->lb =
|
203
|
+
z->lb = mlimit;
|
201
204
|
}
|
202
205
|
z->c = z->l - m_test;
|
203
206
|
}
|
204
207
|
if (z->c <= z->lb) return 0;
|
205
208
|
z->c--; /* next, line 62 */
|
206
209
|
z->bra = z->c; /* ], line 62 */
|
207
|
-
{ int ret;
|
208
|
-
ret = slice_del(z); /* delete, line 62 */
|
210
|
+
{ int ret = slice_del(z); /* delete, line 62 */
|
209
211
|
if (ret < 0) return ret;
|
210
212
|
}
|
211
213
|
return 1;
|
@@ -213,49 +215,47 @@ static int r_consonant_pair(struct SN_env * z) {
|
|
213
215
|
|
214
216
|
static int r_other_suffix(struct SN_env * z) {
|
215
217
|
int among_var;
|
216
|
-
{ int
|
218
|
+
{ int m1 = z->l - z->c; (void)m1; /* do, line 66 */
|
217
219
|
z->ket = z->c; /* [, line 66 */
|
218
220
|
if (!(eq_s_b(z, 2, s_0))) goto lab0;
|
219
221
|
z->bra = z->c; /* ], line 66 */
|
220
222
|
if (!(eq_s_b(z, 2, s_1))) goto lab0;
|
221
|
-
{ int ret;
|
222
|
-
ret = slice_del(z); /* delete, line 66 */
|
223
|
+
{ int ret = slice_del(z); /* delete, line 66 */
|
223
224
|
if (ret < 0) return ret;
|
224
225
|
}
|
225
226
|
lab0:
|
226
|
-
z->c = z->l -
|
227
|
+
z->c = z->l - m1;
|
227
228
|
}
|
228
|
-
{ int
|
229
|
-
int
|
229
|
+
{ int mlimit; /* setlimit, line 67 */
|
230
|
+
int m2 = z->l - z->c; (void)m2;
|
230
231
|
if (z->c < z->I[0]) return 0;
|
231
232
|
z->c = z->I[0]; /* tomark, line 67 */
|
232
|
-
|
233
|
-
z->c = z->l -
|
233
|
+
mlimit = z->lb; z->lb = z->c;
|
234
|
+
z->c = z->l - m2;
|
234
235
|
z->ket = z->c; /* [, line 67 */
|
236
|
+
if (z->c - 1 <= z->lb || z->p[z->c - 1] >> 5 != 3 || !((1572992 >> (z->p[z->c - 1] & 0x1f)) & 1)) { z->lb = mlimit; return 0; }
|
235
237
|
among_var = find_among_b(z, a_2, 5); /* substring, line 67 */
|
236
|
-
if (!(among_var)) { z->lb =
|
238
|
+
if (!(among_var)) { z->lb = mlimit; return 0; }
|
237
239
|
z->bra = z->c; /* ], line 67 */
|
238
|
-
z->lb =
|
240
|
+
z->lb = mlimit;
|
239
241
|
}
|
240
242
|
switch(among_var) {
|
241
243
|
case 0: return 0;
|
242
244
|
case 1:
|
243
|
-
{ int ret;
|
244
|
-
ret = slice_del(z); /* delete, line 70 */
|
245
|
+
{ int ret = slice_del(z); /* delete, line 70 */
|
245
246
|
if (ret < 0) return ret;
|
246
247
|
}
|
247
|
-
{ int
|
248
|
+
{ int m3 = z->l - z->c; (void)m3; /* do, line 70 */
|
248
249
|
{ int ret = r_consonant_pair(z);
|
249
250
|
if (ret == 0) goto lab1; /* call consonant_pair, line 70 */
|
250
251
|
if (ret < 0) return ret;
|
251
252
|
}
|
252
253
|
lab1:
|
253
|
-
z->c = z->l -
|
254
|
+
z->c = z->l - m3;
|
254
255
|
}
|
255
256
|
break;
|
256
257
|
case 2:
|
257
|
-
{ int ret;
|
258
|
-
ret = slice_from_s(z, 3, s_2); /* <-, line 72 */
|
258
|
+
{ int ret = slice_from_s(z, 3, s_2); /* <-, line 72 */
|
259
259
|
if (ret < 0) return ret;
|
260
260
|
}
|
261
261
|
break;
|
@@ -264,69 +264,68 @@ static int r_other_suffix(struct SN_env * z) {
|
|
264
264
|
}
|
265
265
|
|
266
266
|
static int r_undouble(struct SN_env * z) {
|
267
|
-
{ int
|
268
|
-
int
|
267
|
+
{ int mlimit; /* setlimit, line 76 */
|
268
|
+
int m1 = z->l - z->c; (void)m1;
|
269
269
|
if (z->c < z->I[0]) return 0;
|
270
270
|
z->c = z->I[0]; /* tomark, line 76 */
|
271
|
-
|
272
|
-
z->c = z->l -
|
271
|
+
mlimit = z->lb; z->lb = z->c;
|
272
|
+
z->c = z->l - m1;
|
273
273
|
z->ket = z->c; /* [, line 76 */
|
274
|
-
if (
|
274
|
+
if (out_grouping_b(z, g_v, 97, 248, 0)) { z->lb = mlimit; return 0; }
|
275
275
|
z->bra = z->c; /* ], line 76 */
|
276
276
|
z->S[0] = slice_to(z, z->S[0]); /* -> ch, line 76 */
|
277
277
|
if (z->S[0] == 0) return -1; /* -> ch, line 76 */
|
278
|
-
z->lb =
|
278
|
+
z->lb = mlimit;
|
279
279
|
}
|
280
280
|
if (!(eq_v_b(z, z->S[0]))) return 0; /* name ch, line 77 */
|
281
|
-
{ int ret;
|
282
|
-
ret = slice_del(z); /* delete, line 78 */
|
281
|
+
{ int ret = slice_del(z); /* delete, line 78 */
|
283
282
|
if (ret < 0) return ret;
|
284
283
|
}
|
285
284
|
return 1;
|
286
285
|
}
|
287
286
|
|
288
287
|
extern int danish_ISO_8859_1_stem(struct SN_env * z) {
|
289
|
-
{ int
|
288
|
+
{ int c1 = z->c; /* do, line 84 */
|
290
289
|
{ int ret = r_mark_regions(z);
|
291
290
|
if (ret == 0) goto lab0; /* call mark_regions, line 84 */
|
292
291
|
if (ret < 0) return ret;
|
293
292
|
}
|
294
293
|
lab0:
|
295
|
-
z->c =
|
294
|
+
z->c = c1;
|
296
295
|
}
|
297
296
|
z->lb = z->c; z->c = z->l; /* backwards, line 85 */
|
298
297
|
|
299
|
-
{ int
|
298
|
+
{ int m2 = z->l - z->c; (void)m2; /* do, line 86 */
|
300
299
|
{ int ret = r_main_suffix(z);
|
301
300
|
if (ret == 0) goto lab1; /* call main_suffix, line 86 */
|
302
301
|
if (ret < 0) return ret;
|
303
302
|
}
|
304
303
|
lab1:
|
305
|
-
z->c = z->l -
|
304
|
+
z->c = z->l - m2;
|
306
305
|
}
|
307
|
-
{ int
|
306
|
+
{ int m3 = z->l - z->c; (void)m3; /* do, line 87 */
|
308
307
|
{ int ret = r_consonant_pair(z);
|
309
308
|
if (ret == 0) goto lab2; /* call consonant_pair, line 87 */
|
310
309
|
if (ret < 0) return ret;
|
311
310
|
}
|
312
311
|
lab2:
|
313
|
-
z->c = z->l -
|
312
|
+
z->c = z->l - m3;
|
314
313
|
}
|
315
|
-
{ int
|
314
|
+
{ int m4 = z->l - z->c; (void)m4; /* do, line 88 */
|
316
315
|
{ int ret = r_other_suffix(z);
|
317
316
|
if (ret == 0) goto lab3; /* call other_suffix, line 88 */
|
318
317
|
if (ret < 0) return ret;
|
319
318
|
}
|
320
319
|
lab3:
|
321
|
-
z->c = z->l -
|
320
|
+
z->c = z->l - m4;
|
322
321
|
}
|
323
|
-
{ int
|
322
|
+
{ int m5 = z->l - z->c; (void)m5; /* do, line 89 */
|
324
323
|
{ int ret = r_undouble(z);
|
325
324
|
if (ret == 0) goto lab4; /* call undouble, line 89 */
|
326
325
|
if (ret < 0) return ret;
|
327
326
|
}
|
328
327
|
lab4:
|
329
|
-
z->c = z->l -
|
328
|
+
z->c = z->l - m5;
|
330
329
|
}
|
331
330
|
z->c = z->lb;
|
332
331
|
return 1;
|
@@ -334,5 +333,5 @@ extern int danish_ISO_8859_1_stem(struct SN_env * z) {
|
|
334
333
|
|
335
334
|
extern struct SN_env * danish_ISO_8859_1_create_env(void) { return SN_create_env(1, 2, 0); }
|
336
335
|
|
337
|
-
extern void danish_ISO_8859_1_close_env(struct SN_env * z) { SN_close_env(z); }
|
336
|
+
extern void danish_ISO_8859_1_close_env(struct SN_env * z) { SN_close_env(z, 1); }
|
338
337
|
|