@delali/narsil 0.1.14 → 0.2.0

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 (251) hide show
  1. package/NOTICE +54 -0
  2. package/README.md +38 -972
  3. package/dist/adapters/filesystem.mjs +1 -1
  4. package/dist/adapters/indexeddb.mjs +1 -1
  5. package/dist/{chunk-WISGW24C.mjs → chunk-AUMKFYTG.mjs} +1 -1
  6. package/dist/{chunk-HRABJLPB.mjs → chunk-BKAI2WXI.mjs} +1 -0
  7. package/dist/chunk-GHJWC2E5.mjs +9 -0
  8. package/dist/chunk-KH3YGMVT.mjs +15 -0
  9. package/dist/{chunk-ALB35PRQ.mjs → chunk-M2EDG55Y.mjs} +8 -0
  10. package/dist/{chunk-HMO6OMZ3.mjs → chunk-S6IAXOBA.mjs} +1073 -506
  11. package/dist/chunk-TGP5M5R7.mjs +880 -0
  12. package/dist/chunk-U2BKYEC7.mjs +254 -0
  13. package/dist/{chunk-MEW7HD75.mjs → chunk-XAKNSWIK.mjs} +2543 -1154
  14. package/dist/{config-CojEPOgS.d.ts → config-P27AtSn4.d.ts} +28 -7
  15. package/dist/direct-executor-2FV3MEDD.mjs +5 -0
  16. package/dist/distribution/coordinator/etcd.d.ts +2 -2
  17. package/dist/distribution/coordinator/etcd.mjs +2 -2
  18. package/dist/distribution/coordinator/in-memory.d.ts +2 -2
  19. package/dist/distribution.d.ts +10 -4
  20. package/dist/distribution.mjs +1875 -1772
  21. package/dist/embeddings/openai.mjs +1 -1
  22. package/dist/index.browser.mjs +4566 -1783
  23. package/dist/index.d.ts +14 -5
  24. package/dist/index.mjs +6 -5
  25. package/dist/{language-ONQ3iVDf.d.ts → language-CmJBHf1j.d.ts} +4 -1
  26. package/dist/languages/albanian.d.ts +5 -0
  27. package/dist/languages/albanian.mjs +103 -0
  28. package/dist/languages/amharic.d.ts +5 -0
  29. package/dist/languages/amharic.mjs +240 -0
  30. package/dist/languages/arabic.d.ts +1 -1
  31. package/dist/languages/arabic.mjs +939 -154
  32. package/dist/languages/armenian.d.ts +1 -1
  33. package/dist/languages/armenian.mjs +275 -243
  34. package/dist/languages/azerbaijani.d.ts +5 -0
  35. package/dist/languages/azerbaijani.mjs +152 -0
  36. package/dist/languages/bambara.d.ts +5 -0
  37. package/dist/languages/bambara.mjs +60 -0
  38. package/dist/languages/basque.d.ts +5 -0
  39. package/dist/languages/basque.mjs +726 -0
  40. package/dist/languages/belarusian.d.ts +5 -0
  41. package/dist/languages/belarusian.mjs +100 -0
  42. package/dist/languages/bengali.d.ts +5 -0
  43. package/dist/languages/bengali.mjs +128 -0
  44. package/dist/languages/bosnian.d.ts +5 -0
  45. package/dist/languages/bosnian.mjs +197 -0
  46. package/dist/languages/breton.d.ts +5 -0
  47. package/dist/languages/breton.mjs +96 -0
  48. package/dist/languages/bulgarian.d.ts +1 -1
  49. package/dist/languages/bulgarian.mjs +11 -2
  50. package/dist/languages/burmese.d.ts +5 -0
  51. package/dist/languages/burmese.mjs +57 -0
  52. package/dist/languages/catalan.d.ts +5 -0
  53. package/dist/languages/catalan.mjs +987 -0
  54. package/dist/languages/chinese.d.ts +1 -1
  55. package/dist/languages/chinese.mjs +4 -3
  56. package/dist/languages/croatian.d.ts +5 -0
  57. package/dist/languages/croatian.mjs +191 -0
  58. package/dist/languages/czech.d.ts +5 -0
  59. package/dist/languages/czech.mjs +628 -0
  60. package/dist/languages/dagbani.d.ts +1 -1
  61. package/dist/languages/dagbani.mjs +11 -2
  62. package/dist/languages/danish.d.ts +1 -1
  63. package/dist/languages/danish.mjs +215 -110
  64. package/dist/languages/dutch.d.ts +1 -1
  65. package/dist/languages/dutch.mjs +1248 -163
  66. package/dist/languages/english.d.ts +1 -1
  67. package/dist/languages/english.mjs +2 -1
  68. package/dist/languages/esperanto.d.ts +5 -0
  69. package/dist/languages/esperanto.mjs +689 -0
  70. package/dist/languages/estonian.d.ts +5 -0
  71. package/dist/languages/estonian.mjs +2160 -0
  72. package/dist/languages/ewe.d.ts +1 -1
  73. package/dist/languages/ewe.mjs +11 -2
  74. package/dist/languages/faroese.d.ts +5 -0
  75. package/dist/languages/faroese.mjs +93 -0
  76. package/dist/languages/fijian.d.ts +5 -0
  77. package/dist/languages/fijian.mjs +55 -0
  78. package/dist/languages/finnish.d.ts +1 -1
  79. package/dist/languages/finnish.mjs +528 -263
  80. package/dist/languages/french.d.ts +1 -1
  81. package/dist/languages/french.mjs +950 -437
  82. package/dist/languages/ga.d.ts +1 -1
  83. package/dist/languages/ga.mjs +2 -1
  84. package/dist/languages/galician.d.ts +5 -0
  85. package/dist/languages/galician.mjs +172 -0
  86. package/dist/languages/georgian.d.ts +5 -0
  87. package/dist/languages/georgian.mjs +91 -0
  88. package/dist/languages/german.d.ts +1 -1
  89. package/dist/languages/german.mjs +432 -162
  90. package/dist/languages/greek.d.ts +1 -1
  91. package/dist/languages/greek.mjs +1970 -281
  92. package/dist/languages/guarani.d.ts +5 -0
  93. package/dist/languages/guarani.mjs +132 -0
  94. package/dist/languages/gujarati.d.ts +5 -0
  95. package/dist/languages/gujarati.mjs +234 -0
  96. package/dist/languages/haitian-creole.d.ts +5 -0
  97. package/dist/languages/haitian-creole.mjs +106 -0
  98. package/dist/languages/hausa.d.ts +1 -1
  99. package/dist/languages/hausa.mjs +2 -1
  100. package/dist/languages/hawaiian.d.ts +5 -0
  101. package/dist/languages/hawaiian.mjs +69 -0
  102. package/dist/languages/hebrew.d.ts +5 -0
  103. package/dist/languages/hebrew.mjs +213 -0
  104. package/dist/languages/hindi.d.ts +1 -1
  105. package/dist/languages/hindi.mjs +175 -97
  106. package/dist/languages/hungarian.d.ts +1 -1
  107. package/dist/languages/hungarian.mjs +412 -326
  108. package/dist/languages/icelandic.d.ts +5 -0
  109. package/dist/languages/icelandic.mjs +161 -0
  110. package/dist/languages/igbo.d.ts +1 -1
  111. package/dist/languages/igbo.mjs +2 -1
  112. package/dist/languages/indonesian.d.ts +1 -1
  113. package/dist/languages/indonesian.mjs +329 -137
  114. package/dist/languages/irish.d.ts +1 -1
  115. package/dist/languages/irish.mjs +223 -139
  116. package/dist/languages/italian.d.ts +1 -1
  117. package/dist/languages/italian.mjs +703 -406
  118. package/dist/languages/japanese.d.ts +1 -1
  119. package/dist/languages/japanese.mjs +5 -108
  120. package/dist/languages/kannada.d.ts +5 -0
  121. package/dist/languages/kannada.mjs +94 -0
  122. package/dist/languages/kazakh.d.ts +5 -0
  123. package/dist/languages/kazakh.mjs +90 -0
  124. package/dist/languages/khmer.d.ts +5 -0
  125. package/dist/languages/khmer.mjs +181 -0
  126. package/dist/languages/kinyarwanda.d.ts +5 -0
  127. package/dist/languages/kinyarwanda.mjs +99 -0
  128. package/dist/languages/kirundi.d.ts +5 -0
  129. package/dist/languages/kirundi.mjs +92 -0
  130. package/dist/languages/korean.d.ts +5 -0
  131. package/dist/languages/korean.mjs +252 -0
  132. package/dist/languages/kurmanji.d.ts +5 -0
  133. package/dist/languages/kurmanji.mjs +50 -0
  134. package/dist/languages/kyrgyz.d.ts +5 -0
  135. package/dist/languages/kyrgyz.mjs +108 -0
  136. package/dist/languages/lao.d.ts +5 -0
  137. package/dist/languages/lao.mjs +63 -0
  138. package/dist/languages/latin.d.ts +5 -0
  139. package/dist/languages/latin.mjs +69 -0
  140. package/dist/languages/latvian.d.ts +5 -0
  141. package/dist/languages/latvian.mjs +173 -0
  142. package/dist/languages/lingala.d.ts +5 -0
  143. package/dist/languages/lingala.mjs +61 -0
  144. package/dist/languages/lithuanian.d.ts +5 -0
  145. package/dist/languages/lithuanian.mjs +571 -0
  146. package/dist/languages/luxembourgish.d.ts +5 -0
  147. package/dist/languages/luxembourgish.mjs +214 -0
  148. package/dist/languages/macedonian.d.ts +5 -0
  149. package/dist/languages/macedonian.mjs +808 -0
  150. package/dist/languages/malagasy.d.ts +5 -0
  151. package/dist/languages/malagasy.mjs +67 -0
  152. package/dist/languages/malay.d.ts +5 -0
  153. package/dist/languages/malay.mjs +482 -0
  154. package/dist/languages/malayalam.d.ts +5 -0
  155. package/dist/languages/malayalam.mjs +122 -0
  156. package/dist/languages/maltese.d.ts +5 -0
  157. package/dist/languages/maltese.mjs +139 -0
  158. package/dist/languages/maori.d.ts +5 -0
  159. package/dist/languages/maori.mjs +79 -0
  160. package/dist/languages/marathi.d.ts +5 -0
  161. package/dist/languages/marathi.mjs +111 -0
  162. package/dist/languages/nepali.d.ts +1 -1
  163. package/dist/languages/nepali.mjs +209 -99
  164. package/dist/languages/norwegian.d.ts +1 -1
  165. package/dist/languages/norwegian.mjs +218 -85
  166. package/dist/languages/oromo.d.ts +5 -0
  167. package/dist/languages/oromo.mjs +78 -0
  168. package/dist/languages/persian.d.ts +5 -0
  169. package/dist/languages/persian.mjs +710 -0
  170. package/dist/languages/polish.d.ts +5 -0
  171. package/dist/languages/polish.mjs +614 -0
  172. package/dist/languages/portuguese.d.ts +1 -1
  173. package/dist/languages/portuguese.mjs +613 -380
  174. package/dist/languages/punjabi.d.ts +5 -0
  175. package/dist/languages/punjabi.mjs +197 -0
  176. package/dist/languages/romanian.d.ts +1 -1
  177. package/dist/languages/romanian.mjs +561 -382
  178. package/dist/languages/russian.d.ts +1 -1
  179. package/dist/languages/russian.mjs +373 -244
  180. package/dist/languages/samoan.d.ts +5 -0
  181. package/dist/languages/samoan.mjs +63 -0
  182. package/dist/languages/sanskrit.d.ts +1 -1
  183. package/dist/languages/sanskrit.mjs +2 -2
  184. package/dist/languages/scottish-gaelic.d.ts +5 -0
  185. package/dist/languages/scottish-gaelic.mjs +370 -0
  186. package/dist/languages/serbian.d.ts +1 -1
  187. package/dist/languages/serbian.mjs +3635 -155
  188. package/dist/languages/shona.d.ts +5 -0
  189. package/dist/languages/shona.mjs +91 -0
  190. package/dist/languages/sinhala.d.ts +5 -0
  191. package/dist/languages/sinhala.mjs +182 -0
  192. package/dist/languages/slovak.d.ts +5 -0
  193. package/dist/languages/slovak.mjs +430 -0
  194. package/dist/languages/slovenian.d.ts +1 -1
  195. package/dist/languages/slovenian.mjs +11 -2
  196. package/dist/languages/sorani.d.ts +5 -0
  197. package/dist/languages/sorani.mjs +156 -0
  198. package/dist/languages/spanish.d.ts +1 -1
  199. package/dist/languages/spanish.mjs +676 -374
  200. package/dist/languages/swahili.d.ts +1 -1
  201. package/dist/languages/swahili.mjs +2 -1
  202. package/dist/languages/swedish.d.ts +1 -1
  203. package/dist/languages/swedish.mjs +237 -95
  204. package/dist/languages/tagalog.d.ts +5 -0
  205. package/dist/languages/tagalog.mjs +159 -0
  206. package/dist/languages/tamil.d.ts +1 -1
  207. package/dist/languages/tamil.mjs +836 -64
  208. package/dist/languages/tatar.d.ts +5 -0
  209. package/dist/languages/tatar.mjs +1017 -0
  210. package/dist/languages/telugu.d.ts +5 -0
  211. package/dist/languages/telugu.mjs +62 -0
  212. package/dist/languages/thai.d.ts +5 -0
  213. package/dist/languages/thai.mjs +65 -0
  214. package/dist/languages/tibetan.d.ts +5 -0
  215. package/dist/languages/tibetan.mjs +119 -0
  216. package/dist/languages/tigrinya.d.ts +5 -0
  217. package/dist/languages/tigrinya.mjs +194 -0
  218. package/dist/languages/tongan.d.ts +5 -0
  219. package/dist/languages/tongan.mjs +56 -0
  220. package/dist/languages/turkish.d.ts +1 -1
  221. package/dist/languages/turkish.mjs +1246 -393
  222. package/dist/languages/twi.d.ts +1 -1
  223. package/dist/languages/twi.mjs +13 -2
  224. package/dist/languages/ukrainian.d.ts +1 -1
  225. package/dist/languages/ukrainian.mjs +125 -47
  226. package/dist/languages/urdu.d.ts +5 -0
  227. package/dist/languages/urdu.mjs +528 -0
  228. package/dist/languages/vietnamese.d.ts +5 -0
  229. package/dist/languages/vietnamese.mjs +277 -0
  230. package/dist/languages/welsh.d.ts +5 -0
  231. package/dist/languages/welsh.mjs +446 -0
  232. package/dist/languages/wolof.d.ts +5 -0
  233. package/dist/languages/wolof.mjs +79 -0
  234. package/dist/languages/xhosa.d.ts +5 -0
  235. package/dist/languages/xhosa.mjs +95 -0
  236. package/dist/languages/yoruba.d.ts +1 -1
  237. package/dist/languages/yoruba.mjs +1 -0
  238. package/dist/languages/zulu.d.ts +1 -1
  239. package/dist/languages/zulu.mjs +2 -1
  240. package/dist/narsil-CMZRPDlQ.d.ts +159 -0
  241. package/dist/persistence/durability/checkpoint-worker.d.ts +13 -0
  242. package/dist/persistence/durability/checkpoint-worker.mjs +6 -5
  243. package/dist/{schema-DCgkO1j4.d.ts → schema-BnvLvjRp.d.ts} +5 -3
  244. package/dist/server.d.ts +12 -3
  245. package/dist/server.mjs +183 -64
  246. package/dist/{types-DHX6zGeD.d.ts → types-BRTcBgAp.d.ts} +1 -1
  247. package/dist/workers/entry.mjs +2 -2
  248. package/package.json +10 -3
  249. package/dist/chunk-TW6BXTOL.mjs +0 -338
  250. package/dist/direct-executor-E52FFGDE.mjs +0 -4
  251. package/dist/narsil-D-84Nvm4.d.ts +0 -72
