yomitan-core 0.1.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 (207) hide show
  1. package/README.md +485 -0
  2. package/dist/anki-connect-BQyCGW3O.cjs +513 -0
  3. package/dist/anki-connect-BQyCGW3O.cjs.map +1 -0
  4. package/dist/anki-connect-CPPuhyiQ.js +6 -0
  5. package/dist/anki-connect-DbrQHphS.js +495 -0
  6. package/dist/anki-connect-DbrQHphS.js.map +1 -0
  7. package/dist/anki-connect-DcheJrp-.cjs +6 -0
  8. package/dist/anki.cjs +1758 -0
  9. package/dist/anki.cjs.map +1 -0
  10. package/dist/anki.d.cts +751 -0
  11. package/dist/anki.d.cts.map +1 -0
  12. package/dist/anki.d.ts +751 -0
  13. package/dist/anki.d.ts.map +1 -0
  14. package/dist/anki.js +1751 -0
  15. package/dist/anki.js.map +1 -0
  16. package/dist/audio-D9DvYyB7.d.cts +48 -0
  17. package/dist/audio-D9DvYyB7.d.cts.map +1 -0
  18. package/dist/audio-DQulUkDM.d.ts +48 -0
  19. package/dist/audio-DQulUkDM.d.ts.map +1 -0
  20. package/dist/audio-url-generator-BXvQaqUi.cjs +4 -0
  21. package/dist/audio-url-generator-Dy2hb2Mm.cjs +414 -0
  22. package/dist/audio-url-generator-Dy2hb2Mm.cjs.map +1 -0
  23. package/dist/audio-url-generator-Qi0rfzHz.js +4 -0
  24. package/dist/audio-url-generator-pFQAB5Nb.js +390 -0
  25. package/dist/audio-url-generator-pFQAB5Nb.js.map +1 -0
  26. package/dist/audio.cjs +7 -0
  27. package/dist/audio.d.cts +86 -0
  28. package/dist/audio.d.cts.map +1 -0
  29. package/dist/audio.d.ts +86 -0
  30. package/dist/audio.d.ts.map +1 -0
  31. package/dist/audio.js +4 -0
  32. package/dist/batch-processor-BR-gB3H3.js +84 -0
  33. package/dist/batch-processor-BR-gB3H3.js.map +1 -0
  34. package/dist/batch-processor-CSF1acTw.cjs +3 -0
  35. package/dist/batch-processor-DFqM_L-_.cjs +91 -0
  36. package/dist/batch-processor-DFqM_L-_.cjs.map +1 -0
  37. package/dist/batch-processor-Quo9jUyf.js +3 -0
  38. package/dist/chunk-BCwAaXi7.cjs +31 -0
  39. package/dist/cjk-util-Dp0ZU0sh.cjs +167 -0
  40. package/dist/cjk-util-Dp0ZU0sh.cjs.map +1 -0
  41. package/dist/cjk-util-DubXBGDG.js +94 -0
  42. package/dist/cjk-util-DubXBGDG.js.map +1 -0
  43. package/dist/core-BUpclilG.d.cts +102 -0
  44. package/dist/core-BUpclilG.d.cts.map +1 -0
  45. package/dist/core-DFUj5GtA.d.ts +102 -0
  46. package/dist/core-DFUj5GtA.d.ts.map +1 -0
  47. package/dist/database.cjs +7 -0
  48. package/dist/database.d.cts +4 -0
  49. package/dist/database.d.ts +4 -0
  50. package/dist/database.js +5 -0
  51. package/dist/dictionary-D7l-qFt1.d.cts +316 -0
  52. package/dist/dictionary-D7l-qFt1.d.cts.map +1 -0
  53. package/dist/dictionary-_vzfBLWi.d.ts +316 -0
  54. package/dist/dictionary-_vzfBLWi.d.ts.map +1 -0
  55. package/dist/dictionary-data-util-CHnRdYZ9.cjs +378 -0
  56. package/dist/dictionary-data-util-CHnRdYZ9.cjs.map +1 -0
  57. package/dist/dictionary-data-util-CfOLfEDE.js +323 -0
  58. package/dist/dictionary-data-util-CfOLfEDE.js.map +1 -0
  59. package/dist/dictionary-database-BDC2f9zc.d.ts +58 -0
  60. package/dist/dictionary-database-BDC2f9zc.d.ts.map +1 -0
  61. package/dist/dictionary-database-CU4TsvCC.js +393 -0
  62. package/dist/dictionary-database-CU4TsvCC.js.map +1 -0
  63. package/dist/dictionary-database-DsOi04Sg.d.cts +58 -0
  64. package/dist/dictionary-database-DsOi04Sg.d.cts.map +1 -0
  65. package/dist/dictionary-database-lvFvftnO.cjs +412 -0
  66. package/dist/dictionary-database-lvFvftnO.cjs.map +1 -0
  67. package/dist/dictionary-importer-BkQQSBhm.d.ts +237 -0
  68. package/dist/dictionary-importer-BkQQSBhm.d.ts.map +1 -0
  69. package/dist/dictionary-importer-Cen1z6co.js +1821 -0
  70. package/dist/dictionary-importer-Cen1z6co.js.map +1 -0
  71. package/dist/dictionary-importer-DYmmWmcX.cjs +8 -0
  72. package/dist/dictionary-importer-Da3AuTZw.d.cts +237 -0
  73. package/dist/dictionary-importer-Da3AuTZw.d.cts.map +1 -0
  74. package/dist/dictionary-importer-Dhn75iZ4.cjs +1834 -0
  75. package/dist/dictionary-importer-Dhn75iZ4.cjs.map +1 -0
  76. package/dist/dictionary-importer-xWkel0h-.js +8 -0
  77. package/dist/dictionary-update-checker-BNE4pGTx.js +4 -0
  78. package/dist/dictionary-update-checker-Byjvifd2.cjs +75 -0
  79. package/dist/dictionary-update-checker-Byjvifd2.cjs.map +1 -0
  80. package/dist/dictionary-update-checker-YdpalZ41.cjs +4 -0
  81. package/dist/dictionary-update-checker-kKukiovj.js +69 -0
  82. package/dist/dictionary-update-checker-kKukiovj.js.map +1 -0
  83. package/dist/display-generator-BGVWiI0t.js +746 -0
  84. package/dist/display-generator-BGVWiI0t.js.map +1 -0
  85. package/dist/display-generator-BMQmG5Ov.cjs +9 -0
  86. package/dist/display-generator-BxZ7mBjP.js +9 -0
  87. package/dist/display-generator-DyP-HNzP.cjs +758 -0
  88. package/dist/display-generator-DyP-HNzP.cjs.map +1 -0
  89. package/dist/errors-BSezaJwm.cjs +35 -0
  90. package/dist/errors-BSezaJwm.cjs.map +1 -0
  91. package/dist/errors-DuuDSO5N.js +22 -0
  92. package/dist/errors-DuuDSO5N.js.map +1 -0
  93. package/dist/frequency-ranking-BXjfhhUQ.js +3 -0
  94. package/dist/frequency-ranking-Cx1kkIrw.cjs +3 -0
  95. package/dist/frequency-ranking-DEJMTMdg.js +159 -0
  96. package/dist/frequency-ranking-DEJMTMdg.js.map +1 -0
  97. package/dist/frequency-ranking-DVYxTXN-.cjs +166 -0
  98. package/dist/frequency-ranking-DVYxTXN-.cjs.map +1 -0
  99. package/dist/furigana-5HK97CY8.js +4 -0
  100. package/dist/furigana-9bBI9-qe.d.ts +47 -0
  101. package/dist/furigana-9bBI9-qe.d.ts.map +1 -0
  102. package/dist/furigana-B3-0y231.js +471 -0
  103. package/dist/furigana-B3-0y231.js.map +1 -0
  104. package/dist/furigana-CjOhzvZt.d.cts +47 -0
  105. package/dist/furigana-CjOhzvZt.d.cts.map +1 -0
  106. package/dist/furigana-DpZLcues.cjs +609 -0
  107. package/dist/furigana-DpZLcues.cjs.map +1 -0
  108. package/dist/furigana-h3v2ub4-.cjs +4 -0
  109. package/dist/import.cjs +12 -0
  110. package/dist/import.d.cts +107 -0
  111. package/dist/import.d.cts.map +1 -0
  112. package/dist/import.d.ts +107 -0
  113. package/dist/import.d.ts.map +1 -0
  114. package/dist/import.js +9 -0
  115. package/dist/index.cjs +275 -0
  116. package/dist/index.cjs.map +1 -0
  117. package/dist/index.d.cts +211 -0
  118. package/dist/index.d.cts.map +1 -0
  119. package/dist/index.d.ts +211 -0
  120. package/dist/index.d.ts.map +1 -0
  121. package/dist/index.js +238 -0
  122. package/dist/index.js.map +1 -0
  123. package/dist/json-DGd-cunA.js +17 -0
  124. package/dist/json-DGd-cunA.js.map +1 -0
  125. package/dist/json-DKWp-B7Y.cjs +30 -0
  126. package/dist/json-DKWp-B7Y.cjs.map +1 -0
  127. package/dist/language-KN_u-nTR.d.ts +104 -0
  128. package/dist/language-KN_u-nTR.d.ts.map +1 -0
  129. package/dist/language-xAbQxgXc.d.cts +104 -0
  130. package/dist/language-xAbQxgXc.d.cts.map +1 -0
  131. package/dist/language.cjs +15626 -0
  132. package/dist/language.cjs.map +1 -0
  133. package/dist/language.d.cts +959 -0
  134. package/dist/language.d.cts.map +1 -0
  135. package/dist/language.d.ts +959 -0
  136. package/dist/language.d.ts.map +1 -0
  137. package/dist/language.js +15522 -0
  138. package/dist/language.js.map +1 -0
  139. package/dist/log-D8KtR3aP.cjs +67 -0
  140. package/dist/log-D8KtR3aP.cjs.map +1 -0
  141. package/dist/log-hgSll-dS.js +60 -0
  142. package/dist/log-hgSll-dS.js.map +1 -0
  143. package/dist/lookup.cjs +13 -0
  144. package/dist/lookup.d.cts +161 -0
  145. package/dist/lookup.d.cts.map +1 -0
  146. package/dist/lookup.d.ts +161 -0
  147. package/dist/lookup.d.ts.map +1 -0
  148. package/dist/lookup.js +10 -0
  149. package/dist/media-loader-BABA_E4W.js +3 -0
  150. package/dist/media-loader-Ce9cuANS.cjs +21 -0
  151. package/dist/media-loader-Ce9cuANS.cjs.map +1 -0
  152. package/dist/media-loader-qRti-Q6h.js +14 -0
  153. package/dist/media-loader-qRti-Q6h.js.map +1 -0
  154. package/dist/media-loader-xlUGaJrx.cjs +3 -0
  155. package/dist/multi-language-transformer-AlxOM6b3.js +637 -0
  156. package/dist/multi-language-transformer-AlxOM6b3.js.map +1 -0
  157. package/dist/multi-language-transformer-MdbQBBOt.cjs +685 -0
  158. package/dist/multi-language-transformer-MdbQBBOt.cjs.map +1 -0
  159. package/dist/multi-language-transformer-SEhcJXEB.d.ts +63 -0
  160. package/dist/multi-language-transformer-SEhcJXEB.d.ts.map +1 -0
  161. package/dist/multi-language-transformer-Ul9mbRce.d.cts +63 -0
  162. package/dist/multi-language-transformer-Ul9mbRce.d.cts.map +1 -0
  163. package/dist/pronunciation-generator-BtBc4q_V.js +397 -0
  164. package/dist/pronunciation-generator-BtBc4q_V.js.map +1 -0
  165. package/dist/pronunciation-generator-CBYdXYou.js +4 -0
  166. package/dist/pronunciation-generator-CFbZlf5J.cjs +445 -0
  167. package/dist/pronunciation-generator-CFbZlf5J.cjs.map +1 -0
  168. package/dist/pronunciation-generator-DOz9hEuk.cjs +4 -0
  169. package/dist/render.cjs +2796 -0
  170. package/dist/render.cjs.map +1 -0
  171. package/dist/render.d.cts +424 -0
  172. package/dist/render.d.cts.map +1 -0
  173. package/dist/render.d.ts +424 -0
  174. package/dist/render.d.ts.map +1 -0
  175. package/dist/render.js +2777 -0
  176. package/dist/render.js.map +1 -0
  177. package/dist/sentence-parser-BPAJNzqW.js +126 -0
  178. package/dist/sentence-parser-BPAJNzqW.js.map +1 -0
  179. package/dist/sentence-parser-BVIOI64h.cjs +132 -0
  180. package/dist/sentence-parser-BVIOI64h.cjs.map +1 -0
  181. package/dist/sentence-parser-BoHO3cHn.js +5 -0
  182. package/dist/sentence-parser-DQVLSW0z.cjs +5 -0
  183. package/dist/structured-content-generator-BtOApkTW.cjs +4 -0
  184. package/dist/structured-content-generator-Bx62RYa8.js +4 -0
  185. package/dist/structured-content-generator-CLnybumI.js +276 -0
  186. package/dist/structured-content-generator-CLnybumI.js.map +1 -0
  187. package/dist/structured-content-generator-DrwkB0-k.cjs +282 -0
  188. package/dist/structured-content-generator-DrwkB0-k.cjs.map +1 -0
  189. package/dist/text-utilities-B7PIythe.js +8 -0
  190. package/dist/text-utilities-B7PIythe.js.map +1 -0
  191. package/dist/text-utilities-Del2Ivkg.cjs +15 -0
  192. package/dist/text-utilities-Del2Ivkg.cjs.map +1 -0
  193. package/dist/translator-CRPlPzqi.cjs +1545 -0
  194. package/dist/translator-CRPlPzqi.cjs.map +1 -0
  195. package/dist/translator-CWgG5drA.js +1539 -0
  196. package/dist/translator-CWgG5drA.js.map +1 -0
  197. package/dist/translator-CaGtJvnQ.cjs +6 -0
  198. package/dist/translator-Cc6OGxrW.d.ts +180 -0
  199. package/dist/translator-Cc6OGxrW.d.ts.map +1 -0
  200. package/dist/translator-CcA-s-W4.d.cts +180 -0
  201. package/dist/translator-CcA-s-W4.d.cts.map +1 -0
  202. package/dist/translator-CuJOTK6l.js +6 -0
  203. package/dist/utilities-C-lbZaJE.cjs +52 -0
  204. package/dist/utilities-C-lbZaJE.cjs.map +1 -0
  205. package/dist/utilities-bi3EF-q5.js +33 -0
  206. package/dist/utilities-bi3EF-q5.js.map +1 -0
  207. package/package.json +102 -0
