mittens 0.3.0 → 0.3.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (174) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +8 -0
  3. data/Gemfile +2 -1
  4. data/README.md +2 -2
  5. data/Rakefile +12 -5
  6. data/ext/mittens/extconf.rb +3 -1
  7. data/lib/mittens/version.rb +1 -1
  8. data/vendor/snowball/.github/workflows/ci.yml +144 -17
  9. data/vendor/snowball/.github/workflows/coverage.yml +117 -0
  10. data/vendor/snowball/.github/workflows/runtime-tests.yml +26 -0
  11. data/vendor/snowball/.gitignore +33 -7
  12. data/vendor/snowball/CONTRIBUTING.rst +7 -0
  13. data/vendor/snowball/COPYING +1 -1
  14. data/vendor/snowball/GNUmakefile +736 -298
  15. data/vendor/snowball/NEWS +1394 -7
  16. data/vendor/snowball/README.rst +8 -8
  17. data/vendor/snowball/ada/generate/generate.adb +5 -5
  18. data/vendor/snowball/ada/src/stemmer.adb +177 -188
  19. data/vendor/snowball/ada/src/stemmer.ads +86 -89
  20. data/vendor/snowball/ada/src/stemwords.adb +21 -5
  21. data/vendor/snowball/algorithms/czech.sbl +255 -0
  22. data/vendor/snowball/algorithms/danish.sbl +22 -10
  23. data/vendor/snowball/algorithms/english.sbl +7 -4
  24. data/vendor/snowball/algorithms/esperanto.sbl +6 -7
  25. data/vendor/snowball/algorithms/estonian.sbl +9 -4
  26. data/vendor/snowball/algorithms/finnish.sbl +33 -21
  27. data/vendor/snowball/algorithms/german.sbl +5 -0
  28. data/vendor/snowball/algorithms/indonesian.sbl +115 -96
  29. data/vendor/snowball/algorithms/italian.sbl +26 -1
  30. data/vendor/snowball/algorithms/lithuanian.sbl +13 -13
  31. data/vendor/snowball/algorithms/norwegian.sbl +17 -6
  32. data/vendor/snowball/algorithms/persian.sbl +387 -0
  33. data/vendor/snowball/algorithms/polish.sbl +177 -0
  34. data/vendor/snowball/algorithms/sesotho.sbl +115 -0
  35. data/vendor/snowball/algorithms/turkish.sbl +4 -4
  36. data/vendor/snowball/compiler/analyser.c +2002 -711
  37. data/vendor/snowball/compiler/driver.c +460 -298
  38. data/vendor/snowball/compiler/generator.c +439 -1965
  39. data/vendor/snowball/compiler/generator_ada.c +605 -430
  40. data/vendor/snowball/compiler/generator_c.c +2227 -0
  41. data/vendor/snowball/compiler/generator_csharp.c +365 -274
  42. data/vendor/snowball/compiler/generator_dart.c +1476 -0
  43. data/vendor/snowball/compiler/generator_go.c +348 -270
  44. data/vendor/snowball/compiler/generator_java.c +330 -233
  45. data/vendor/snowball/compiler/generator_js.c +534 -385
  46. data/vendor/snowball/compiler/generator_pascal.c +361 -320
  47. data/vendor/snowball/compiler/generator_php.c +1445 -0
  48. data/vendor/snowball/compiler/generator_python.c +399 -299
  49. data/vendor/snowball/compiler/generator_rust.c +370 -261
  50. data/vendor/snowball/compiler/generator_zig.c +1474 -0
  51. data/vendor/snowball/compiler/header.h +153 -86
  52. data/vendor/snowball/compiler/space.c +121 -63
  53. data/vendor/snowball/compiler/tokeniser.c +286 -182
  54. data/vendor/snowball/compiler/tokens.h +71 -0
  55. data/vendor/snowball/csharp/Snowball/Among.cs +14 -26
  56. data/vendor/snowball/csharp/Snowball/AssemblyInfo.cs +3 -3
  57. data/vendor/snowball/csharp/Snowball/Stemmer.cs +41 -45
  58. data/vendor/snowball/csharp/Stemwords/Program.cs +20 -14
  59. data/vendor/snowball/cxx/.gitignore +4 -0
  60. data/vendor/snowball/cxx/generate_algorithms.pl +87 -0
  61. data/vendor/snowball/cxx/stemmer.h +12 -0
  62. data/vendor/snowball/cxx/stemwords.cxx +176 -0
  63. data/vendor/snowball/cxx/utilities.cxx +2 -0
  64. data/vendor/snowball/dart/.gitignore +4 -0
  65. data/vendor/snowball/dart/analysis_options.yaml +1 -0
  66. data/vendor/snowball/dart/example/test_app.dart +65 -0
  67. data/vendor/snowball/dart/generate_algorithms.pl +21 -0
  68. data/vendor/snowball/dart/lib/snowball.dart +18 -0
  69. data/vendor/snowball/dart/lib/src/snowball.dart +339 -0
  70. data/vendor/snowball/dart/pubspec.yaml +17 -0
  71. data/vendor/snowball/doc/libstemmer_dart_README +37 -0
  72. data/vendor/snowball/doc/libstemmer_js_README +2 -2
  73. data/vendor/snowball/doc/libstemmer_php_README +38 -0
  74. data/vendor/snowball/doc/libstemmer_python_README +3 -3
  75. data/vendor/snowball/examples/stemwords.c +18 -3
  76. data/vendor/snowball/go/README.md +12 -4
  77. data/vendor/snowball/go/env.go +12 -14
  78. data/vendor/snowball/go/stemwords/main.go +2 -1
  79. data/vendor/snowball/java/org/tartarus/snowball/CharArraySequence.java +36 -0
  80. data/vendor/snowball/java/org/tartarus/snowball/SnowballProgram.java +17 -34
  81. data/vendor/snowball/java/org/tartarus/snowball/SnowballStemmer.java +0 -2
  82. data/vendor/snowball/javascript/base-stemmer.js +219 -252
  83. data/vendor/snowball/javascript/stemwords.js +86 -58
  84. data/vendor/snowball/libstemmer/mkmodules.pl +1 -1
  85. data/vendor/snowball/libstemmer/modules.txt +4 -0
  86. data/vendor/snowball/pascal/SnowballProgram.pas +18 -31
  87. data/vendor/snowball/php/base-stemmer.php +453 -0
  88. data/vendor/snowball/php/stemwords.php +25 -0
  89. data/vendor/snowball/python/create_init.py +16 -21
  90. data/vendor/snowball/python/pyproject.toml +3 -0
  91. data/vendor/snowball/python/setup.py +5 -7
  92. data/vendor/snowball/python/snowballstemmer/among.py +1 -2
  93. data/vendor/snowball/python/snowballstemmer/basestemmer.py +24 -33
  94. data/vendor/snowball/python/stemwords.py +72 -63
  95. data/vendor/snowball/runtime/api.c +11 -42
  96. data/vendor/snowball/runtime/api.h +11 -9
  97. data/vendor/snowball/runtime/snowball_runtime.h +110 -0
  98. data/vendor/snowball/runtime/utilities.c +282 -106
  99. data/vendor/snowball/rust/src/main.rs +2 -2
  100. data/vendor/snowball/rust/src/snowball/snowball_env.rs +7 -9
  101. data/vendor/snowball/tests/compilertest +62 -0
  102. data/vendor/snowball/tests/errors/ae-errors.sbl +53 -0
  103. data/vendor/snowball/tests/errors/ae-errors.stderr +8 -0
  104. data/vendor/snowball/tests/errors/bad-dollar.sbl +14 -0
  105. data/vendor/snowball/tests/errors/bad-dollar.stderr +4 -0
  106. data/vendor/snowball/tests/errors/bad-grouping-definition.sbl +9 -0
  107. data/vendor/snowball/tests/errors/bad-grouping-definition.stderr +6 -0
  108. data/vendor/snowball/tests/errors/missing-bra.sbl +6 -0
  109. data/vendor/snowball/tests/errors/missing-bra.stderr +3 -0
  110. data/vendor/snowball/tests/errors/missing-command.sbl +9 -0
  111. data/vendor/snowball/tests/errors/missing-command.stderr +1 -0
  112. data/vendor/snowball/tests/errors/missing-ket-backwardmode.sbl +3 -0
  113. data/vendor/snowball/tests/errors/missing-ket-backwardmode.stderr +1 -0
  114. data/vendor/snowball/tests/errors/missing-ket.sbl +7 -0
  115. data/vendor/snowball/tests/errors/missing-ket.stderr +6 -0
  116. data/vendor/snowball/tests/errors/notdefined.sbl +4 -0
  117. data/vendor/snowball/tests/errors/notdefined.stderr +2 -0
  118. data/vendor/snowball/tests/errors/string-omitted.sbl +5 -0
  119. data/vendor/snowball/tests/errors/string-omitted.stderr +1 -0
  120. data/vendor/snowball/tests/errors/undeclared.sbl +20 -0
  121. data/vendor/snowball/tests/errors/undeclared.stderr +9 -0
  122. data/vendor/snowball/tests/errors/unexpected-token.sbl +24 -0
  123. data/vendor/snowball/tests/errors/unexpected-token.stderr +17 -0
  124. data/vendor/snowball/tests/errors/wrongdirection.sbl +14 -0
  125. data/vendor/snowball/tests/errors/wrongdirection.stderr +1 -0
  126. data/vendor/snowball/tests/runtime/among.sbl +19 -0
  127. data/vendor/snowball/tests/runtime/arithmeticexpr.sbl +86 -0
  128. data/vendor/snowball/tests/runtime/attachinsert.sbl +47 -0
  129. data/vendor/snowball/tests/runtime/booleans.sbl +19 -0
  130. data/vendor/snowball/tests/runtime/externals.sbl +22 -0
  131. data/vendor/snowball/tests/runtime/hop.sbl +12 -0
  132. data/vendor/snowball/tests/runtime/integertests.sbl +60 -0
  133. data/vendor/snowball/tests/runtime/intlimits.sbl +25 -0
  134. data/vendor/snowball/tests/runtime/naming.sbl +20 -0
  135. data/vendor/snowball/tests/runtime/not.sbl +30 -0
  136. data/vendor/snowball/tests/runtime/or.sbl +17 -0
  137. data/vendor/snowball/tests/runtime/repeat.sbl +16 -0
  138. data/vendor/snowball/tests/runtime/setlimit.sbl +24 -0
  139. data/vendor/snowball/tests/runtime/sizelen.sbl +56 -0
  140. data/vendor/snowball/tests/runtime/slice.sbl +27 -0
  141. data/vendor/snowball/tests/runtime/stringdollar.sbl +39 -0
  142. data/vendor/snowball/tests/runtime/strings.sbl +66 -0
  143. data/vendor/snowball/tests/runtime/test.sbl +19 -0
  144. data/vendor/snowball/tests/stemtest.c +41 -1
  145. data/vendor/snowball/tests/syntax/canon.sbl +32 -0
  146. data/vendor/snowball/tests/syntax/canon.stderr +0 -0
  147. data/vendor/snowball/tests/syntax/canon.syntax +57 -0
  148. data/vendor/snowball/tests/syntax/emptyprogram.sbl +2 -0
  149. data/vendor/snowball/tests/syntax/emptyprogram.syntax +0 -0
  150. data/vendor/snowball/tests/syntax/groupings.sbl +11 -0
  151. data/vendor/snowball/tests/syntax/inline.sbl +144 -0
  152. data/vendor/snowball/tests/syntax/inline.stderr +0 -0
  153. data/vendor/snowball/tests/syntax/inline.syntax +121 -0
  154. data/vendor/snowball/tests/syntax/legacy.sbl +17 -0
  155. data/vendor/snowball/tests/syntax/legacy.stderr +5 -0
  156. data/vendor/snowball/tests/syntax/legacy.syntax +19 -0
  157. data/vendor/snowball/tests/syntax/loops.sbl +14 -0
  158. data/vendor/snowball/tests/syntax/loops.stderr +9 -0
  159. data/vendor/snowball/tests/syntax/loops.syntax +29 -0
  160. data/vendor/snowball/tests/syntax/noops.sbl +76 -0
  161. data/vendor/snowball/tests/syntax/noops.stderr +27 -0
  162. data/vendor/snowball/tests/syntax/noops.syntax +135 -0
  163. data/vendor/snowball/tests/syntax/simplifyae.sbl +21 -0
  164. data/vendor/snowball/tests/syntax/simplifyae.stderr +0 -0
  165. data/vendor/snowball/tests/syntax/simplifyae.syntax +39 -0
  166. data/vendor/snowball/tests/syntax/unused.sbl +18 -0
  167. data/vendor/snowball/tests/syntax/unused.stderr +7 -0
  168. data/vendor/snowball/tests/syntax/unused.syntax +3 -0
  169. data/vendor/snowball/zig/env.zig +599 -0
  170. data/vendor/snowball/zig/generate_algorithms.pl +19 -0
  171. data/vendor/snowball/zig/stemwords.zig +123 -0
  172. metadata +102 -4
  173. data/vendor/snowball/compiler/syswords.h +0 -86
  174. data/vendor/snowball/runtime/header.h +0 -62