@@ -1,462 +1,974 @@
1
- // src/languages/french.ts
2
- var VOWELS = "aeiouy\xE2\xE0\xEB\xE9\xE8\xEF\xEE\xF4\xF9\xFB\xFC";
3
- function isVowel(ch) {
4
- return VOWELS.includes(ch);
5
- }
6
- function findRegions(word) {
7
- let rv = word.length;
8
- let r1 = word.length;
9
- let r2 = word.length;
10
- if (word.length >= 2 && isVowel(word[0]) && isVowel(word[1])) {
11
- rv = 3;
12
- } else if (word.startsWith("par") || word.startsWith("col") || word.startsWith("tap")) {
13
- rv = 3;
14
- } else {
15
- for (let i = 1; i < word.length; i++) {
16
- if (isVowel(word[i])) {
17
- rv = i + 1;
18
- break;
1
+ import { BaseStemmer } from '../chunk-U2BKYEC7.mjs';
2
+
3
+ // src/languages/snowball/french.ts
4
+ var a_0 = [
5
+ ["col", -1],
6
+ ["ni", 1],
7
+ ["par", -1],
8
+ ["tap", -1]
9
+ ];
10
+ var a_1 = [
11
+ ["", 7],
12
+ ["H", 6, 1],
13
+ ["He", 4, 1],
14
+ ["Hi", 5, 2],
15
+ ["I", 1, 4],
16
+ ["U", 2, 5],
17
+ ["Y", 3, 6]
18
+ ];
19
+ var a_2 = [
20
+ ["iqU", 3],
21
+ ["abl", 3],
22
+ ["I\xE8r", 4],
23
+ ["i\xE8r", 4],
24
+ ["eus", 2],
25
+ ["iv", 1]
26
+ ];
27
+ var a_3 = [
28
+ ["ic", 2],
29
+ ["abil", 1],
30
+ ["iv", 3]
31
+ ];
32
+ var a_4 = [
33
+ ["iqUe", 1],
34
+ ["atrice", 2],
35
+ ["ance", 1],
36
+ ["ence", 5],
37
+ ["logie", 3],
38
+ ["able", 1],
39
+ ["isme", 1],
40
+ ["euse", 12],
41
+ ["iste", 1],
42
+ ["ive", 8],
43
+ ["if", 8],
44
+ ["usion", 4],
45
+ ["ation", 2],
46
+ ["ution", 4],
47
+ ["ateur", 2],
48
+ ["iqUes", 1],
49
+ ["atrices", 2],
50
+ ["ances", 1],
51
+ ["ences", 5],
52
+ ["logies", 3],
53
+ ["ables", 1],
54
+ ["ismes", 1],
55
+ ["euses", 12],
56
+ ["istes", 1],
57
+ ["ives", 8],
58
+ ["ifs", 8],
59
+ ["usions", 4],
60
+ ["ations", 2],
61
+ ["utions", 4],
62
+ ["ateurs", 2],
63
+ ["ments", 16],
64
+ ["ements", 6, 1],
65
+ ["issements", 13, 1],
66
+ ["it\xE9s", 7],
67
+ ["ment", 16],
68
+ ["ement", 6, 1],
69
+ ["issement", 13, 1],
70
+ ["amment", 14, 3],
71
+ ["emment", 15, 4],
72
+ ["aux", 10],
73
+ ["eaux", 9, 1],
74
+ ["eux", 1],
75
+ ["oux", 11],
76
+ ["it\xE9", 7]
77
+ ];
78
+ var a_5 = [
79
+ ["ira", 1],
80
+ ["ie", 1],
81
+ ["isse", 1],
82
+ ["issante", 1],
83
+ ["i", 1],
84
+ ["irai", 1, 1],
85
+ ["ir", 1],
86
+ ["iras", 1],
87
+ ["ies", 1],
88
+ ["\xEEmes", 1],
89
+ ["isses", 1],
90
+ ["issantes", 1],
91
+ ["\xEEtes", 1],
92
+ ["is", 1],
93
+ ["irais", 1, 1],
94
+ ["issais", 1, 2],
95
+ ["irions", 1],
96
+ ["issions", 1],
97
+ ["irons", 1],
98
+ ["issons", 1],
99
+ ["issants", 1],
100
+ ["it", 1],
101
+ ["irait", 1, 1],
102
+ ["issait", 1, 2],
103
+ ["issant", 1],
104
+ ["iraIent", 1],
105
+ ["issaIent", 1],
106
+ ["irent", 1],
107
+ ["issent", 1],
108
+ ["iront", 1],
109
+ ["\xEEt", 1],
110
+ ["iriez", 1],
111
+ ["issiez", 1],
112
+ ["irez", 1],
113
+ ["issez", 1]
114
+ ];
115
+ var a_6 = [
116
+ ["al", 1],
117
+ ["\xE9pl", -1],
118
+ ["auv", -1]
119
+ ];
120
+ var a_7 = [
121
+ ["a", 3],
122
+ ["era", 2, 1],
123
+ ["aise", 4],
124
+ ["asse", 3],
125
+ ["ante", 3],
126
+ ["\xE9e", 2],
127
+ ["ai", 3],
128
+ ["erai", 2, 1],
129
+ ["er", 2],
130
+ ["as", 3],
131
+ ["eras", 2, 1],
132
+ ["\xE2mes", 3],
133
+ ["aises", 4],
134
+ ["asses", 3],
135
+ ["antes", 3],
136
+ ["\xE2tes", 3],
137
+ ["\xE9es", 2],
138
+ ["ais", 4],
139
+ ["eais", 2, 1],
140
+ ["erais", 2, 2],
141
+ ["ions", 1],
142
+ ["erions", 2, 1],
143
+ ["assions", 3, 2],
144
+ ["erons", 2],
145
+ ["ants", 3],
146
+ ["\xE9s", 2],
147
+ ["ait", 3],
148
+ ["erait", 2, 1],
149
+ ["ant", 3],
150
+ ["aIent", 3],
151
+ ["eraIent", 2, 1],
152
+ ["\xE8rent", 2],
153
+ ["assent", 3],
154
+ ["eront", 2],
155
+ ["\xE2t", 3],
156
+ ["ez", 2],
157
+ ["iez", 2, 1],
158
+ ["eriez", 2, 1],
159
+ ["assiez", 3, 2],
160
+ ["erez", 2, 4],
161
+ ["\xE9", 2]
162
+ ];
163
+ var a_8 = [
164
+ ["e", 3],
165
+ ["I\xE8re", 2, 1],
166
+ ["i\xE8re", 2, 2],
167
+ ["ion", 1],
168
+ ["Ier", 2],
169
+ ["ier", 2]
170
+ ];
171
+ var a_9 = [
172
+ ["ell", -1],
173
+ ["eill", -1],
174
+ ["enn", -1],
175
+ ["onn", -1],
176
+ ["ett", -1]
177
+ ];
178
+ var g_v = [17, 65, 16, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 128, 130, 103, 8, 5];
179
+ var g_oux_ending = [65, 85];
180
+ var g_elision_char = [131, 14, 3];
181
+ var g_keep_with_s = [1, 65, 20, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 128];
182
+ var FrenchStemmer = class extends BaseStemmer {
183
+ #stem() {
184
+ let a;
185
+ let I_p2;
186
+ let I_p1;
187
+ let I_pV;
188
+ const v_1 = this.c;
189
+ lab0: {
190
+ this.bra = this.c;
191
+ lab1: {
192
+ lab2: {
193
+ if (!this.in_grouping(g_elision_char, 99, 116)) break lab2;
194
+ break lab1;
195
+ }
196
+ if (!this.eq_s("qu")) break lab0;
19
197
  }
198
+ if (!this.eq_s("'")) break lab0;
199
+ this.ket = this.c;
200
+ if (
201
+ /**@type {boolean}*/
202
+ this.c >= this.limit
203
+ ) break lab0;
204
+ this.slice_del();
20
205
  }
21
- }
22
- for (let i = 0; i < word.length - 1; i++) {
23
- if (isVowel(word[i]) && !isVowel(word[i + 1])) {
24
- r1 = i + 2;
25
- break;
26
- }
27
- }
28
- for (let i = r1; i < word.length - 1; i++) {
29
- if (isVowel(word[i]) && !isVowel(word[i + 1])) {
30
- r2 = i + 2;
31
- break;
32
- }
33
- }
34
- return { rv, r1, r2 };
35
- }
36
- function markVowelConsonantForms(word) {
37
- const chars = word.split("");
38
- for (let i = 0; i < chars.length; i++) {
39
- if (chars[i] === "u" && i > 0 && i < chars.length - 1 && isVowel(chars[i - 1]) && isVowel(chars[i + 1])) {
40
- chars[i] = "U";
41
- }
42
- if (chars[i] === "i" && i > 0 && i < chars.length - 1 && isVowel(chars[i - 1]) && isVowel(chars[i + 1])) {
43
- chars[i] = "I";
44
- }
45
- if (chars[i] === "y" && i > 0 && isVowel(chars[i - 1])) {
46
- chars[i] = "Y";
47
- }
48
- if (chars[i] === "y" && i < chars.length - 1 && isVowel(chars[i + 1])) {
49
- chars[i] = "Y";
50
- }
51
- if (chars[i] === "u" && i > 0 && chars[i - 1] === "q") {
52
- chars[i] = "U";
53
- }
54
- }
55
- return chars.join("");
56
- }
57
- function restoreMarkedLetters(word) {
58
- return word.replace(/I/g, "i").replace(/U/g, "u").replace(/Y/g, "y");
59
- }
60
- function endsWith(word, suffix) {
61
- return word.endsWith(suffix);
62
- }
63
- function removeSuffix(word, suffix) {
64
- return word.slice(0, word.length - suffix.length);
65
- }
66
- function suffixInRegion(word, suffix, regionStart) {
67
- return word.length - suffix.length >= regionStart;
68
- }
69
- function findLongestAmong(word, suffixes, regionStart) {
70
- let longestMatch = null;
71
- for (const suffix of suffixes) {
72
- if (endsWith(word, suffix) && suffixInRegion(word, suffix, regionStart)) {
73
- if (longestMatch === null || suffix.length > longestMatch.length) {
74
- longestMatch = suffix;
206
+ this.c = v_1;
207
+ const v_2 = this.c;
208
+ while (true) {
209
+ const v_3 = this.c;
210
+ lab4: {
211
+ while (true) {
212
+ const v_4 = this.c;
213
+ lab6: {
214
+ lab7: {
215
+ const v_5 = this.c;
216
+ lab8: {
217
+ if (!this.in_grouping(g_v, 97, 251)) break lab8;
218
+ this.bra = this.c;
219
+ lab9: {
220
+ const v_6 = this.c;
221
+ lab10: {
222
+ if (!this.eq_s("u")) break lab10;
223
+ this.ket = this.c;
224
+ if (!this.in_grouping(g_v, 97, 251)) break lab10;
225
+ this.slice_from("U");
226
+ break lab9;
227
+ }
228
+ this.c = v_6;
229
+ lab11: {
230
+ if (!this.eq_s("i")) break lab11;
231
+ this.ket = this.c;
232
+ if (!this.in_grouping(g_v, 97, 251)) break lab11;
233
+ this.slice_from("I");
234
+ break lab9;
235
+ }
236
+ this.c = v_6;
237
+ if (!this.eq_s("y")) break lab8;
238
+ this.ket = this.c;
239
+ this.slice_from("Y");
240
+ }
241
+ break lab7;
242
+ }
243
+ this.c = v_5;
244
+ lab12: {
245
+ this.bra = this.c;
246
+ if (!this.eq_s("\xEB")) break lab12;
247
+ this.ket = this.c;
248
+ this.slice_from("He");
249
+ break lab7;
250
+ }
251
+ this.c = v_5;
252
+ lab13: {
253
+ this.bra = this.c;
254
+ if (!this.eq_s("\xEF")) break lab13;
255
+ this.ket = this.c;
256
+ this.slice_from("Hi");
257
+ break lab7;
258
+ }
259
+ this.c = v_5;
260
+ lab14: {
261
+ this.bra = this.c;
262
+ if (!this.eq_s("y")) break lab14;
263
+ this.ket = this.c;
264
+ if (!this.in_grouping(g_v, 97, 251)) break lab14;
265
+ this.slice_from("Y");
266
+ break lab7;
267
+ }
268
+ this.c = v_5;
269
+ if (!this.eq_s("q")) break lab6;
270
+ this.bra = this.c;
271
+ if (!this.eq_s("u")) break lab6;
272
+ this.ket = this.c;
273
+ this.slice_from("U");
274
+ }
275
+ this.c = v_4;
276
+ break;
277
+ }
278
+ this.c = v_4;
279
+ if (this.c >= this.limit) break lab4;
280
+ this.c++;
281
+ }
282
+ continue;
75
283
  }
284
+ this.c = v_3;
285
+ break;
76
286
  }
77
- }
78
- return longestMatch;
79
- }
80
- function step1StandardSuffix(word, rv, r1, r2) {
81
- const standardSuffixes = [
82
- "issements",
83
- "issement",
84
- "atrices",
85
- "atrice",
86
- "ateurs",
87
- "ateur",
88
- "ations",
89
- "ation",
90
- "usions",
91
- "ution",
92
- "usion",
93
- "utions",
94
- "logies",
95
- "logie",
96
- "ements",
97
- "ement",
98
- "ences",
99
- "ence",
100
- "ances",
101
- "ance",
102
- "ables",
103
- "able",
104
- "ismes",
105
- "isme",
106
- "istes",
107
- "iste",
108
- "euses",
109
- "euse",
110
- "ments",
111
- "ment",
112
- "iqUes",
113
- "iqUe",
114
- "it\xE9s",
115
- "it\xE9",
116
- "ives",
117
- "ive",
118
- "eaux",
119
- "ifs",
120
- "if",
121
- "aux",
122
- "eux"
123
- ];
124
- const suffix = findLongestAmong(word, standardSuffixes, 0);
125
- if (!suffix) return { word, changed: false };
126
- if (["ance", "ances", "iqUe", "iqUes", "isme", "ismes", "able", "ables", "iste", "istes"].includes(suffix)) {
127
- if (suffixInRegion(word, suffix, r2)) {
128
- return { word: removeSuffix(word, suffix), changed: true };
129
- }
130
- return { word, changed: false };
131
- }
132
- if (["atrice", "atrices", "ateur", "ateurs", "ation", "ations"].includes(suffix)) {
133
- if (suffixInRegion(word, suffix, r2)) {
134
- word = removeSuffix(word, suffix);
135
- if (endsWith(word, "ic")) {
136
- if (suffixInRegion(word, "ic", r2)) {
137
- word = removeSuffix(word, "ic");
138
- } else {
139
- word = `${removeSuffix(word, "ic")}iqU`;
287
+ this.c = v_2;
288
+ {
289
+ I_pV = this.limit;
290
+ I_p1 = this.limit;
291
+ I_p2 = this.limit;
292
+ const v_7 = this.c;
293
+ lab16: {
294
+ lab17: {
295
+ const v_8 = this.c;
296
+ lab18: {
297
+ if (!this.in_grouping(g_v, 97, 251)) break lab18;
298
+ if (!this.in_grouping(g_v, 97, 251)) break lab18;
299
+ if (this.c >= this.limit) break lab18;
300
+ this.c++;
301
+ break lab17;
302
+ }
303
+ this.c = v_8;
304
+ lab19: {
305
+ a = this.find_among(a_0);
306
+ if (a === 0) break lab19;
307
+ switch (a) {
308
+ case 1: {
309
+ if (!this.in_grouping(g_v, 97, 251)) break lab19;
310
+ break;
311
+ }
312
+ }
313
+ break lab17;
314
+ }
315
+ this.c = v_8;
316
+ if (this.c >= this.limit) break lab16;
317
+ this.c++;
318
+ if (!this.go_out_grouping(g_v, 97, 251)) break lab16;
319
+ this.c++;
140
320
  }
321
+ I_pV = this.c;
141
322
  }
142
- return { word, changed: true };
143
- }
144
- return { word, changed: false };
145
- }
146
- if (["logie", "logies"].includes(suffix)) {
147
- if (suffixInRegion(word, suffix, r2)) {
148
- return { word: `${removeSuffix(word, suffix)}log`, changed: true };
149
- }
150
- return { word, changed: false };
151
- }
152
- if (["usion", "usions", "ution", "utions"].includes(suffix)) {
153
- if (suffixInRegion(word, suffix, r2)) {
154
- return { word: `${removeSuffix(word, suffix)}u`, changed: true };
155
- }
156
- return { word, changed: false };
157
- }
158
- if (["ence", "ences"].includes(suffix)) {
159
- if (suffixInRegion(word, suffix, r2)) {
160
- return { word: `${removeSuffix(word, suffix)}ent`, changed: true };
323
+ this.c = v_7;
324
+ const v_9 = this.c;
325
+ lab20: {
326
+ if (!this.go_out_grouping(g_v, 97, 251)) break lab20;
327
+ this.c++;
328
+ if (!this.go_in_grouping(g_v, 97, 251)) break lab20;
329
+ this.c++;
330
+ I_p1 = this.c;
331
+ if (!this.go_out_grouping(g_v, 97, 251)) break lab20;
332
+ this.c++;
333
+ if (!this.go_in_grouping(g_v, 97, 251)) break lab20;
334
+ this.c++;
335
+ I_p2 = this.c;
336
+ }
337
+ this.c = v_9;
161
338
  }
162
- return { word, changed: false };
163
- }
164
- if (suffix === "ement" || suffix === "ements") {
165
- if (suffixInRegion(word, suffix, rv)) {
166
- word = removeSuffix(word, suffix);
167
- if (endsWith(word, "iv") && suffixInRegion(word, "iv", r2)) {
168
- word = removeSuffix(word, "iv");
169
- if (endsWith(word, "at") && suffixInRegion(word, "at", r2)) {
170
- word = removeSuffix(word, "at");
339
+ this.limit_backward = this.c;
340
+ this.c = this.limit;
341
+ const v_10 = this.limit - this.c;
342
+ lab21: {
343
+ lab22: {
344
+ const v_11 = this.limit - this.c;
345
+ lab23: {
346
+ const v_12 = this.limit - this.c;
347
+ lab24: {
348
+ const v_13 = this.limit - this.c;
349
+ lab25: {
350
+ this.ket = this.c;
351
+ a = this.find_among_b(a_4);
352
+ if (a === 0) break lab25;
353
+ this.bra = this.c;
354
+ switch (a) {
355
+ case 1: {
356
+ if (
357
+ /**@type {boolean}*/
358
+ I_p2 > this.c
359
+ ) break lab25;
360
+ this.slice_del();
361
+ break;
362
+ }
363
+ case 2: {
364
+ if (
365
+ /**@type {boolean}*/
366
+ I_p2 > this.c
367
+ ) break lab25;
368
+ this.slice_del();
369
+ const v_14 = this.limit - this.c;
370
+ lab26: {
371
+ this.ket = this.c;
372
+ if (!this.eq_s_b("ic")) {
373
+ this.c = this.limit - v_14;
374
+ break lab26;
375
+ }
376
+ this.bra = this.c;
377
+ lab27: {
378
+ const v_15 = this.limit - this.c;
379
+ lab28: {
380
+ if (
381
+ /**@type {boolean}*/
382
+ I_p2 > this.c
383
+ ) break lab28;
384
+ this.slice_del();
385
+ break lab27;
386
+ }
387
+ this.c = this.limit - v_15;
388
+ this.slice_from("iqU");
389
+ }
390
+ }
391
+ break;
392
+ }
393
+ case 3: {
394
+ if (
395
+ /**@type {boolean}*/
396
+ I_p2 > this.c
397
+ ) break lab25;
398
+ this.slice_from("log");
399
+ break;
400
+ }
401
+ case 4: {
402
+ if (
403
+ /**@type {boolean}*/
404
+ I_p2 > this.c
405
+ ) break lab25;
406
+ this.slice_from("u");
407
+ break;
408
+ }
409
+ case 5: {
410
+ if (
411
+ /**@type {boolean}*/
412
+ I_p2 > this.c
413
+ ) break lab25;
414
+ this.slice_from("ent");
415
+ break;
416
+ }
417
+ case 6: {
418
+ if (
419
+ /**@type {boolean}*/
420
+ I_pV > this.c
421
+ ) break lab25;
422
+ this.slice_del();
423
+ const v_16 = this.limit - this.c;
424
+ lab29: {
425
+ this.ket = this.c;
426
+ a = this.find_among_b(a_2);
427
+ if (a === 0) {
428
+ this.c = this.limit - v_16;
429
+ break lab29;
430
+ }
431
+ this.bra = this.c;
432
+ switch (a) {
433
+ case 1: {
434
+ if (
435
+ /**@type {boolean}*/
436
+ I_p2 > this.c
437
+ ) {
438
+ this.c = this.limit - v_16;
439
+ break lab29;
440
+ }
441
+ this.slice_del();
442
+ this.ket = this.c;
443
+ if (!this.eq_s_b("at")) {
444
+ this.c = this.limit - v_16;
445
+ break lab29;
446
+ }
447
+ this.bra = this.c;
448
+ if (
449
+ /**@type {boolean}*/
450
+ I_p2 > this.c
451
+ ) {
452
+ this.c = this.limit - v_16;
453
+ break lab29;
454
+ }
455
+ this.slice_del();
456
+ break;
457
+ }
458
+ case 2: {
459
+ lab30: {
460
+ const v_17 = this.limit - this.c;
461
+ lab31: {
462
+ if (
463
+ /**@type {boolean}*/
464
+ I_p2 > this.c
465
+ ) break lab31;
466
+ this.slice_del();
467
+ break lab30;
468
+ }
469
+ this.c = this.limit - v_17;
470
+ if (
471
+ /**@type {boolean}*/
472
+ I_p1 > this.c
473
+ ) {
474
+ this.c = this.limit - v_16;
475
+ break lab29;
476
+ }
477
+ this.slice_from("eux");
478
+ }
479
+ break;
480
+ }
481
+ case 3: {
482
+ if (
483
+ /**@type {boolean}*/
484
+ I_p2 > this.c
485
+ ) {
486
+ this.c = this.limit - v_16;
487
+ break lab29;
488
+ }
489
+ this.slice_del();
490
+ break;
491
+ }
492
+ case 4: {
493
+ if (
494
+ /**@type {boolean}*/
495
+ I_pV > this.c
496
+ ) {
497
+ this.c = this.limit - v_16;
498
+ break lab29;
499
+ }
500
+ this.slice_from("i");
501
+ break;
502
+ }
503
+ }
504
+ }
505
+ break;
506
+ }
507
+ case 7: {
508
+ if (
509
+ /**@type {boolean}*/
510
+ I_p2 > this.c
511
+ ) break lab25;
512
+ this.slice_del();
513
+ const v_18 = this.limit - this.c;
514
+ lab32: {
515
+ this.ket = this.c;
516
+ a = this.find_among_b(a_3);
517
+ if (a === 0) {
518
+ this.c = this.limit - v_18;
519
+ break lab32;
520
+ }
521
+ this.bra = this.c;
522
+ switch (a) {
523
+ case 1: {
524
+ lab33: {
525
+ const v_19 = this.limit - this.c;
526
+ lab34: {
527
+ if (
528
+ /**@type {boolean}*/
529
+ I_p2 > this.c
530
+ ) break lab34;
531
+ this.slice_del();
532
+ break lab33;
533
+ }
534
+ this.c = this.limit - v_19;
535
+ this.slice_from("abl");
536
+ }
537
+ break;
538
+ }
539
+ case 2: {
540
+ lab35: {
541
+ const v_20 = this.limit - this.c;
542
+ lab36: {
543
+ if (
544
+ /**@type {boolean}*/
545
+ I_p2 > this.c
546
+ ) break lab36;
547
+ this.slice_del();
548
+ break lab35;
549
+ }
550
+ this.c = this.limit - v_20;
551
+ this.slice_from("iqU");
552
+ }
553
+ break;
554
+ }
555
+ case 3: {
556
+ if (
557
+ /**@type {boolean}*/
558
+ I_p2 > this.c
559
+ ) {
560
+ this.c = this.limit - v_18;
561
+ break lab32;
562
+ }
563
+ this.slice_del();
564
+ break;
565
+ }
566
+ }
567
+ }
568
+ break;
569
+ }
570
+ case 8: {
571
+ if (
572
+ /**@type {boolean}*/
573
+ I_p2 > this.c
574
+ ) break lab25;
575
+ this.slice_del();
576
+ const v_21 = this.limit - this.c;
577
+ lab37: {
578
+ this.ket = this.c;
579
+ if (!this.eq_s_b("at")) {
580
+ this.c = this.limit - v_21;
581
+ break lab37;
582
+ }
583
+ this.bra = this.c;
584
+ if (
585
+ /**@type {boolean}*/
586
+ I_p2 > this.c
587
+ ) {
588
+ this.c = this.limit - v_21;
589
+ break lab37;
590
+ }
591
+ this.slice_del();
592
+ this.ket = this.c;
593
+ if (!this.eq_s_b("ic")) {
594
+ this.c = this.limit - v_21;
595
+ break lab37;
596
+ }
597
+ this.bra = this.c;
598
+ lab38: {
599
+ const v_22 = this.limit - this.c;
600
+ lab39: {
601
+ if (
602
+ /**@type {boolean}*/
603
+ I_p2 > this.c
604
+ ) break lab39;
605
+ this.slice_del();
606
+ break lab38;
607
+ }
608
+ this.c = this.limit - v_22;
609
+ this.slice_from("iqU");
610
+ }
611
+ }
612
+ break;
613
+ }
614
+ case 9: {
615
+ this.slice_from("eau");
616
+ break;
617
+ }
618
+ case 10: {
619
+ if (
620
+ /**@type {boolean}*/
621
+ I_p1 > this.c
622
+ ) break lab25;
623
+ this.slice_from("al");
624
+ break;
625
+ }
626
+ case 11: {
627
+ if (!this.in_grouping_b(g_oux_ending, 98, 112)) break lab25;
628
+ this.slice_from("ou");
629
+ break;
630
+ }
631
+ case 12: {
632
+ lab40: {
633
+ const v_23 = this.limit - this.c;
634
+ lab41: {
635
+ if (
636
+ /**@type {boolean}*/
637
+ I_p2 > this.c
638
+ ) break lab41;
639
+ this.slice_del();
640
+ break lab40;
641
+ }
642
+ this.c = this.limit - v_23;
643
+ if (
644
+ /**@type {boolean}*/
645
+ I_p1 > this.c
646
+ ) break lab25;
647
+ this.slice_from("eux");
648
+ }
649
+ break;
650
+ }
651
+ case 13: {
652
+ if (
653
+ /**@type {boolean}*/
654
+ I_p1 > this.c
655
+ ) break lab25;
656
+ if (!this.out_grouping_b(g_v, 97, 251)) break lab25;
657
+ this.slice_del();
658
+ break;
659
+ }
660
+ case 14: {
661
+ if (
662
+ /**@type {boolean}*/
663
+ I_pV > this.c
664
+ ) break lab25;
665
+ this.slice_from("ant");
666
+ break lab25;
667
+ }
668
+ case 15: {
669
+ if (
670
+ /**@type {boolean}*/
671
+ I_pV > this.c
672
+ ) break lab25;
673
+ this.slice_from("ent");
674
+ break lab25;
675
+ }
676
+ case 16: {
677
+ const v_24 = this.limit - this.c;
678
+ if (!this.in_grouping_b(g_v, 97, 251)) break lab25;
679
+ if (
680
+ /**@type {boolean}*/
681
+ I_pV > this.c
682
+ ) break lab25;
683
+ this.c = this.limit - v_24;
684
+ this.slice_del();
685
+ break lab25;
686
+ }
687
+ }
688
+ break lab24;
689
+ }
690
+ this.c = this.limit - v_13;
691
+ lab42: {
692
+ if (this.c < I_pV) break lab42;
693
+ const v_25 = this.limit_backward;
694
+ this.limit_backward = I_pV;
695
+ this.ket = this.c;
696
+ if (this.find_among_b(a_5) === 0) {
697
+ this.limit_backward = v_25;
698
+ break lab42;
699
+ }
700
+ this.bra = this.c;
701
+ lab43: {
702
+ if (!this.eq_s_b("H")) break lab43;
703
+ this.limit_backward = v_25;
704
+ break lab42;
705
+ }
706
+ if (!this.out_grouping_b(g_v, 97, 251)) {
707
+ this.limit_backward = v_25;
708
+ break lab42;
709
+ }
710
+ this.slice_del();
711
+ this.limit_backward = v_25;
712
+ break lab24;
713
+ }
714
+ this.c = this.limit - v_13;
715
+ if (this.c < I_pV) break lab23;
716
+ const v_26 = this.limit_backward;
717
+ this.limit_backward = I_pV;
718
+ this.ket = this.c;
719
+ a = this.find_among_b(a_7);
720
+ if (a === 0) {
721
+ this.limit_backward = v_26;
722
+ break lab23;
723
+ }
724
+ this.bra = this.c;
725
+ this.limit_backward = v_26;
726
+ switch (a) {
727
+ case 1: {
728
+ if (
729
+ /**@type {boolean}*/
730
+ I_p2 > this.c
731
+ ) break lab23;
732
+ this.slice_del();
733
+ break;
734
+ }
735
+ case 2: {
736
+ this.slice_del();
737
+ break;
738
+ }
739
+ case 3: {
740
+ const v_27 = this.limit - this.c;
741
+ lab44: {
742
+ if (!this.eq_s_b("e")) {
743
+ this.c = this.limit - v_27;
744
+ break lab44;
745
+ }
746
+ if (
747
+ /**@type {boolean}*/
748
+ I_pV > this.c
749
+ ) {
750
+ this.c = this.limit - v_27;
751
+ break lab44;
752
+ }
753
+ this.bra = this.c;
754
+ }
755
+ this.slice_del();
756
+ break;
757
+ }
758
+ case 4: {
759
+ {
760
+ const v_28 = this.limit - this.c;
761
+ lab45: {
762
+ a = this.find_among_b(a_6);
763
+ if (a === 0) break lab45;
764
+ switch (a) {
765
+ case 1: {
766
+ if (this.c <= this.limit_backward) break lab45;
767
+ this.c--;
768
+ if (
769
+ /**@type {boolean}*/
770
+ this.c > this.limit_backward
771
+ ) break lab45;
772
+ break;
773
+ }
774
+ }
775
+ break lab23;
776
+ }
777
+ this.c = this.limit - v_28;
778
+ }
779
+ this.slice_del();
780
+ break;
781
+ }
782
+ }
783
+ }
784
+ this.c = this.limit - v_12;
785
+ const v_29 = this.limit - this.c;
786
+ lab46: {
787
+ this.ket = this.c;
788
+ lab47: {
789
+ const v_30 = this.limit - this.c;
790
+ lab48: {
791
+ if (!this.eq_s_b("Y")) break lab48;
792
+ this.bra = this.c;
793
+ this.slice_from("i");
794
+ break lab47;
795
+ }
796
+ this.c = this.limit - v_30;
797
+ if (!this.eq_s_b("\xE7")) {
798
+ this.c = this.limit - v_29;
799
+ break lab46;
800
+ }
801
+ this.bra = this.c;
802
+ this.slice_from("c");
803
+ }
804
+ }
805
+ break lab22;
171
806
  }
172
- } else if (endsWith(word, "eus")) {
173
- if (suffixInRegion(word, "eus", r2)) {
174
- word = removeSuffix(word, "eus");
175
- } else if (suffixInRegion(word, "eus", r1)) {
176
- word = `${removeSuffix(word, "eus")}eux`;
807
+ this.c = this.limit - v_11;
808
+ const v_31 = this.limit - this.c;
809
+ lab49: {
810
+ this.ket = this.c;
811
+ if (!this.eq_s_b("s")) {
812
+ this.c = this.limit - v_31;
813
+ break lab49;
814
+ }
815
+ this.bra = this.c;
816
+ const v_32 = this.limit - this.c;
817
+ lab50: {
818
+ lab51: {
819
+ if (!this.eq_s_b("Hi")) break lab51;
820
+ break lab50;
821
+ }
822
+ if (!this.out_grouping_b(g_keep_with_s, 97, 232)) {
823
+ this.c = this.limit - v_31;
824
+ break lab49;
825
+ }
826
+ }
827
+ this.c = this.limit - v_32;
828
+ this.slice_del();
177
829
  }
178
- } else if (endsWith(word, "abl") && suffixInRegion(word, "abl", r2)) {
179
- word = removeSuffix(word, "abl");
180
- } else if (endsWith(word, "iqU") && suffixInRegion(word, "iqU", r2)) {
181
- word = removeSuffix(word, "iqU");
182
- } else if ((endsWith(word, "i\xE8r") || endsWith(word, "I\xE8r")) && suffixInRegion(word, "i\xE8r", rv)) {
183
- const sSuffix = endsWith(word, "I\xE8r") ? "I\xE8r" : "i\xE8r";
184
- word = `${removeSuffix(word, sSuffix)}i`;
185
- }
186
- return { word, changed: true };
187
- }
188
- return { word, changed: false };
189
- }
190
- if (["it\xE9", "it\xE9s"].includes(suffix)) {
191
- if (suffixInRegion(word, suffix, r2)) {
192
- word = removeSuffix(word, suffix);
193
- if (endsWith(word, "abil") && suffixInRegion(word, "abil", r2)) {
194
- word = removeSuffix(word, "abil");
195
- } else if (endsWith(word, "abil")) {
196
- word = `${removeSuffix(word, "abil")}abl`;
197
- } else if (endsWith(word, "ic")) {
198
- if (suffixInRegion(word, "ic", r2)) {
199
- word = removeSuffix(word, "ic");
200
- } else {
201
- word = `${removeSuffix(word, "ic")}iqU`;
830
+ if (this.c < I_pV) break lab21;
831
+ const v_33 = this.limit_backward;
832
+ this.limit_backward = I_pV;
833
+ this.ket = this.c;
834
+ a = this.find_among_b(a_8);
835
+ if (a === 0) {
836
+ this.limit_backward = v_33;
837
+ break lab21;
202
838
  }
203
- } else if (endsWith(word, "iv") && suffixInRegion(word, "iv", r2)) {
204
- word = removeSuffix(word, "iv");
205
- }
206
- return { word, changed: true };
207
- }
208
- return { word, changed: false };
209
- }
210
- if (["if", "ifs", "ive", "ives"].includes(suffix)) {
211
- if (suffixInRegion(word, suffix, r2)) {
212
- word = removeSuffix(word, suffix);
213
- if (endsWith(word, "at") && suffixInRegion(word, "at", r2)) {
214
- word = removeSuffix(word, "at");
215
- if (endsWith(word, "ic")) {
216
- if (suffixInRegion(word, "ic", r2)) {
217
- word = removeSuffix(word, "ic");
218
- } else {
219
- word = `${removeSuffix(word, "ic")}iqU`;
839
+ this.bra = this.c;
840
+ switch (a) {
841
+ case 1: {
842
+ if (
843
+ /**@type {boolean}*/
844
+ I_p2 > this.c
845
+ ) {
846
+ this.limit_backward = v_33;
847
+ break lab21;
848
+ }
849
+ lab52: {
850
+ lab53: {
851
+ if (!this.eq_s_b("s")) break lab53;
852
+ break lab52;
853
+ }
854
+ if (!this.eq_s_b("t")) {
855
+ this.limit_backward = v_33;
856
+ break lab21;
857
+ }
858
+ }
859
+ this.slice_del();
860
+ break;
861
+ }
862
+ case 2: {
863
+ this.slice_from("i");
864
+ break;
865
+ }
866
+ case 3: {
867
+ this.slice_del();
868
+ break;
220
869
  }
221
870
  }
871
+ this.limit_backward = v_33;
222
872
  }
223
- return { word, changed: true };
224
873
  }
225
- return { word, changed: false };
226
- }
227
- if (suffix === "eaux") {
228
- return { word: `${removeSuffix(word, "eaux")}eau`, changed: true };
229
- }
230
- if (suffix === "aux") {
231
- if (suffixInRegion(word, suffix, r1)) {
232
- return { word: `${removeSuffix(word, "aux")}al`, changed: true };
233
- }
234
- return { word, changed: false };
235
- }
236
- if (["euse", "euses"].includes(suffix)) {
237
- if (suffixInRegion(word, suffix, r2)) {
238
- return { word: removeSuffix(word, suffix), changed: true };
239
- }
240
- if (suffixInRegion(word, suffix, r1)) {
241
- return { word: `${removeSuffix(word, suffix)}eux`, changed: true };
874
+ this.c = this.limit - v_10;
875
+ const v_34 = this.limit - this.c;
876
+ lab54: {
877
+ const v_35 = this.limit - this.c;
878
+ if (this.find_among_b(a_9) === 0) break lab54;
879
+ this.c = this.limit - v_35;
880
+ this.ket = this.c;
881
+ if (this.c <= this.limit_backward) break lab54;
882
+ this.c--;
883
+ this.bra = this.c;
884
+ this.slice_del();
242
885
  }
243
- return { word, changed: false };
244
- }
245
- if (suffix === "issement" || suffix === "issements") {
246
- if (suffixInRegion(word, suffix, r1)) {
247
- const stemmed = removeSuffix(word, suffix);
248
- if (stemmed.length > 0 && !isVowel(stemmed[stemmed.length - 1])) {
249
- return { word: stemmed, changed: true };
886
+ this.c = this.limit - v_34;
887
+ const v_36 = this.limit - this.c;
888
+ lab55: {
889
+ {
890
+ let v_37 = 1;
891
+ while (true) {
892
+ lab56: {
893
+ if (!this.out_grouping_b(g_v, 97, 251)) break lab56;
894
+ v_37--;
895
+ continue;
896
+ }
897
+ break;
898
+ }
899
+ if (v_37 > 0) break lab55;
250
900
  }
251
- }
252
- return { word, changed: false };
253
- }
254
- if (suffix === "amment") {
255
- if (suffixInRegion(word, suffix, rv)) {
256
- return { word: `${removeSuffix(word, "amment")}ant`, changed: true };
257
- }
258
- return { word, changed: false };
259
- }
260
- if (suffix === "emment") {
261
- if (suffixInRegion(word, suffix, rv)) {
262
- return { word: `${removeSuffix(word, "emment")}ent`, changed: true };
263
- }
264
- return { word, changed: false };
265
- }
266
- if (suffix === "ment" || suffix === "ments") {
267
- if (suffixInRegion(word, suffix, rv)) {
268
- const stemmed = removeSuffix(word, suffix);
269
- if (stemmed.length > 0 && isVowel(stemmed[stemmed.length - 1])) {
270
- return { word: stemmed, changed: true };
901
+ this.ket = this.c;
902
+ lab57: {
903
+ lab58: {
904
+ if (!this.eq_s_b("\xE9")) break lab58;
905
+ break lab57;
906
+ }
907
+ if (!this.eq_s_b("\xE8")) break lab55;
271
908
  }
909
+ this.bra = this.c;
910
+ this.slice_from("e");
272
911
  }
273
- return { word, changed: false };
274
- }
275
- if (suffix === "eux") {
276
- if (suffixInRegion(word, suffix, r2)) {
277
- return { word: removeSuffix(word, suffix), changed: true };
278
- }
279
- return { word, changed: false };
280
- }
281
- return { word, changed: false };
282
- }
283
- function step2aIVerbSuffix(word, rv) {
284
- const suffixes = [
285
- "issantes",
286
- "issante",
287
- "issants",
288
- "issant",
289
- "issions",
290
- "issons",
291
- "issais",
292
- "issait",
293
- "issiez",
294
- "issez",
295
- "isses",
296
- "isse",
297
- "iraIent",
298
- "issaIent",
299
- "irions",
300
- "iront",
301
- "irais",
302
- "irait",
303
- "iriez",
304
- "irons",
305
- "irent",
306
- "irez",
307
- "irai",
308
- "iras",
309
- "\xEEmes",
310
- "\xEEtes",
311
- "ies",
312
- "ira",
313
- "ir",
314
- "is",
315
- "it",
316
- "ie",
317
- "i",
318
- "\xEEt"
319
- ];
320
- const suffix = findLongestAmong(word, suffixes, rv);
321
- if (!suffix) return { word, changed: false };
322
- const stemmed = removeSuffix(word, suffix);
323
- if (stemmed.length > 0 && !isVowel(stemmed[stemmed.length - 1]) && stemmed[stemmed.length - 1] !== "H") {
324
- return { word: stemmed, changed: true };
325
- }
326
- return { word, changed: false };
327
- }
328
- function step2bOtherVerbSuffix(word, rv, r2) {
329
- const group1Suffixes = [
330
- "eraIent",
331
- "erions",
332
- "assions",
333
- "assent",
334
- "assiez",
335
- "erais",
336
- "erait",
337
- "eriez",
338
- "erons",
339
- "eront",
340
- "erez",
341
- "antes",
342
- "asses",
343
- "eras",
344
- "ante",
345
- "asse",
346
- "\xE2mes",
347
- "\xE2tes",
348
- "\xE9es",
349
- "era",
350
- "erai",
351
- "ais",
352
- "ait",
353
- "ant",
354
- "\xE9e",
355
- "\xE9s",
356
- "er",
357
- "ez",
358
- "ai",
359
- "as",
360
- "a",
361
- "\xE9",
362
- "\xE2t",
363
- "\xE8rent"
364
- ];
365
- const ionsSuffix = "ions";
366
- if (endsWith(word, ionsSuffix) && suffixInRegion(word, ionsSuffix, r2)) {
367
- return { word: removeSuffix(word, ionsSuffix), changed: true };
368
- }
369
- const suffix = findLongestAmong(word, group1Suffixes, rv);
370
- if (suffix) {
371
- return { word: removeSuffix(word, suffix), changed: true };
372
- }
373
- return { word, changed: false };
374
- }
375
- function step3ResidualSuffix(word, rv, r2) {
376
- if (endsWith(word, "s")) {
377
- const beforeS = word.slice(0, -1);
378
- if (beforeS.length > 0) {
379
- const lastChar = beforeS[beforeS.length - 1];
380
- if (lastChar !== "a" && lastChar !== "i" && lastChar !== "o" && lastChar !== "u" && lastChar !== "\xE8" && lastChar !== "s") {
381
- word = beforeS;
912
+ this.c = this.limit - v_36;
913
+ this.c = this.limit_backward;
914
+ const v_38 = this.c;
915
+ while (true) {
916
+ const v_39 = this.c;
917
+ lab60: {
918
+ this.bra = this.c;
919
+ a = this.find_among(a_1);
920
+ this.ket = this.c;
921
+ switch (a) {
922
+ case 1: {
923
+ this.slice_from("i");
924
+ break;
925
+ }
926
+ case 2: {
927
+ this.slice_from("u");
928
+ break;
929
+ }
930
+ case 3: {
931
+ this.slice_from("y");
932
+ break;
933
+ }
934
+ case 4: {
935
+ this.slice_from("\xEB");
936
+ break;
937
+ }
938
+ case 5: {
939
+ this.slice_from("\xEF");
940
+ break;
941
+ }
942
+ case 6: {
943
+ this.slice_del();
944
+ break;
945
+ }
946
+ case 7: {
947
+ if (this.c >= this.limit) break lab60;
948
+ this.c++;
949
+ break;
950
+ }
951
+ }
952
+ continue;
382
953
  }
954
+ this.c = v_39;
955
+ break;
383
956
  }
957
+ this.c = v_38;
958
+ return true;
384
959
  }
385
- const ionSuffix = "ion";
386
- if (endsWith(word, ionSuffix) && suffixInRegion(word, ionSuffix, r2)) {
387
- const stemmed = removeSuffix(word, ionSuffix);
388
- if (stemmed.length > 0 && (stemmed[stemmed.length - 1] === "s" || stemmed[stemmed.length - 1] === "t") && suffixInRegion(word, ionSuffix, rv)) {
389
- return stemmed;
390
- }
391
- }
392
- const residualSuffixes = ["I\xE8re", "i\xE8re", "Ier", "ier"];
393
- for (const suffix of residualSuffixes) {
394
- if (endsWith(word, suffix) && suffixInRegion(word, suffix, rv)) {
395
- return `${removeSuffix(word, suffix)}i`;
396
- }
397
- }
398
- if (endsWith(word, "e") && suffixInRegion(word, "e", rv)) {
399
- return removeSuffix(word, "e");
400
- }
401
- return word;
402
- }
403
- function step4Undouble(word) {
404
- const doublePatterns = ["enn", "onn", "ett", "ell", "eill"];
405
- for (const pattern of doublePatterns) {
406
- if (endsWith(word, pattern)) {
407
- return word.slice(0, -1);
408
- }
409
- }
410
- return word;
411
- }
412
- function step5UnAccent(word) {
413
- if (word.length < 2) return word;
414
- const lastChar = word[word.length - 1];
415
- const secondLastChar = word[word.length - 2];
416
- if ((lastChar === "\xE9" || lastChar === "\xE8") && !isVowel(secondLastChar)) {
417
- return `${word.slice(0, -1)}e`;
418
- }
419
- if (!isVowel(lastChar) && (secondLastChar === "\xE9" || secondLastChar === "\xE8")) {
420
- return `${word.slice(0, -2)}e${lastChar}`;
421
- }
422
- return word;
423
- }
424
- function stem(word) {
425
- if (word.length < 3) return word;
426
- if (word[0] === "y") {
427
- word = `Y${word.slice(1)}`;
428
- }
429
- word = markVowelConsonantForms(word);
430
- const { rv, r1, r2 } = findRegions(word);
431
- const step1Result = step1StandardSuffix(word, rv, r1, r2);
432
- let stemChanged = step1Result.changed;
433
- word = step1Result.word;
434
- if (!stemChanged) {
435
- const step2aResult = step2aIVerbSuffix(word, rv);
436
- if (step2aResult.changed) {
437
- word = step2aResult.word;
438
- stemChanged = true;
439
- } else {
440
- const step2bResult = step2bOtherVerbSuffix(word, rv, r2);
441
- word = step2bResult.word;
442
- stemChanged = step2bResult.changed;
443
- }
444
- }
445
- if (stemChanged) {
446
- if (endsWith(word, "Y")) {
447
- word = `${word.slice(0, -1)}i`;
448
- }
449
- if (endsWith(word, "\xE7")) {
450
- word = `${word.slice(0, -1)}c`;
451
- }
452
- } else {
453
- word = step3ResidualSuffix(word, rv, r2);
960
+ stem(input) {
961
+ this.setCurrent(input);
962
+ this.#stem();
963
+ return this.getCurrent();
454
964
  }
455
- word = step4Undouble(word);
456
- word = step5UnAccent(word);
457
- word = restoreMarkedLetters(word);
458
- return word.toLowerCase();
965
+ };
966
+ var shared = new FrenchStemmer();
967
+ function stem(token) {
968
+ return shared.stem(token);
459
969
  }
970
+
971
+ // src/languages/french.ts
460
972
  var stopWords = /* @__PURE__ */ new Set([
461
973
  "au",
462
974
  "aux",
@@ -625,10 +1137,11 @@ var stopWords = /* @__PURE__ */ new Set([
625
1137
  ]);
626
1138
  var french = {
627
1139
  name: "french",
1140
+ revision: "240a93ad04b96326",
628
1141
  stemmer: stem,
629
1142
  stopWords,
630
1143
  tokenizer: {
631
- splitPattern: /[^a-z0-9äâàéèëêïîöôùüûœç-]+/gi
1144
+ splitPattern: /[^a-z0-9äâàéèëêïîöôùüûœçÿæ-]+/gi
632
1145
  }
633
1146
  };
634
1147