@@ -0,0 +1,685 @@
1
+ "use strict";
2
+ const require_log = require('./log-D8KtR3aP.cjs');
3
+ const require_cjk_util = require('./cjk-util-Dp0ZU0sh.cjs');
4
+
5
+ //#region src/language/language-descriptors.ts
6
+ const capitalizationPreprocessors = {
7
+ decapitalize: require_cjk_util.decapitalize,
8
+ capitalizeFirstLetter: require_cjk_util.capitalizeFirstLetter
9
+ };
10
+ const languageDescriptors = [
11
+ {
12
+ iso: "bg",
13
+ iso639_3: "bul",
14
+ name: "Bulgarian",
15
+ exampleText: "чета",
16
+ textPreprocessors: capitalizationPreprocessors
17
+ },
18
+ {
19
+ iso: "cs",
20
+ iso639_3: "ces",
21
+ name: "Czech",
22
+ exampleText: "číst",
23
+ textPreprocessors: capitalizationPreprocessors
24
+ },
25
+ {
26
+ iso: "da",
27
+ iso639_3: "dan",
28
+ name: "Danish",
29
+ exampleText: "læse",
30
+ textPreprocessors: { ...capitalizationPreprocessors }
31
+ },
32
+ {
33
+ iso: "de",
34
+ iso639_3: "deu",
35
+ name: "German",
36
+ exampleText: "lesen",
37
+ textPreprocessors: { ...capitalizationPreprocessors }
38
+ },
39
+ {
40
+ iso: "el",
41
+ iso639_3: "ell",
42
+ name: "Greek",
43
+ exampleText: "διαβάζω",
44
+ textPreprocessors: { ...capitalizationPreprocessors }
45
+ },
46
+ {
47
+ iso: "en",
48
+ iso639_3: "eng",
49
+ name: "English",
50
+ exampleText: "read",
51
+ textPreprocessors: capitalizationPreprocessors
52
+ },
53
+ {
54
+ iso: "eo",
55
+ iso639_3: "epo",
56
+ name: "Esperanto",
57
+ exampleText: "legi",
58
+ textPreprocessors: capitalizationPreprocessors
59
+ },
60
+ {
61
+ iso: "es",
62
+ iso639_3: "spa",
63
+ name: "Spanish",
64
+ exampleText: "leer",
65
+ textPreprocessors: capitalizationPreprocessors
66
+ },
67
+ {
68
+ iso: "et",
69
+ iso639_3: "est",
70
+ name: "Estonian",
71
+ exampleText: "lugema",
72
+ textPreprocessors: capitalizationPreprocessors
73
+ },
74
+ {
75
+ iso: "fi",
76
+ iso639_3: "fin",
77
+ name: "Finnish",
78
+ exampleText: "lukea",
79
+ textPreprocessors: capitalizationPreprocessors
80
+ },
81
+ {
82
+ iso: "fr",
83
+ iso639_3: "fra",
84
+ name: "French",
85
+ exampleText: "lire",
86
+ textPreprocessors: { ...capitalizationPreprocessors }
87
+ },
88
+ {
89
+ iso: "ga",
90
+ iso639_3: "gle",
91
+ name: "Irish",
92
+ exampleText: "léigh",
93
+ textPreprocessors: capitalizationPreprocessors
94
+ },
95
+ {
96
+ iso: "grc",
97
+ iso639_3: "grc",
98
+ name: "Ancient Greek",
99
+ exampleText: "γράφω",
100
+ textPreprocessors: {
101
+ ...capitalizationPreprocessors,
102
+ removeAlphabeticDiacritics: require_cjk_util.removeAlphabeticDiacritics
103
+ }
104
+ },
105
+ {
106
+ iso: "he",
107
+ iso639_3: "heb",
108
+ name: "Hebrew",
109
+ exampleText: "קריאה"
110
+ },
111
+ {
112
+ iso: "hi",
113
+ iso639_3: "hin",
114
+ name: "Hindi",
115
+ exampleText: "पढ़ने के लिए"
116
+ },
117
+ {
118
+ iso: "hu",
119
+ iso639_3: "hun",
120
+ name: "Hungarian",
121
+ exampleText: "olvasni",
122
+ textPreprocessors: capitalizationPreprocessors
123
+ },
124
+ {
125
+ iso: "id",
126
+ iso639_3: "ind",
127
+ name: "Indonesian",
128
+ exampleText: "baca",
129
+ textPreprocessors: {
130
+ ...capitalizationPreprocessors,
131
+ removeAlphabeticDiacritics: require_cjk_util.removeAlphabeticDiacritics
132
+ }
133
+ },
134
+ {
135
+ iso: "it",
136
+ iso639_3: "ita",
137
+ name: "Italian",
138
+ exampleText: "leggere",
139
+ textPreprocessors: {
140
+ ...capitalizationPreprocessors,
141
+ removeAlphabeticDiacritics: require_cjk_util.removeAlphabeticDiacritics
142
+ }
143
+ },
144
+ {
145
+ iso: "la",
146
+ iso639_3: "lat",
147
+ name: "Latin",
148
+ exampleText: "legō",
149
+ textPreprocessors: {
150
+ ...capitalizationPreprocessors,
151
+ removeAlphabeticDiacritics: require_cjk_util.removeAlphabeticDiacritics
152
+ }
153
+ },
154
+ {
155
+ iso: "lo",
156
+ iso639_3: "lao",
157
+ name: "Lao",
158
+ exampleText: "ອ່ານ"
159
+ },
160
+ {
161
+ iso: "lv",
162
+ iso639_3: "lav",
163
+ name: "Latvian",
164
+ exampleText: "lasīt",
165
+ textPreprocessors: capitalizationPreprocessors
166
+ },
167
+ {
168
+ iso: "ja",
169
+ iso639_3: "jpn",
170
+ name: "Japanese",
171
+ exampleText: "読め"
172
+ },
173
+ {
174
+ iso: "ka",
175
+ iso639_3: "kat",
176
+ name: "Georgian",
177
+ exampleText: "კითხვა"
178
+ },
179
+ {
180
+ iso: "kn",
181
+ iso639_3: "kan",
182
+ name: "Kannada",
183
+ exampleText: "ಓದು"
184
+ },
185
+ {
186
+ iso: "km",
187
+ iso639_3: "khm",
188
+ name: "Khmer",
189
+ exampleText: "អាន"
190
+ },
191
+ {
192
+ iso: "ko",
193
+ iso639_3: "kor",
194
+ name: "Korean",
195
+ exampleText: "읽어"
196
+ },
197
+ {
198
+ iso: "mn",
199
+ iso639_3: "mon",
200
+ name: "Mongolian",
201
+ exampleText: "унших",
202
+ textPreprocessors: capitalizationPreprocessors
203
+ },
204
+ {
205
+ iso: "mt",
206
+ iso639_3: "mlt",
207
+ name: "Maltese",
208
+ exampleText: "kiteb",
209
+ textPreprocessors: capitalizationPreprocessors
210
+ },
211
+ {
212
+ iso: "nl",
213
+ iso639_3: "nld",
214
+ name: "Dutch",
215
+ exampleText: "lezen",
216
+ textPreprocessors: capitalizationPreprocessors
217
+ },
218
+ {
219
+ iso: "no",
220
+ iso639_3: "nor",
221
+ name: "Norwegian",
222
+ exampleText: "lese",
223
+ textPreprocessors: { ...capitalizationPreprocessors }
224
+ },
225
+ {
226
+ iso: "pl",
227
+ iso639_3: "pol",
228
+ name: "Polish",
229
+ exampleText: "czytać",
230
+ textPreprocessors: capitalizationPreprocessors
231
+ },
232
+ {
233
+ iso: "pt",
234
+ iso639_3: "por",
235
+ name: "Portuguese",
236
+ exampleText: "ler",
237
+ textPreprocessors: capitalizationPreprocessors
238
+ },
239
+ {
240
+ iso: "ro",
241
+ iso639_3: "ron",
242
+ name: "Romanian",
243
+ exampleText: "citi",
244
+ textPreprocessors: {
245
+ ...capitalizationPreprocessors,
246
+ removeAlphabeticDiacritics: require_cjk_util.removeAlphabeticDiacritics
247
+ }
248
+ },
249
+ {
250
+ iso: "ru",
251
+ iso639_3: "rus",
252
+ name: "Russian",
253
+ exampleText: "читать",
254
+ textPreprocessors: { ...capitalizationPreprocessors }
255
+ },
256
+ {
257
+ iso: "sga",
258
+ iso639_3: "sga",
259
+ name: "Old Irish",
260
+ exampleText: "légaid",
261
+ textPreprocessors: {
262
+ ...capitalizationPreprocessors,
263
+ removeAlphabeticDiacritics: require_cjk_util.removeAlphabeticDiacritics
264
+ }
265
+ },
266
+ {
267
+ iso: "sh",
268
+ iso639_3: "hbs",
269
+ name: "Serbo-Croatian",
270
+ exampleText: "čìtati",
271
+ textPreprocessors: { ...capitalizationPreprocessors }
272
+ },
273
+ {
274
+ iso: "sq",
275
+ iso639_3: "sqi",
276
+ name: "Albanian",
277
+ exampleText: "ndihmoj",
278
+ textPreprocessors: capitalizationPreprocessors
279
+ },
280
+ {
281
+ iso: "sv",
282
+ iso639_3: "swe",
283
+ name: "Swedish",
284
+ exampleText: "läsa",
285
+ textPreprocessors: capitalizationPreprocessors
286
+ },
287
+ {
288
+ iso: "th",
289
+ iso639_3: "tha",
290
+ name: "Thai",
291
+ exampleText: "อ่าน"
292
+ },
293
+ {
294
+ iso: "tl",
295
+ iso639_3: "tgl",
296
+ name: "Tagalog",
297
+ exampleText: "basahin",
298
+ textPreprocessors: {
299
+ ...capitalizationPreprocessors,
300
+ removeAlphabeticDiacritics: require_cjk_util.removeAlphabeticDiacritics
301
+ }
302
+ },
303
+ {
304
+ iso: "tr",
305
+ iso639_3: "tur",
306
+ name: "Turkish",
307
+ exampleText: "okumak",
308
+ textPreprocessors: capitalizationPreprocessors
309
+ },
310
+ {
311
+ iso: "tok",
312
+ iso639_3: "tok",
313
+ name: "Toki Pona",
314
+ exampleText: "wile",
315
+ textPreprocessors: capitalizationPreprocessors
316
+ },
317
+ {
318
+ iso: "uk",
319
+ iso639_3: "ukr",
320
+ name: "Ukrainian",
321
+ exampleText: "читати",
322
+ textPreprocessors: capitalizationPreprocessors
323
+ },
324
+ {
325
+ iso: "vi",
326
+ iso639_3: "vie",
327
+ name: "Vietnamese",
328
+ exampleText: "đọc",
329
+ textPreprocessors: { ...capitalizationPreprocessors }
330
+ },
331
+ {
332
+ iso: "cy",
333
+ iso639_3: "cym",
334
+ name: "Welsh",
335
+ exampleText: "ddarllen",
336
+ textPreprocessors: capitalizationPreprocessors
337
+ },
338
+ {
339
+ iso: "yi",
340
+ iso639_3: "yid",
341
+ name: "Yiddish",
342
+ exampleText: "באַשאַפֿן"
343
+ },
344
+ {
345
+ iso: "yue",
346
+ iso639_3: "yue",
347
+ name: "Cantonese",
348
+ exampleText: "讀",
349
+ textPreprocessors: { normalizeRadicalCharacters: require_cjk_util.normalizeRadicalCharacters }
350
+ },
351
+ {
352
+ iso: "zh",
353
+ iso639_3: "zho",
354
+ name: "Chinese",
355
+ exampleText: "读",
356
+ textPreprocessors: { normalizeRadicalCharacters: require_cjk_util.normalizeRadicalCharacters }
357
+ }
358
+ ];
359
+ const languageDescriptorMap = new Map();
360
+ for (const languageDescriptor of languageDescriptors) languageDescriptorMap.set(languageDescriptor.iso, languageDescriptor);
361
+
362
+ //#endregion
363
+ //#region src/language/languages.ts
364
+ function getLanguageSummaries() {
365
+ const results = [];
366
+ for (const { name, iso, iso639_3, exampleText } of languageDescriptorMap.values()) results.push({
367
+ name,
368
+ iso,
369
+ iso639_3,
370
+ exampleText
371
+ });
372
+ return results;
373
+ }
374
+ function getAllLanguageReadingNormalizers() {
375
+ const results = [];
376
+ for (const { iso, readingNormalizer } of languageDescriptorMap.values()) {
377
+ if (typeof readingNormalizer === "undefined") continue;
378
+ results.push({
379
+ iso,
380
+ readingNormalizer
381
+ });
382
+ }
383
+ return results;
384
+ }
385
+ function getAllLanguageTextProcessors() {
386
+ const results = [];
387
+ for (const { iso, textPreprocessors = {}, textPostprocessors = {} } of languageDescriptorMap.values()) {
388
+ const textPreprocessorsArray = [];
389
+ for (const [id, textPreprocessor] of Object.entries(textPreprocessors)) textPreprocessorsArray.push({
390
+ id,
391
+ textProcessor: textPreprocessor
392
+ });
393
+ const textPostprocessorsArray = [];
394
+ for (const [id, textPostprocessor] of Object.entries(textPostprocessors)) textPostprocessorsArray.push({
395
+ id,
396
+ textProcessor: textPostprocessor
397
+ });
398
+ results.push({
399
+ iso,
400
+ textPreprocessors: textPreprocessorsArray,
401
+ textPostprocessors: textPostprocessorsArray
402
+ });
403
+ }
404
+ return results;
405
+ }
406
+ function isTextLookupWorthy(text, language) {
407
+ const descriptor = languageDescriptorMap.get(language);
408
+ if (typeof descriptor === "undefined") return false;
409
+ return typeof descriptor.isTextLookupWorthy === "undefined" || descriptor.isTextLookupWorthy(text);
410
+ }
411
+ function getAllLanguageTransformDescriptors() {
412
+ const results = [];
413
+ for (const { iso, languageTransforms } of languageDescriptorMap.values()) if (languageTransforms) results.push({
414
+ iso,
415
+ languageTransforms
416
+ });
417
+ return results;
418
+ }
419
+
420
+ //#endregion
421
+ //#region src/language/language-transformer.ts
422
+ var LanguageTransformer = class LanguageTransformer {
423
+ _nextFlagIndex;
424
+ _transforms;
425
+ _conditionTypeToConditionFlagsMap;
426
+ _partOfSpeechToConditionFlagsMap;
427
+ constructor() {
428
+ this._nextFlagIndex = 0;
429
+ this._transforms = [];
430
+ this._conditionTypeToConditionFlagsMap = new Map();
431
+ this._partOfSpeechToConditionFlagsMap = new Map();
432
+ }
433
+ clear() {
434
+ this._nextFlagIndex = 0;
435
+ this._transforms = [];
436
+ this._conditionTypeToConditionFlagsMap.clear();
437
+ this._partOfSpeechToConditionFlagsMap.clear();
438
+ }
439
+ addDescriptor(descriptor) {
440
+ const { conditions, transforms } = descriptor;
441
+ const conditionEntries = Object.entries(conditions);
442
+ const { conditionFlagsMap, nextFlagIndex } = this._getConditionFlagsMap(conditionEntries, this._nextFlagIndex);
443
+ const transforms2 = [];
444
+ for (const [transformId, transform] of Object.entries(transforms)) {
445
+ const { name, description, rules } = transform;
446
+ const rules2 = [];
447
+ for (let j = 0, jj = rules.length; j < jj; ++j) {
448
+ const { type, isInflected, deinflect, conditionsIn, conditionsOut } = rules[j];
449
+ const conditionFlagsIn = this._getConditionFlagsStrict(conditionFlagsMap, conditionsIn);
450
+ if (conditionFlagsIn === null) throw new Error(`Invalid conditionsIn for transform ${transformId}.rules[${j}]`);
451
+ const conditionFlagsOut = this._getConditionFlagsStrict(conditionFlagsMap, conditionsOut);
452
+ if (conditionFlagsOut === null) throw new Error(`Invalid conditionsOut for transform ${transformId}.rules[${j}]`);
453
+ rules2.push({
454
+ type,
455
+ isInflected,
456
+ deinflect,
457
+ conditionsIn: conditionFlagsIn,
458
+ conditionsOut: conditionFlagsOut
459
+ });
460
+ }
461
+ const isInflectedTests = rules.map((rule) => rule.isInflected);
462
+ const heuristic = new RegExp(isInflectedTests.map((regExp) => regExp.source).join("|"));
463
+ transforms2.push({
464
+ id: transformId,
465
+ name,
466
+ description,
467
+ rules: rules2,
468
+ heuristic
469
+ });
470
+ }
471
+ this._nextFlagIndex = nextFlagIndex;
472
+ for (const transform of transforms2) this._transforms.push(transform);
473
+ for (const [type, { isDictionaryForm }] of conditionEntries) {
474
+ const flags = conditionFlagsMap.get(type);
475
+ if (typeof flags === "undefined") continue;
476
+ this._conditionTypeToConditionFlagsMap.set(type, flags);
477
+ if (isDictionaryForm) this._partOfSpeechToConditionFlagsMap.set(type, flags);
478
+ }
479
+ }
480
+ getConditionFlagsFromPartsOfSpeech(partsOfSpeech) {
481
+ return this._getConditionFlags(this._partOfSpeechToConditionFlagsMap, partsOfSpeech);
482
+ }
483
+ getConditionFlagsFromConditionTypes(conditionTypes) {
484
+ return this._getConditionFlags(this._conditionTypeToConditionFlagsMap, conditionTypes);
485
+ }
486
+ getConditionFlagsFromConditionType(conditionType) {
487
+ return this._getConditionFlags(this._conditionTypeToConditionFlagsMap, [conditionType]);
488
+ }
489
+ transform(sourceText) {
490
+ const results = [LanguageTransformer.createTransformedText(sourceText, 0, [])];
491
+ for (let i = 0; i < results.length; ++i) {
492
+ const { text, conditions, trace } = results[i];
493
+ for (const transform of this._transforms) {
494
+ if (!transform.heuristic.test(text)) continue;
495
+ const { id, rules } = transform;
496
+ for (let j = 0, jj = rules.length; j < jj; ++j) {
497
+ const rule = rules[j];
498
+ if (!LanguageTransformer.conditionsMatch(conditions, rule.conditionsIn)) continue;
499
+ const { isInflected, deinflect } = rule;
500
+ if (!isInflected.test(text)) continue;
501
+ const isCycle = trace.some((frame) => frame.transform === id && frame.ruleIndex === j && frame.text === text);
502
+ if (isCycle) {
503
+ require_log.log.warn(new Error(`Cycle detected in transform[${id}] rule[${j}] for text: ${text}\nTrace: ${JSON.stringify(trace)}`));
504
+ continue;
505
+ }
506
+ results.push(LanguageTransformer.createTransformedText(deinflect(text), rule.conditionsOut, this._extendTrace(trace, {
507
+ transform: id,
508
+ ruleIndex: j,
509
+ text
510
+ })));
511
+ }
512
+ }
513
+ }
514
+ return results;
515
+ }
516
+ getUserFacingInflectionRules(inflectionRules) {
517
+ return inflectionRules.map((rule) => {
518
+ const fullRule = this._transforms.find((transform) => transform.id === rule);
519
+ if (typeof fullRule === "undefined") return { name: rule };
520
+ const { name, description } = fullRule;
521
+ return description ? {
522
+ name,
523
+ description
524
+ } : { name };
525
+ });
526
+ }
527
+ static createTransformedText(text, conditions, trace) {
528
+ return {
529
+ text,
530
+ conditions,
531
+ trace
532
+ };
533
+ }
534
+ static conditionsMatch(currentConditions, nextConditions) {
535
+ return currentConditions === 0 || (currentConditions & nextConditions) !== 0;
536
+ }
537
+ _getConditionFlagsMap(conditions, nextFlagIndex) {
538
+ const conditionFlagsMap = new Map();
539
+ let targets = conditions;
540
+ while (targets.length > 0) {
541
+ const nextTargets = [];
542
+ for (const target of targets) {
543
+ const [type, condition] = target;
544
+ const { subConditions } = condition;
545
+ let flags = 0;
546
+ if (typeof subConditions === "undefined") {
547
+ if (nextFlagIndex >= 32) throw new Error("Maximum number of conditions was exceeded");
548
+ flags = 1 << nextFlagIndex;
549
+ ++nextFlagIndex;
550
+ } else {
551
+ const multiFlags = this._getConditionFlagsStrict(conditionFlagsMap, subConditions);
552
+ if (multiFlags === null) {
553
+ nextTargets.push(target);
554
+ continue;
555
+ }
556
+ flags = multiFlags;
557
+ }
558
+ conditionFlagsMap.set(type, flags);
559
+ }
560
+ if (nextTargets.length === targets.length) throw new Error("Maximum number of conditions was exceeded");
561
+ targets = nextTargets;
562
+ }
563
+ return {
564
+ conditionFlagsMap,
565
+ nextFlagIndex
566
+ };
567
+ }
568
+ _getConditionFlagsStrict(conditionFlagsMap, conditionTypes) {
569
+ let flags = 0;
570
+ for (const conditionType of conditionTypes) {
571
+ const flags2 = conditionFlagsMap.get(conditionType);
572
+ if (typeof flags2 === "undefined") return null;
573
+ flags |= flags2;
574
+ }
575
+ return flags;
576
+ }
577
+ _getConditionFlags(conditionFlagsMap, conditionTypes) {
578
+ let flags = 0;
579
+ for (const conditionType of conditionTypes) {
580
+ let flags2 = conditionFlagsMap.get(conditionType);
581
+ if (typeof flags2 === "undefined") flags2 = 0;
582
+ flags |= flags2;
583
+ }
584
+ return flags;
585
+ }
586
+ _extendTrace(trace, newFrame) {
587
+ const newTrace = [newFrame];
588
+ for (const { transform, ruleIndex, text } of trace) newTrace.push({
589
+ transform,
590
+ ruleIndex,
591
+ text
592
+ });
593
+ return newTrace;
594
+ }
595
+ };
596
+
597
+ //#endregion
598
+ //#region src/language/multi-language-transformer.ts
599
+ var MultiLanguageTransformer = class {
600
+ _languageTransformers;
601
+ constructor() {
602
+ this._languageTransformers = new Map();
603
+ }
604
+ prepare() {
605
+ const languagesWithTransforms = getAllLanguageTransformDescriptors();
606
+ for (const { languageTransforms: descriptor } of languagesWithTransforms) {
607
+ const languageTransformer = new LanguageTransformer();
608
+ languageTransformer.addDescriptor(descriptor);
609
+ this._languageTransformers.set(descriptor.language, languageTransformer);
610
+ }
611
+ }
612
+ getConditionFlagsFromPartsOfSpeech(language, partsOfSpeech) {
613
+ const languageTransformer = this._languageTransformers.get(language);
614
+ return typeof languageTransformer !== "undefined" ? languageTransformer.getConditionFlagsFromPartsOfSpeech(partsOfSpeech) : 0;
615
+ }
616
+ getConditionFlagsFromConditionTypes(language, conditionTypes) {
617
+ const languageTransformer = this._languageTransformers.get(language);
618
+ return typeof languageTransformer !== "undefined" ? languageTransformer.getConditionFlagsFromConditionTypes(conditionTypes) : 0;
619
+ }
620
+ getConditionFlagsFromConditionType(language, conditionType) {
621
+ const languageTransformer = this._languageTransformers.get(language);
622
+ return typeof languageTransformer !== "undefined" ? languageTransformer.getConditionFlagsFromConditionType(conditionType) : 0;
623
+ }
624
+ transform(language, sourceText) {
625
+ const languageTransformer = this._languageTransformers.get(language);
626
+ if (typeof languageTransformer === "undefined") return [LanguageTransformer.createTransformedText(sourceText, 0, [])];
627
+ return languageTransformer.transform(sourceText);
628
+ }
629
+ getUserFacingInflectionRules(language, inflectionRules) {
630
+ const languageTransformer = this._languageTransformers.get(language);
631
+ if (typeof languageTransformer === "undefined") return inflectionRules.map((rule) => ({ name: rule }));
632
+ return languageTransformer.getUserFacingInflectionRules(inflectionRules);
633
+ }
634
+ };
635
+
636
+ //#endregion
637
+ Object.defineProperty(exports, 'LanguageTransformer', {
638
+ enumerable: true,
639
+ get: function () {
640
+ return LanguageTransformer;
641
+ }
642
+ });
643
+ Object.defineProperty(exports, 'MultiLanguageTransformer', {
644
+ enumerable: true,
645
+ get: function () {
646
+ return MultiLanguageTransformer;
647
+ }
648
+ });
649
+ Object.defineProperty(exports, 'getAllLanguageReadingNormalizers', {
650
+ enumerable: true,
651
+ get: function () {
652
+ return getAllLanguageReadingNormalizers;
653
+ }
654
+ });
655
+ Object.defineProperty(exports, 'getAllLanguageTextProcessors', {
656
+ enumerable: true,
657
+ get: function () {
658
+ return getAllLanguageTextProcessors;
659
+ }
660
+ });
661
+ Object.defineProperty(exports, 'getAllLanguageTransformDescriptors', {
662
+ enumerable: true,
663
+ get: function () {
664
+ return getAllLanguageTransformDescriptors;
665
+ }
666
+ });
667
+ Object.defineProperty(exports, 'getLanguageSummaries', {
668
+ enumerable: true,
669
+ get: function () {
670
+ return getLanguageSummaries;
671
+ }
672
+ });
673
+ Object.defineProperty(exports, 'isTextLookupWorthy', {
674
+ enumerable: true,
675
+ get: function () {
676
+ return isTextLookupWorthy;
677
+ }
678
+ });
679
+ Object.defineProperty(exports, 'languageDescriptorMap', {
680
+ enumerable: true,
681
+ get: function () {
682
+ return languageDescriptorMap;
683
+ }
684
+ });
685
+ //# sourceMappingURL=multi-language-transformer-MdbQBBOt.cjs.map