@@ -1,103 +1,131 @@
1
- const fs = require('fs');
2
- const readline = require('readline');
1
+ import fs from 'node:fs';
2
+ import process from 'node:process';
3
+ import readline from 'node:readline';
3
4
 
4
5
  function usage() {
5
- console.log("usage: stemwords.js [-l <language>] -i <input file> -o <output file> [-c <character encoding>] [-h]\n");
6
- console.log("The input file consists of a list of words to be stemmed, one per");
7
- console.log("line. Words should be in lower case.\n");
8
- console.log("If -c is given, the argument is the character encoding of the input");
9
- console.log("and output files. If it is omitted, the UTF-8 encoding is used.\n");
10
- console.log("The output file consists of the stemmed words, one per line.\n");
11
- console.log("-h displays this help");
12
- }
6
+ console.log(`usage: stemwords.js [-l <language>] [-i <input file>] [-o <output file>] [-c <character encoding>] [-h]
13
7
 
14
- if (process.argv.length < 5)
15
- {
16
- usage();
8
+ The input file consists of a list of words to be stemmed, one per line.
9
+ Words should be in lower case.
10
+
11
+ Language defaults to "English", input to stdin, and output to stdout.
12
+
13
+ If -c is given, the argument is the character encoding of the input and
14
+ output files. If it is omitted, the UTF-8 encoding is used.
15
+
16
+ The output file consists of the stemmed words, one per line.
17
+
18
+ -h displays this help`);
17
19
  }
18
- else
20
+
19
21
  {
20
- var input = '';
21
- var output = '';
22
- var encoding = 'utf8';
23
- var language = 'English';
24
- var show_help = false;
25
- while (process.argv.length > 0)
22
+ let input = '';
23
+ let output = '';
24
+ let encoding = 'utf8';
25
+ let language = 'English';
26
+ let usage_error = false;
27
+ // Skip the first two entries of argv which are the interpreter
28
+ // and the script name.
29
+ //
30
+ // deno doesn't allow modifying process.argv so we need to make
31
+ // a copy here.
32
+ const argv = process.argv.slice(2);
33
+ while (argv.length > 0)
26
34
  {
27
- var arg = process.argv.shift();
35
+ const arg = argv.shift();
28
36
  switch (arg)
29
37
  {
30
38
  case "-h":
31
- show_help = true;
32
- process.argv.length = 0;
39
+ usage();
40
+ process.exit(0);
33
41
  break;
34
42
  case "-l":
35
- if (process.argv.length == 0)
43
+ if (argv.length === 0)
36
44
  {
37
- show_help = true;
45
+ usage_error = true;
38
46
  break;
39
47
  }
40
- language = process.argv.shift();
48
+ language = argv.shift();
41
49
  break;
42
50
  case "-i":
43
- if (process.argv.length == 0)
51
+ if (argv.length === 0)
44
52
  {
45
- show_help = true;
53
+ usage_error = true;
46
54
  break;
47
55
  }
48
- input = process.argv.shift();
56
+ input = argv.shift();
49
57
  break;
50
58
  case "-o":
51
- if (process.argv.length == 0)
59
+ if (argv.length === 0)
52
60
  {
53
- show_help = true;
61
+ usage_error = true;
54
62
  break;
55
63
  }
56
- output = process.argv.shift();
64
+ output = argv.shift();
57
65
  break;
58
66
  case "-c":
59
- if (process.argv.length == 0)
67
+ if (argv.length === 0)
60
68
  {
61
- show_help = true;
69
+ usage_error = true;
62
70
  break;
63
71
  }
64
- encoding = process.argv.shift();
72
+ encoding = argv.shift();
65
73
  break;
74
+ default:
75
+ console.log('Unknown command line option: ' + arg + '\n');
76
+ usage_error = true;
77
+ }
78
+
79
+ if (usage_error)
80
+ {
81
+ usage();
82
+ process.exit(1);
66
83
  }
67
84
  }
68
- if (show_help || input == '' || output == '')
69
- {
70
- usage();
85
+
86
+ const stemmer = await create(language);
87
+ let istream, ostream;
88
+ if (input !== '') {
89
+ istream = fs.createReadStream(input, encoding);
90
+ } else {
91
+ istream = process.stdin;
92
+ if (istream.setEncoding) istream.setEncoding(encoding);
71
93
  }
72
- else
73
- {
74
- stemming(language, input, output, encoding);
94
+ if (output !== '') {
95
+ ostream = fs.createWriteStream(output, encoding);
96
+ } else {
97
+ ostream = process.stdout;
98
+ if (ostream.setEncoding) ostream.setEncoding(encoding);
75
99
  }
100
+
101
+ stemming(stemmer, istream, ostream);
76
102
  }
77
103
 
78
- // function stemming (lang : string, input : string, output : string, encoding : string) {
79
- function stemming (lang, input, output, encoding) {
104
+ // function stemming (stemmer : Stemmer, input : Stream, output : Stream) {
105
+ function stemming (stemmer, input, output) {
80
106
  const lines = readline.createInterface({
81
- input: fs.createReadStream(input, encoding),
107
+ input: input,
82
108
  terminal: false
83
109
  });
84
- var out = fs.createWriteStream(output, encoding);
85
- var stemmer = create(lang);
86
110
  lines.on('line', (original) => {
87
- out.write(stemmer.stemWord(original) + '\n');
111
+ output.write(stemmer.stemWord(original) + '\n');
88
112
  });
89
113
  }
90
114
 
91
- function create (name) {
92
- var lc_name = name.toLowerCase();
93
- if (!lc_name.match('\\W') && lc_name != 'base') {
94
- try {
95
- const Stemmer = require(lc_name + '-stemmer.js');
96
- return new Stemmer();
97
- } catch (error) {
98
- }
115
+ async function create (name) {
116
+ const lc_name = name.toLowerCase();
117
+ if (/\W/.test(lc_name) || lc_name === 'base') {
118
+ console.log('Unknown stemming language: ' + name + '\n');
119
+ usage();
120
+ process.exit(1);
121
+ return;
122
+ }
123
+ const filename = `../js_out/${lc_name}-stemmer.js`;
124
+ try {
125
+ // Load stemmer class from the module scope
126
+ const stemmerModule = await import(filename);
127
+ return new stemmerModule.default();
128
+ } catch (error) {
129
+ console.error(error);
99
130
  }
100
- console.log('Unknown stemming language: ' + name + '\n');
101
- usage();
102
- process.exit(1);
103
131
  }
@@ -252,7 +252,7 @@ EOS
252
252
  for $srcfile ('include/libstemmer.h',
253
253
  "libstemmer/modules${extn}.h",
254
254
  'runtime/api.h',
255
- 'runtime/header.h') {
255
+ 'runtime/snowball_runtime.h') {
256
256
  print OUT " \\\n" if $need_sep;
257
257
  print OUT " $srcfile";
258
258
  $need_sep = 1;
@@ -13,6 +13,7 @@ arabic UTF_8 arabic,ar,ara
13
13
  armenian UTF_8 armenian,hy,hye,arm
14
14
  basque UTF_8,ISO_8859_1 basque,eu,eus,baq
15
15
  catalan UTF_8,ISO_8859_1 catalan,ca,cat
16
+ czech UTF_8,ISO_8859_2 czech,cs,ces,cze
16
17
  danish UTF_8,ISO_8859_1 danish,da,dan
17
18
  dutch UTF_8,ISO_8859_1 dutch,nl,dut,nld,kraaij_pohlmann
18
19
  english UTF_8,ISO_8859_1 english,en,eng
@@ -30,6 +31,8 @@ italian UTF_8,ISO_8859_1 italian,it,ita
30
31
  lithuanian UTF_8 lithuanian,lt,lit
31
32
  nepali UTF_8 nepali,ne,nep
32
33
  norwegian UTF_8,ISO_8859_1 norwegian,no,nor
34
+ polish UTF_8,ISO_8859_2 polish,pl,pol
35
+ persian UTF_8 persian,fa,fas,pers
33
36
  portuguese UTF_8,ISO_8859_1 portuguese,pt,por
34
37
  romanian UTF_8 romanian,ro,rum,ron
35
38
  russian UTF_8,KOI8_R russian,ru,rus
@@ -39,6 +42,7 @@ swedish UTF_8,ISO_8859_1 swedish,sv,swe
39
42
  tamil UTF_8 tamil,ta,tam
40
43
  turkish UTF_8 turkish,tr,tur
41
44
  yiddish UTF_8 yiddish,yi,yid
45
+ sesotho UTF_8 sesotho,st,sot
42
46
 
43
47
  # Also include the traditional porter algorithm for english.
44
48
  # The porter algorithm is included in the libstemmer distribution to assist
@@ -36,11 +36,8 @@ Type
36
36
  Function OutGroupingBk(s : array of char; min, max : Integer) : Boolean;
37
37
  Function GoOutGroupingBk(s : array of char; min, max : Integer) : Boolean;
38
38
 
39
- Function EqS(s_size : Integer; s : AnsiString) : Boolean;
40
- Function EqSBk(s_size : Integer; s : AnsiString) : Boolean;
41
-
42
- Function EqV(s : AnsiString) : Boolean;
43
- Function EqVBk(s : AnsiString) : Boolean;
39
+ Function EqS(s : AnsiString) : Boolean;
40
+ Function EqSBk(s : AnsiString) : Boolean;
44
41
 
45
42
  Function FindAmong(v : array of TAmong; v_size : Integer) : Integer;
46
43
  Function FindAmongBk(v : array of TAmong; v_size : Integer) : Integer;
@@ -233,10 +230,11 @@ Begin
233
230
  Result := False;
234
231
  End;
235
232
 
236
- Function TSnowballProgram.EqS(s_size : Integer; s : AnsiString) : Boolean;
237
- Var I : Integer;
233
+ Function TSnowballProgram.EqS(s : AnsiString) : Boolean;
234
+ Var I, s_size : Integer;
238
235
  Begin
239
236
  Result := False;
237
+ s_size := Length(s);
240
238
 
241
239
  If (FLimit - FCursor) < s_size Then Exit;
242
240
 
@@ -248,10 +246,11 @@ Begin
248
246
  Result := True;
249
247
  End;
250
248
 
251
- Function TSnowballProgram.EqSBk(s_size : Integer; s : AnsiString) : Boolean;
252
- Var I : Integer;
249
+ Function TSnowballProgram.EqSBk(s : AnsiString) : Boolean;
250
+ Var I, s_size : Integer;
253
251
  Begin
254
252
  Result := False;
253
+ s_size := Length(s);
255
254
 
256
255
  if (FCursor - FBkLimit) < s_size Then Exit;
257
256
 
@@ -263,19 +262,9 @@ Begin
263
262
  Result := True;
264
263
  End;
265
264
 
266
- Function TSnowballProgram.EqV(s : AnsiString) : Boolean;
267
- Begin
268
- Result := EqS(Length(s), s);
269
- End;
270
-
271
- Function TSnowballProgram.EqVBk(s : AnsiString) : Boolean;
272
- Begin
273
- Result := EqSBk(Length(s), s);
274
- End;
275
-
276
265
  Function TSnowballProgram.FindAmong(v : array of TAmong; v_size : Integer) : Integer;
277
266
  Var i, i2, j, c, l, common_i, common_j, k, diff, common : Integer;
278
- first_key_inspected, res : Boolean;
267
+ first_key_inspected : Boolean;
279
268
  w : TAmong;
280
269
  Begin
281
270
  i := 0;
@@ -347,10 +336,9 @@ Begin
347
336
  Exit;
348
337
  End;
349
338
 
350
- res := w.Method;
351
-
352
- FCursor := c + Length(w.Str);
353
- if (res) Then Begin
339
+ if w.Method Then
340
+ Begin
341
+ FCursor := c + Length(w.Str);
354
342
  Result := w.Result;
355
343
  Exit;
356
344
  End;
@@ -367,7 +355,7 @@ End;
367
355
 
368
356
  Function TSnowballProgram.FindAmongBk(v : array of TAmong; v_size : Integer) : Integer;
369
357
  Var i, j, c, lb, common_i, common_j, k, diff, common, i2 : Integer;
370
- first_key_inspected, res : Boolean;
358
+ first_key_inspected : Boolean;
371
359
  w : TAmong;
372
360
  Begin
373
361
  i := 0;
@@ -433,11 +421,9 @@ Begin
433
421
  Exit;
434
422
  End;
435
423
 
436
- res := w.Method;
437
-
438
- FCursor := c - Length(w.Str);
439
- If Res Then
424
+ if w.Method Then
440
425
  Begin
426
+ FCursor := c - Length(w.Str);
441
427
  Result := w.Result;
442
428
  Exit;
443
429
  End;
@@ -446,8 +432,8 @@ Begin
446
432
  i := w.Index;
447
433
  If i < 0 Then
448
434
  Begin
449
- Result := 0;
450
- Exit;
435
+ Result := 0;
436
+ Exit;
451
437
  End;
452
438
  End;
453
439
  End;
@@ -502,6 +488,7 @@ Procedure TSnowballProgram.SliceFrom(s : AnsiString);
502
488
  Begin
503
489
  SliceCheck();
504
490
  ReplaceS(FBra, FKet, s);
491
+ FKet := FBra + Length(s);
505
492
  End;
506
493
 
507
494
  Function TSnowballProgram.AssignTo() : AnsiString;