@delali/narsil 0.3.1-next.144 → 0.3.1-next.146
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.
- package/dist/adapters/filesystem.d.ts +1 -1
- package/dist/adapters/filesystem.mjs +101 -13
- package/dist/adapters/gcs.d.ts +49 -0
- package/dist/adapters/gcs.mjs +213 -0
- package/dist/adapters/indexeddb.d.ts +1 -1
- package/dist/adapters/indexeddb.mjs +2 -7
- package/dist/adapters/memory.d.ts +1 -1
- package/dist/adapters/memory.mjs +5 -0
- package/dist/adapters/s3.d.ts +53 -0
- package/dist/adapters/s3.mjs +263 -0
- package/dist/{adapters-BQFQ4PRz.d.ts → adapters-pljAqmrC.d.ts} +33 -0
- package/dist/analysis-change-ZCJNYBJM.mjs +39 -0
- package/dist/{browser/analysis-change-entry-7HR4LWL3.mjs → analysis-change-entry-YN3ELL6C.mjs} +1 -1
- package/dist/browser/{analysis-change-JPV775LR.mjs → analysis-change-M65AZQQG.mjs} +8 -5
- package/dist/{analysis-change-entry-TZTG4AZB.mjs → browser/analysis-change-entry-H3YIOLXZ.mjs} +1 -1
- package/dist/browser/{chunk-VFYMPCOV.mjs → chunk-2JABMB4S.mjs} +10 -6
- package/dist/{chunk-46NZOPHS.mjs → browser/chunk-4DYLCICG.mjs} +2 -2
- package/dist/browser/{chunk-MZI3TEOW.mjs → chunk-4RD3AFSB.mjs} +1 -1
- package/dist/browser/{chunk-WCFCHIBB.mjs → chunk-5V74FFZE.mjs} +2 -2
- package/dist/{chunk-NN33CZRE.mjs → browser/chunk-6OWX3OP2.mjs} +2 -2
- package/dist/browser/chunk-BRWY3JCN.mjs +678 -0
- package/dist/browser/{chunk-5DB2VDGI.mjs → chunk-BVX2MEHA.mjs} +306 -607
- package/dist/browser/{chunk-KTOK275N.mjs → chunk-D6UFGBF5.mjs} +15 -45
- package/dist/browser/{chunk-D33A5VMU.mjs → chunk-IAXZAVYL.mjs} +25 -66
- package/dist/browser/chunk-JNOAKDUM.mjs +31 -0
- package/dist/browser/{chunk-LVY2LI35.mjs → chunk-KAEVGLYN.mjs} +2 -2
- package/dist/browser/{chunk-3ZBJYAS4.mjs → chunk-LURXVCHG.mjs} +1 -1
- package/dist/browser/chunk-MPK76GVS.mjs +63 -0
- package/dist/browser/{chunk-ZEV26AQ6.mjs → chunk-NVEJJP4R.mjs} +1 -1
- package/dist/browser/{chunk-HKX2G6WH.mjs → chunk-ODQP7P3H.mjs} +455 -66
- package/dist/browser/{chunk-35B42UFM.mjs → chunk-PIS7ZAP7.mjs} +12 -25
- package/dist/browser/{chunk-TCLEOZ4P.mjs → chunk-QMNZFFD3.mjs} +4 -3
- package/dist/browser/{chunk-R4WUDZQV.mjs → chunk-SRL47USS.mjs} +2 -2
- package/dist/browser/chunk-TY7L6OXO.mjs +69 -0
- package/dist/browser/{chunk-MVM33ZUL.mjs → chunk-W643QV3L.mjs} +6 -5
- package/dist/browser/chunk-WXLBZJMT.mjs +25 -0
- package/dist/browser/{chunk-MWUK3DA5.mjs → chunk-XILIT5MT.mjs} +8 -8
- package/dist/browser/{cold-module-MJMKNUYJ.mjs → cold-module-A5S6JFDN.mjs} +20 -20
- package/dist/browser/{durability-wiring-SNOWIT6Z.mjs → durability-wiring-W5AVV3RF.mjs} +120 -80
- package/dist/browser/gzip-5S7ROJFJ.mjs +1 -0
- package/dist/browser/import-PTT63AGK.mjs +12 -0
- package/dist/browser/{module-BUFNZMEU.mjs → module-CEKA7MQH.mjs} +13 -10
- package/dist/browser/module-X5PGOE47.mjs +4288 -0
- package/dist/browser/{phrase-module-HGVBO24W.mjs → phrase-module-CNKMUY4U.mjs} +2 -1
- package/dist/browser/pool-DTYSPBMQ.mjs +296 -0
- package/dist/{restore-queue-FEYAC4SB.mjs → browser/restore-queue-DD4LWZK7.mjs} +2 -2
- package/dist/browser/{runtime-VEUH674B.mjs → runtime-D2ULZGCN.mjs} +3 -2
- package/dist/browser/{snapshot-QXBKHJAG.mjs → snapshot-DQ6A4PQP.mjs} +20 -15
- package/dist/browser/{write-WHFBDWQS.mjs → write-MAGRAIEH.mjs} +14 -11
- package/dist/{capabilities-BCdUwK_L.d.ts → capabilities-BT-HLDC8.d.ts} +3 -3
- package/dist/{chunk-O4LJQI4G.mjs → chunk-2HJWQPR6.mjs} +126 -4
- package/dist/{chunk-Z4HFMYNX.mjs → chunk-3BVGJ4JR.mjs} +36 -13
- package/dist/{chunk-ZPWS2SKJ.mjs → chunk-3HV7M5OJ.mjs} +272 -112
- package/dist/{chunk-UIKN2OTQ.mjs → chunk-3MXV3VHR.mjs} +2 -23
- package/dist/{browser/chunk-CCOAOO73.mjs → chunk-3SBJVQLL.mjs} +2 -2
- package/dist/chunk-3TVDTACC.mjs +104 -0
- package/dist/{chunk-YH5OIL7B.mjs → chunk-5QMHMELB.mjs} +6 -1
- package/dist/{chunk-SBMAWTRG.mjs → chunk-5WB2A3XU.mjs} +84 -15
- package/dist/{chunk-NPNK57CA.mjs → chunk-65WCV5JO.mjs} +1 -1
- package/dist/chunk-6BWLDLS3.mjs +58 -0
- package/dist/{chunk-UUZCQQG2.mjs → chunk-6C5EX2QR.mjs} +3 -3
- package/dist/{chunk-VEFN6X6Q.mjs → chunk-6F6USYII.mjs} +120 -13
- package/dist/{chunk-AST3SHFA.mjs → chunk-7HKWO4BJ.mjs} +7 -7
- package/dist/{chunk-W2COJ5AH.mjs → chunk-7N223GWV.mjs} +2 -2
- package/dist/{chunk-GWOS5DYC.mjs → chunk-ADBS5XRI.mjs} +11 -13
- package/dist/{chunk-TNBIK2LQ.mjs → chunk-AWNHDBKV.mjs} +430 -75
- package/dist/{chunk-ZMBFWQXN.mjs → chunk-B2FTZNNF.mjs} +2 -2
- package/dist/chunk-B7XIOAMK.mjs +100 -0
- package/dist/{chunk-W55X2BYN.mjs → chunk-BEZH7VEH.mjs} +1 -1
- package/dist/{chunk-QSK35UC2.mjs → chunk-BTPGQC6Z.mjs} +3 -11
- package/dist/{chunk-LA4WNDHL.mjs → chunk-CYYSZPVV.mjs} +12 -14
- package/dist/{chunk-SRJBFG2T.mjs → chunk-DOY6EG76.mjs} +6 -7
- package/dist/{chunk-6SNBQESJ.mjs → chunk-F22IOCR2.mjs} +10 -6
- package/dist/{chunk-J6YVB2XM.mjs → chunk-IJPK5PGM.mjs} +1 -1
- package/dist/{chunk-L76W3IZJ.mjs → chunk-IRWP524D.mjs} +1 -1
- package/dist/{chunk-XS2VM7UE.mjs → chunk-IZT3G24Q.mjs} +2 -2
- package/dist/{chunk-NOT5QOHU.mjs → chunk-J7M73VY7.mjs} +1 -1
- package/dist/chunk-K5HSUPYS.mjs +11 -0
- package/dist/chunk-KAKQ74LS.mjs +53 -0
- package/dist/{chunk-ZSWHPKGM.mjs → chunk-KYVRZAYP.mjs} +69 -2
- package/dist/{chunk-NRUXBYPH.mjs → chunk-KZ5GQE4Z.mjs} +5 -5
- package/dist/{browser/chunk-XNWPP5NS.mjs → chunk-KZQIVGW7.mjs} +2 -2
- package/dist/{chunk-KZL72VTC.mjs → chunk-L7TIAYPX.mjs} +11 -10
- package/dist/{chunk-DD2673TX.mjs → chunk-LDGGR7YT.mjs} +4 -81
- package/dist/{chunk-XZ3SRNDJ.mjs → chunk-LJ4ENXOD.mjs} +77 -16
- package/dist/chunk-LQG5G2LY.mjs +39 -0
- package/dist/{chunk-HNHCNTVG.mjs → chunk-MDF6PDIA.mjs} +11 -0
- package/dist/{chunk-74XB2SXI.mjs → chunk-NVTFQFUL.mjs} +16 -2
- package/dist/{chunk-BOJZGUS6.mjs → chunk-NYSONUB7.mjs} +1 -1
- package/dist/{chunk-WJGO5PGV.mjs → chunk-O4KUNDVF.mjs} +31 -17
- package/dist/{chunk-PWIWSUCX.mjs → chunk-POUYICOU.mjs} +1 -1
- package/dist/{chunk-EBIHRL7B.mjs → chunk-Q2UL2TPC.mjs} +1 -1
- package/dist/{chunk-NJJCPFXN.mjs → chunk-QEYF2SQ6.mjs} +2 -2
- package/dist/{chunk-7AUASRE7.mjs → chunk-QN5WVV5K.mjs} +7 -7
- package/dist/{chunk-RIIUZJQ3.mjs → chunk-QYRNLLLI.mjs} +1 -1
- package/dist/chunk-SOUZMPME.mjs +1635 -0
- package/dist/{chunk-C3YDYX6C.mjs → chunk-T4CJDBBE.mjs} +1 -1
- package/dist/{chunk-YLNSJQLX.mjs → chunk-TTCKT2RT.mjs} +5 -5
- package/dist/{chunk-KEIYVZUX.mjs → chunk-U2726TL5.mjs} +5 -5
- package/dist/{chunk-RKAVHNRW.mjs → chunk-U46IZNCW.mjs} +10 -5
- package/dist/{chunk-BRUUBXCB.mjs → chunk-U6NE6RCV.mjs} +10 -38
- package/dist/{chunk-VJEGOELZ.mjs → chunk-VP6XRMWR.mjs} +4 -4
- package/dist/{chunk-IO5F7ZBE.mjs → chunk-VQDZVWN3.mjs} +874 -413
- package/dist/{chunk-IWVEG5CX.mjs → chunk-XIHUI4KB.mjs} +2 -2
- package/dist/{chunk-YHUTF6EA.mjs → chunk-XKPNKR3V.mjs} +17 -47
- package/dist/{chunk-HJJWY6PT.mjs → chunk-YGQOPB2Z.mjs} +1 -1
- package/dist/chunk-YKEHQUSZ.mjs +248 -0
- package/dist/{chunk-GLZHNSGB.mjs → chunk-ZAYWOHVG.mjs} +1 -1
- package/dist/{chunk-ICW45TTU.mjs → chunk-ZEKDO7YX.mjs} +2 -2
- package/dist/chunk-ZXNNR73R.mjs +31 -0
- package/dist/{chunk-VJS4JFBQ.mjs → chunk-ZXX5GZEX.mjs} +3 -1
- package/dist/{chunk-RHKRTYGO.mjs → chunk-ZYKUD5NX.mjs} +9 -7
- package/dist/{client-B12YFALP.d.ts → client-Cn3gNxUU.d.ts} +62 -5
- package/dist/client.d.ts +8 -8
- package/dist/client.mjs +46 -0
- package/dist/{cold-module-4X7WJCFM.mjs → cold-module-2WWGBFJC.mjs} +43 -49
- package/dist/{config-CIG5yDyg.d.ts → config-CfhH1IWQ.d.ts} +150 -3
- package/dist/{config-BhZxIeb1.d.ts → config-aIsy7mcL.d.ts} +63 -3
- package/dist/direct-executor-QLVHMELJ.mjs +24 -0
- package/dist/distribution/coordinator/etcd.d.ts +3 -3
- package/dist/distribution/coordinator/etcd.mjs +1 -1
- package/dist/distribution/coordinator/in-memory.d.ts +3 -3
- package/dist/distribution/transport/grpc.mjs +4 -4
- package/dist/distribution/transport/in-memory.mjs +2 -2
- package/dist/distribution/transport/tcp.mjs +3 -3
- package/dist/distribution.d.ts +8 -8
- package/dist/distribution.mjs +16116 -14537
- package/dist/{durability-wiring-324D2DDD.mjs → durability-wiring-GNWQSZI3.mjs} +142 -109
- package/dist/embeddings/openai.d.ts +1 -1
- package/dist/embeddings/openai.mjs +2 -2
- package/dist/{engine-CtzbHOmG.d.ts → engine-CJRUHXgf.d.ts} +3 -3
- package/dist/gzip-F4HMIEEQ.mjs +1 -0
- package/dist/import-DX55PN4G.mjs +41 -0
- package/dist/{index-DsEurhSl.d.ts → index-MsF7e5hL.d.ts} +2 -2
- package/dist/index.browser.mjs +7 -4
- package/dist/index.d.ts +542 -8
- package/dist/index.mjs +29 -32
- package/dist/index.react-native.mjs +19 -0
- package/dist/invalidation/broadcast-channel.d.ts +1 -1
- package/dist/invalidation/filesystem.d.ts +1 -1
- package/dist/invalidation/filesystem.mjs +1 -1
- package/dist/invalidation/noop.d.ts +1 -1
- package/dist/{long-query-thread-4SW7RWDE.mjs → long-query-thread-SCUE62TO.mjs} +23 -25
- package/dist/{module-DXSJ5LT2.mjs → module-HW6IXUM6.mjs} +603 -112
- package/dist/module-V5K4ZP23.mjs +45 -0
- package/dist/{paged-partition-archive-HFP45PLU.mjs → paged-partition-archive-FDIIWZNR.mjs} +42 -41
- package/dist/partial-words.mjs +7 -9
- package/dist/pattern.mjs +4 -6
- package/dist/persistence/durability/checkpoint-worker.d.ts +2 -2
- package/dist/persistence/durability/checkpoint-worker.mjs +36 -39
- package/dist/{phrase-module-5QHBD2VJ.mjs → phrase-module-OUQIRUQU.mjs} +1 -1
- package/dist/pool-UPV5PVPY.mjs +298 -0
- package/dist/react-native/chunks/analysis-change-HGW3L6NY.mjs +893 -0
- package/dist/react-native/chunks/analysis-change-entry-BNRU6STO.mjs +1 -0
- package/dist/react-native/chunks/chunk-2J2727V4.mjs +495 -0
- package/dist/react-native/chunks/chunk-3CTWSQRW.mjs +1251 -0
- package/dist/react-native/chunks/chunk-5FV4ZEVA.mjs +2619 -0
- package/dist/react-native/chunks/chunk-7VWQLEFV.mjs +642 -0
- package/dist/react-native/chunks/chunk-AAAETEJK.mjs +27 -0
- package/dist/react-native/chunks/chunk-AM7RSBPF.mjs +32 -0
- package/dist/react-native/chunks/chunk-B6OD63Z3.mjs +997 -0
- package/dist/react-native/chunks/chunk-BRNAVOKP.mjs +177 -0
- package/dist/react-native/chunks/chunk-DKJTZ625.mjs +207 -0
- package/dist/react-native/chunks/chunk-FKGG4UOF.mjs +177 -0
- package/dist/{browser/chunk-6RHTAVZX.mjs → react-native/chunks/chunk-GV5KFQ6M.mjs} +38 -15
- package/dist/react-native/chunks/chunk-HURV3ASY.mjs +4416 -0
- package/dist/react-native/chunks/chunk-IO2SMUQD.mjs +10 -0
- package/dist/react-native/chunks/chunk-JV6VQY2S.mjs +17 -0
- package/dist/react-native/chunks/chunk-KUJOBRKS.mjs +217 -0
- package/dist/react-native/chunks/chunk-KWRW5U65.mjs +226 -0
- package/dist/react-native/chunks/chunk-L4M7QJNP.mjs +110 -0
- package/dist/react-native/chunks/chunk-LQ6Q4L5B.mjs +360 -0
- package/dist/react-native/chunks/chunk-LQAKO5QV.mjs +523 -0
- package/dist/react-native/chunks/chunk-LRGWK367.mjs +11 -0
- package/dist/react-native/chunks/chunk-LVIKKAA6.mjs +93 -0
- package/dist/react-native/chunks/chunk-NFGBOI46.mjs +14 -0
- package/dist/react-native/chunks/chunk-NNE4VDMM.mjs +8 -0
- package/dist/react-native/chunks/chunk-PPEPTUVV.mjs +56 -0
- package/dist/react-native/chunks/chunk-PSWKQVVT.mjs +9 -0
- package/dist/{chunk-KGOXHLLZ.mjs → react-native/chunks/chunk-PU55IOG4.mjs} +228 -11
- package/dist/react-native/chunks/chunk-QC4ZRBSX.mjs +270 -0
- package/dist/react-native/chunks/chunk-R4EEMYM6.mjs +21 -0
- package/dist/react-native/chunks/chunk-R4OPUZQ5.mjs +86 -0
- package/dist/react-native/chunks/chunk-SLGIAD6B.mjs +2634 -0
- package/dist/react-native/chunks/chunk-TJMSKBEM.mjs +25 -0
- package/dist/react-native/chunks/chunk-TLYD7IJ2.mjs +23 -0
- package/dist/react-native/chunks/chunk-UFNCLEQM.mjs +73 -0
- package/dist/react-native/chunks/chunk-YH7W556M.mjs +179 -0
- package/dist/react-native/chunks/chunk-YJSMEKRE.mjs +22385 -0
- package/dist/react-native/chunks/chunk-ZCKNBPQ4.mjs +79 -0
- package/dist/react-native/chunks/cold-module-TSFWLYWC.mjs +755 -0
- package/dist/react-native/chunks/durability-wiring-PZR6KOQK.mjs +4509 -0
- package/dist/react-native/chunks/gzip.react-native-7JWCLVOB.mjs +3 -0
- package/dist/react-native/chunks/import-VTODLPLO.mjs +22 -0
- package/dist/{browser/module-BVP4TKZU.mjs → react-native/chunks/module-JBBH6PZH.mjs} +671 -146
- package/dist/react-native/chunks/module-VEK2KCKU.mjs +25 -0
- package/dist/react-native/chunks/phrase-module-76UAPPSG.mjs +329 -0
- package/dist/react-native/chunks/pool-CD4ANYUI.mjs +296 -0
- package/dist/react-native/chunks/release-D7ZTIANM.mjs +33 -0
- package/dist/react-native/chunks/replace-IMZUVUOE.mjs +57 -0
- package/dist/{browser/restore-queue-ONYNYUDE.mjs → react-native/chunks/restore-queue-OI5EH7R3.mjs} +2 -2
- package/dist/react-native/chunks/runtime-3MCDLJAF.mjs +559 -0
- package/dist/react-native/chunks/snapshot-AUZMEV36.mjs +1205 -0
- package/dist/react-native/chunks/write-DDC2QBRJ.mjs +197 -0
- package/dist/{chunk-DQNKVOJ2.mjs → react-native/partial-words.mjs} +13 -228
- package/dist/react-native/pattern.mjs +2442 -0
- package/dist/react-native/synonyms.mjs +460 -0
- package/dist/react.d.ts +11 -11
- package/dist/react.mjs +11 -0
- package/dist/{rerank-KTLC3E6N.mjs → rerank-3W54N6P2.mjs} +4 -4
- package/dist/rerankers/http.d.ts +1 -1
- package/dist/rerankers/http.mjs +2 -2
- package/dist/restore-queue-BQWWNNQI.mjs +41 -0
- package/dist/{runtime-DYV75DCB.mjs → runtime-L2DZYY6N.mjs} +5 -5
- package/dist/{schema-B-Runv0n.d.ts → schema-D33CyXCy.d.ts} +1 -1
- package/dist/server.d.ts +24 -12
- package/dist/server.mjs +159 -38
- package/dist/{snapshot-CGM65VCD.mjs → snapshot-EHXTOTW5.mjs} +47 -50
- package/dist/synonyms.mjs +3 -4
- package/dist/{tasks-CjRJRGTb.d.ts → tasks-C4ElXr4P.d.ts} +59 -7
- package/dist/thread-I7DVHHW7.mjs +31 -0
- package/dist/vector/search-worker.d.ts +2 -2
- package/dist/vector/search-worker.mjs +8 -7
- package/dist/workers/entry.mjs +9 -9
- package/dist/{write-2DZPEQL2.mjs → write-SDJXXQ2G.mjs} +36 -39
- package/openapi.json +349 -2
- package/package.json +108 -8
- package/dist/analysis-change-HQUT2Z3I.mjs +0 -43
- package/dist/browser/import-TLB2A5LJ.mjs +0 -9
- package/dist/chunk-5WYVUPGD.mjs +0 -427
- package/dist/chunk-AV4IJKD2.mjs +0 -35
- package/dist/chunk-GES7U2PM.mjs +0 -68
- package/dist/chunk-N37VMC62.mjs +0 -18
- package/dist/chunk-WNBRW4Q2.mjs +0 -128
- package/dist/chunk-WQBCBKY3.mjs +0 -8
- package/dist/chunk-ZATRDAYU.mjs +0 -160
- package/dist/direct-executor-7XOQ7VQP.mjs +0 -28
- package/dist/import-OOBUW3RR.mjs +0 -44
- package/dist/module-IYPLWHGC.mjs +0 -48
- package/dist/thread-KGNAIKPD.mjs +0 -33
- /package/dist/{chunk-22YPZVMG.mjs → chunk-ZXNQEW43.mjs} +0 -0
|
@@ -0,0 +1,1251 @@
|
|
|
1
|
+
import { NarsilError, ErrorCodes } from './chunk-YH7W556M.mjs';
|
|
2
|
+
|
|
3
|
+
// src/analysis/registry.ts
|
|
4
|
+
var tokenizers = /* @__PURE__ */ new Map();
|
|
5
|
+
var stopWordSets = /* @__PURE__ */ new Map();
|
|
6
|
+
function requireName(name, kind) {
|
|
7
|
+
if (typeof name !== "string" || name.trim().length === 0) {
|
|
8
|
+
throw new NarsilError(ErrorCodes.CONFIG_INVALID, `A registered ${kind} needs a non-empty name`, { name });
|
|
9
|
+
}
|
|
10
|
+
}
|
|
11
|
+
function registerTokenizer(name, tokenizer) {
|
|
12
|
+
requireName(name, "tokenizer");
|
|
13
|
+
if (typeof tokenizer?.tokenize !== "function") {
|
|
14
|
+
throw new NarsilError(ErrorCodes.CONFIG_INVALID, `Tokenizer "${name}" needs a tokenize method`, { tokenizer: name });
|
|
15
|
+
}
|
|
16
|
+
tokenizers.set(name, tokenizer);
|
|
17
|
+
}
|
|
18
|
+
function registerStopWords(name, stopWords2) {
|
|
19
|
+
requireName(name, "stop word set");
|
|
20
|
+
if (!(stopWords2 instanceof Set) && typeof stopWords2 !== "function") {
|
|
21
|
+
throw new NarsilError(
|
|
22
|
+
ErrorCodes.CONFIG_INVALID,
|
|
23
|
+
`Stop word set "${name}" needs a Set of words or a function returning one`,
|
|
24
|
+
{ stopWords: name }
|
|
25
|
+
);
|
|
26
|
+
}
|
|
27
|
+
stopWordSets.set(name, stopWords2);
|
|
28
|
+
}
|
|
29
|
+
function hasTokenizer(name) {
|
|
30
|
+
return tokenizers.has(name);
|
|
31
|
+
}
|
|
32
|
+
function hasStopWords(name) {
|
|
33
|
+
return stopWordSets.has(name);
|
|
34
|
+
}
|
|
35
|
+
function getTokenizer(name) {
|
|
36
|
+
const tokenizer = tokenizers.get(name);
|
|
37
|
+
if (!tokenizer) {
|
|
38
|
+
throw new NarsilError(ErrorCodes.CONFIG_INVALID, `Tokenizer "${name}" is not registered on this engine`, {
|
|
39
|
+
tokenizer: name,
|
|
40
|
+
available: [...tokenizers.keys()]
|
|
41
|
+
});
|
|
42
|
+
}
|
|
43
|
+
return tokenizer;
|
|
44
|
+
}
|
|
45
|
+
function getStopWords(name) {
|
|
46
|
+
const stopWords2 = stopWordSets.get(name);
|
|
47
|
+
if (!stopWords2) {
|
|
48
|
+
throw new NarsilError(ErrorCodes.CONFIG_INVALID, `Stop word set "${name}" is not registered on this engine`, {
|
|
49
|
+
stopWords: name,
|
|
50
|
+
available: [...stopWordSets.keys()]
|
|
51
|
+
});
|
|
52
|
+
}
|
|
53
|
+
return stopWords2;
|
|
54
|
+
}
|
|
55
|
+
function holdsPositionsOutOfOrder(entries) {
|
|
56
|
+
for (let index = 1; index < entries.length; index++) {
|
|
57
|
+
if (entries[index].position < entries[index - 1].position) return true;
|
|
58
|
+
}
|
|
59
|
+
return false;
|
|
60
|
+
}
|
|
61
|
+
function inPositionOrder(tokenizer) {
|
|
62
|
+
return {
|
|
63
|
+
tokenize(text) {
|
|
64
|
+
const entries = tokenizer.tokenize(text);
|
|
65
|
+
if (!holdsPositionsOutOfOrder(entries)) return entries;
|
|
66
|
+
return [...entries].sort((first, second) => first.position - second.position);
|
|
67
|
+
}
|
|
68
|
+
};
|
|
69
|
+
}
|
|
70
|
+
function resolveIndexAnalysis(config) {
|
|
71
|
+
const tokenizer = typeof config.tokenizer === "string" ? getTokenizer(config.tokenizer) : config.tokenizer;
|
|
72
|
+
return {
|
|
73
|
+
stopWords: typeof config.stopWords === "string" ? getStopWords(config.stopWords) : config.stopWords,
|
|
74
|
+
customTokenizer: tokenizer === void 0 ? void 0 : inPositionOrder(tokenizer)
|
|
75
|
+
};
|
|
76
|
+
}
|
|
77
|
+
|
|
78
|
+
// src/languages/snowball/base-stemmer.ts
|
|
79
|
+
var BaseStemmer = class {
|
|
80
|
+
current = "";
|
|
81
|
+
c = 0;
|
|
82
|
+
limit = 0;
|
|
83
|
+
limit_backward = 0;
|
|
84
|
+
bra = 0;
|
|
85
|
+
ket = 0;
|
|
86
|
+
af = 0;
|
|
87
|
+
setCurrent(value) {
|
|
88
|
+
this.current = value;
|
|
89
|
+
this.c = 0;
|
|
90
|
+
this.limit = this.current.length;
|
|
91
|
+
this.limit_backward = 0;
|
|
92
|
+
this.bra = 0;
|
|
93
|
+
this.ket = 0;
|
|
94
|
+
}
|
|
95
|
+
getCurrent() {
|
|
96
|
+
return this.current;
|
|
97
|
+
}
|
|
98
|
+
in_grouping(s, min, max) {
|
|
99
|
+
if (this.c >= this.limit) return false;
|
|
100
|
+
let ch = this.current.charCodeAt(this.c);
|
|
101
|
+
if (ch > max || ch < min) return false;
|
|
102
|
+
ch -= min;
|
|
103
|
+
if ((s[ch >>> 3] & 1 << (ch & 7)) === 0) return false;
|
|
104
|
+
this.c++;
|
|
105
|
+
return true;
|
|
106
|
+
}
|
|
107
|
+
go_in_grouping(s, min, max) {
|
|
108
|
+
while (this.c < this.limit) {
|
|
109
|
+
let ch = this.current.charCodeAt(this.c);
|
|
110
|
+
if (ch > max || ch < min) return true;
|
|
111
|
+
ch -= min;
|
|
112
|
+
if ((s[ch >>> 3] & 1 << (ch & 7)) === 0) return true;
|
|
113
|
+
this.c++;
|
|
114
|
+
}
|
|
115
|
+
return false;
|
|
116
|
+
}
|
|
117
|
+
in_grouping_b(s, min, max) {
|
|
118
|
+
if (this.c <= this.limit_backward) return false;
|
|
119
|
+
let ch = this.current.charCodeAt(this.c - 1);
|
|
120
|
+
if (ch > max || ch < min) return false;
|
|
121
|
+
ch -= min;
|
|
122
|
+
if ((s[ch >>> 3] & 1 << (ch & 7)) === 0) return false;
|
|
123
|
+
this.c--;
|
|
124
|
+
return true;
|
|
125
|
+
}
|
|
126
|
+
go_in_grouping_b(s, min, max) {
|
|
127
|
+
while (this.c > this.limit_backward) {
|
|
128
|
+
let ch = this.current.charCodeAt(this.c - 1);
|
|
129
|
+
if (ch > max || ch < min) return true;
|
|
130
|
+
ch -= min;
|
|
131
|
+
if ((s[ch >>> 3] & 1 << (ch & 7)) === 0) return true;
|
|
132
|
+
this.c--;
|
|
133
|
+
}
|
|
134
|
+
return false;
|
|
135
|
+
}
|
|
136
|
+
out_grouping(s, min, max) {
|
|
137
|
+
if (this.c >= this.limit) return false;
|
|
138
|
+
let ch = this.current.charCodeAt(this.c);
|
|
139
|
+
if (ch > max || ch < min) {
|
|
140
|
+
this.c++;
|
|
141
|
+
return true;
|
|
142
|
+
}
|
|
143
|
+
ch -= min;
|
|
144
|
+
if ((s[ch >>> 3] & 1 << (ch & 7)) === 0) {
|
|
145
|
+
this.c++;
|
|
146
|
+
return true;
|
|
147
|
+
}
|
|
148
|
+
return false;
|
|
149
|
+
}
|
|
150
|
+
go_out_grouping(s, min, max) {
|
|
151
|
+
while (this.c < this.limit) {
|
|
152
|
+
let ch = this.current.charCodeAt(this.c);
|
|
153
|
+
if (ch <= max && ch >= min) {
|
|
154
|
+
ch -= min;
|
|
155
|
+
if ((s[ch >>> 3] & 1 << (ch & 7)) !== 0) return true;
|
|
156
|
+
}
|
|
157
|
+
this.c++;
|
|
158
|
+
}
|
|
159
|
+
return false;
|
|
160
|
+
}
|
|
161
|
+
out_grouping_b(s, min, max) {
|
|
162
|
+
if (this.c <= this.limit_backward) return false;
|
|
163
|
+
let ch = this.current.charCodeAt(this.c - 1);
|
|
164
|
+
if (ch > max || ch < min) {
|
|
165
|
+
this.c--;
|
|
166
|
+
return true;
|
|
167
|
+
}
|
|
168
|
+
ch -= min;
|
|
169
|
+
if ((s[ch >>> 3] & 1 << (ch & 7)) === 0) {
|
|
170
|
+
this.c--;
|
|
171
|
+
return true;
|
|
172
|
+
}
|
|
173
|
+
return false;
|
|
174
|
+
}
|
|
175
|
+
go_out_grouping_b(s, min, max) {
|
|
176
|
+
while (this.c > this.limit_backward) {
|
|
177
|
+
let ch = this.current.charCodeAt(this.c - 1);
|
|
178
|
+
if (ch <= max && ch >= min) {
|
|
179
|
+
ch -= min;
|
|
180
|
+
if ((s[ch >>> 3] & 1 << (ch & 7)) !== 0) return true;
|
|
181
|
+
}
|
|
182
|
+
this.c--;
|
|
183
|
+
}
|
|
184
|
+
return false;
|
|
185
|
+
}
|
|
186
|
+
eq_s(s) {
|
|
187
|
+
if (this.limit - this.c < s.length) return false;
|
|
188
|
+
if (!this.current.startsWith(s, this.c)) return false;
|
|
189
|
+
this.c += s.length;
|
|
190
|
+
return true;
|
|
191
|
+
}
|
|
192
|
+
eq_s_b(s) {
|
|
193
|
+
if (this.c - this.limit_backward < s.length) return false;
|
|
194
|
+
if (!this.current.endsWith(s, this.c)) return false;
|
|
195
|
+
this.c -= s.length;
|
|
196
|
+
return true;
|
|
197
|
+
}
|
|
198
|
+
find_among(v, call_among_func) {
|
|
199
|
+
let i = 0;
|
|
200
|
+
let j = v.length;
|
|
201
|
+
const c = this.c;
|
|
202
|
+
const l = this.limit;
|
|
203
|
+
let common_i = 0;
|
|
204
|
+
let common_j = 0;
|
|
205
|
+
let first_key_inspected = false;
|
|
206
|
+
while (true) {
|
|
207
|
+
const k = i + (j - i >>> 1);
|
|
208
|
+
let diff = 0;
|
|
209
|
+
let common = common_i < common_j ? common_i : common_j;
|
|
210
|
+
const s = v[k][0];
|
|
211
|
+
for (let i2 = common; i2 < s.length; i2++) {
|
|
212
|
+
if (c + common === l) {
|
|
213
|
+
diff = -1;
|
|
214
|
+
break;
|
|
215
|
+
}
|
|
216
|
+
diff = this.current.charCodeAt(c + common) - s.charCodeAt(i2);
|
|
217
|
+
if (diff !== 0) break;
|
|
218
|
+
common++;
|
|
219
|
+
}
|
|
220
|
+
if (diff < 0) {
|
|
221
|
+
j = k;
|
|
222
|
+
common_j = common;
|
|
223
|
+
} else {
|
|
224
|
+
i = k;
|
|
225
|
+
common_i = common;
|
|
226
|
+
}
|
|
227
|
+
if (j - i <= 1) {
|
|
228
|
+
if (i > 0) break;
|
|
229
|
+
if (j === i) break;
|
|
230
|
+
if (first_key_inspected) break;
|
|
231
|
+
first_key_inspected = true;
|
|
232
|
+
}
|
|
233
|
+
}
|
|
234
|
+
while (true) {
|
|
235
|
+
const w = v[i];
|
|
236
|
+
const len = w[0].length;
|
|
237
|
+
if (common_i >= len) {
|
|
238
|
+
this.c = c + len;
|
|
239
|
+
const action = w[3];
|
|
240
|
+
if (action === void 0) return w[1];
|
|
241
|
+
this.af = action;
|
|
242
|
+
if (call_among_func?.call(this) === true) {
|
|
243
|
+
this.c = c + len;
|
|
244
|
+
return w[1];
|
|
245
|
+
}
|
|
246
|
+
}
|
|
247
|
+
const back = w[2];
|
|
248
|
+
if (back === void 0 || back === 0) return 0;
|
|
249
|
+
i -= back;
|
|
250
|
+
}
|
|
251
|
+
}
|
|
252
|
+
find_among_b(v, call_among_func) {
|
|
253
|
+
let i = 0;
|
|
254
|
+
let j = v.length;
|
|
255
|
+
const c = this.c;
|
|
256
|
+
const lb = this.limit_backward;
|
|
257
|
+
let common_i = 0;
|
|
258
|
+
let common_j = 0;
|
|
259
|
+
let first_key_inspected = false;
|
|
260
|
+
while (true) {
|
|
261
|
+
const k = i + (j - i >> 1);
|
|
262
|
+
let diff = 0;
|
|
263
|
+
let common = common_i < common_j ? common_i : common_j;
|
|
264
|
+
const s = v[k][0];
|
|
265
|
+
for (let i2 = s.length - 1 - common; i2 >= 0; i2--) {
|
|
266
|
+
if (c - common === lb) {
|
|
267
|
+
diff = -1;
|
|
268
|
+
break;
|
|
269
|
+
}
|
|
270
|
+
diff = this.current.charCodeAt(c - 1 - common) - s.charCodeAt(i2);
|
|
271
|
+
if (diff !== 0) break;
|
|
272
|
+
common++;
|
|
273
|
+
}
|
|
274
|
+
if (diff < 0) {
|
|
275
|
+
j = k;
|
|
276
|
+
common_j = common;
|
|
277
|
+
} else {
|
|
278
|
+
i = k;
|
|
279
|
+
common_i = common;
|
|
280
|
+
}
|
|
281
|
+
if (j - i <= 1) {
|
|
282
|
+
if (i > 0) break;
|
|
283
|
+
if (j === i) break;
|
|
284
|
+
if (first_key_inspected) break;
|
|
285
|
+
first_key_inspected = true;
|
|
286
|
+
}
|
|
287
|
+
}
|
|
288
|
+
while (true) {
|
|
289
|
+
const w = v[i];
|
|
290
|
+
const len = w[0].length;
|
|
291
|
+
if (common_i >= len) {
|
|
292
|
+
this.c = c - len;
|
|
293
|
+
const action = w[3];
|
|
294
|
+
if (action === void 0) return w[1];
|
|
295
|
+
this.af = action;
|
|
296
|
+
if (call_among_func?.call(this) === true) {
|
|
297
|
+
this.c = c - len;
|
|
298
|
+
return w[1];
|
|
299
|
+
}
|
|
300
|
+
}
|
|
301
|
+
const back = w[2];
|
|
302
|
+
if (back === void 0 || back === 0) return 0;
|
|
303
|
+
i -= back;
|
|
304
|
+
}
|
|
305
|
+
}
|
|
306
|
+
replace_s(c_bra, c_ket, s) {
|
|
307
|
+
const adjustment = s.length - (c_ket - c_bra);
|
|
308
|
+
this.current = this.current.slice(0, c_bra) + s + this.current.slice(c_ket);
|
|
309
|
+
this.limit += adjustment;
|
|
310
|
+
if (this.c >= c_ket) this.c += adjustment;
|
|
311
|
+
else if (this.c > c_bra) this.c = c_bra;
|
|
312
|
+
return adjustment;
|
|
313
|
+
}
|
|
314
|
+
slice_from(s) {
|
|
315
|
+
this.replace_s(this.bra, this.ket, s);
|
|
316
|
+
this.ket = this.bra + s.length;
|
|
317
|
+
}
|
|
318
|
+
slice_del() {
|
|
319
|
+
this.slice_from("");
|
|
320
|
+
}
|
|
321
|
+
insert(c_bra, c_ket, s) {
|
|
322
|
+
const adjustment = this.replace_s(c_bra, c_ket, s);
|
|
323
|
+
if (c_bra <= this.bra) this.bra += adjustment;
|
|
324
|
+
if (c_bra <= this.ket) this.ket += adjustment;
|
|
325
|
+
}
|
|
326
|
+
slice_to() {
|
|
327
|
+
return this.current.slice(this.bra, this.ket);
|
|
328
|
+
}
|
|
329
|
+
};
|
|
330
|
+
|
|
331
|
+
// src/languages/snowball/english.ts
|
|
332
|
+
var a_0 = [
|
|
333
|
+
["arsen", -1],
|
|
334
|
+
["commun", -1],
|
|
335
|
+
["emerg", -1],
|
|
336
|
+
["gener", -1],
|
|
337
|
+
["inter", -1],
|
|
338
|
+
["later", -1],
|
|
339
|
+
["organ", -1],
|
|
340
|
+
["past", -1],
|
|
341
|
+
["univers", -1]
|
|
342
|
+
];
|
|
343
|
+
var a_1 = [
|
|
344
|
+
["'", 1],
|
|
345
|
+
["'s'", 1, 1],
|
|
346
|
+
["'s", 1]
|
|
347
|
+
];
|
|
348
|
+
var a_2 = [
|
|
349
|
+
["ied", 2],
|
|
350
|
+
["s", 3],
|
|
351
|
+
["ies", 2, 1],
|
|
352
|
+
["sses", 1, 2],
|
|
353
|
+
["ss", -1, 3],
|
|
354
|
+
["us", -1, 4]
|
|
355
|
+
];
|
|
356
|
+
var a_3 = [
|
|
357
|
+
["succ", 1],
|
|
358
|
+
["proc", 1],
|
|
359
|
+
["exc", 1]
|
|
360
|
+
];
|
|
361
|
+
var a_4 = [
|
|
362
|
+
["even", 2],
|
|
363
|
+
["cann", 2],
|
|
364
|
+
["inn", 2],
|
|
365
|
+
["earr", 2],
|
|
366
|
+
["herr", 2],
|
|
367
|
+
["out", 2],
|
|
368
|
+
["y", 1]
|
|
369
|
+
];
|
|
370
|
+
var a_5 = [
|
|
371
|
+
["", -1],
|
|
372
|
+
["ed", 2, 1],
|
|
373
|
+
["eed", 1, 1],
|
|
374
|
+
["ing", 3, 3],
|
|
375
|
+
["edly", 2, 4],
|
|
376
|
+
["eedly", 1, 1],
|
|
377
|
+
["ingly", 2, 6]
|
|
378
|
+
];
|
|
379
|
+
var a_6 = [
|
|
380
|
+
["", 3],
|
|
381
|
+
["bb", 2, 1],
|
|
382
|
+
["dd", 2, 2],
|
|
383
|
+
["ff", 2, 3],
|
|
384
|
+
["gg", 2, 4],
|
|
385
|
+
["bl", 1, 5],
|
|
386
|
+
["mm", 2, 6],
|
|
387
|
+
["nn", 2, 7],
|
|
388
|
+
["pp", 2, 8],
|
|
389
|
+
["rr", 2, 9],
|
|
390
|
+
["at", 1, 10],
|
|
391
|
+
["tt", 2, 11],
|
|
392
|
+
["iz", 1, 12]
|
|
393
|
+
];
|
|
394
|
+
var a_7 = [
|
|
395
|
+
["anci", 3],
|
|
396
|
+
["enci", 2],
|
|
397
|
+
["ogi", 14],
|
|
398
|
+
["li", 16],
|
|
399
|
+
["bli", 12, 1],
|
|
400
|
+
["abli", 4, 1],
|
|
401
|
+
["alli", 8, 3],
|
|
402
|
+
["fulli", 9, 4],
|
|
403
|
+
["lessli", 15, 5],
|
|
404
|
+
["ousli", 10, 6],
|
|
405
|
+
["entli", 5, 7],
|
|
406
|
+
["aliti", 8],
|
|
407
|
+
["biliti", 12],
|
|
408
|
+
["iviti", 11],
|
|
409
|
+
["tional", 1],
|
|
410
|
+
["ational", 7, 1],
|
|
411
|
+
["alism", 8],
|
|
412
|
+
["ation", 7],
|
|
413
|
+
["ization", 6, 1],
|
|
414
|
+
["izer", 6],
|
|
415
|
+
["ator", 7],
|
|
416
|
+
["iveness", 11],
|
|
417
|
+
["fulness", 9],
|
|
418
|
+
["ousness", 10],
|
|
419
|
+
["ogist", 13]
|
|
420
|
+
];
|
|
421
|
+
var a_8 = [
|
|
422
|
+
["icate", 4],
|
|
423
|
+
["ative", 6],
|
|
424
|
+
["alize", 3],
|
|
425
|
+
["iciti", 4],
|
|
426
|
+
["ical", 4],
|
|
427
|
+
["tional", 1],
|
|
428
|
+
["ational", 2, 1],
|
|
429
|
+
["ful", 5],
|
|
430
|
+
["ness", 5]
|
|
431
|
+
];
|
|
432
|
+
var a_9 = [
|
|
433
|
+
["ic", 1],
|
|
434
|
+
["ance", 1],
|
|
435
|
+
["ence", 1],
|
|
436
|
+
["able", 1],
|
|
437
|
+
["ible", 1],
|
|
438
|
+
["ate", 1],
|
|
439
|
+
["ive", 1],
|
|
440
|
+
["ize", 1],
|
|
441
|
+
["iti", 1],
|
|
442
|
+
["al", 1],
|
|
443
|
+
["ism", 1],
|
|
444
|
+
["ion", 2],
|
|
445
|
+
["er", 1],
|
|
446
|
+
["ous", 1],
|
|
447
|
+
["ant", 1],
|
|
448
|
+
["ent", 1],
|
|
449
|
+
["ment", 1, 1],
|
|
450
|
+
["ement", 1, 1]
|
|
451
|
+
];
|
|
452
|
+
var a_10 = [
|
|
453
|
+
["e", 1],
|
|
454
|
+
["l", 2]
|
|
455
|
+
];
|
|
456
|
+
var a_11 = [
|
|
457
|
+
["andes", -1],
|
|
458
|
+
["atlas", -1],
|
|
459
|
+
["bias", -1],
|
|
460
|
+
["cosmos", -1],
|
|
461
|
+
["early", 6],
|
|
462
|
+
["gently", 4],
|
|
463
|
+
["howe", -1],
|
|
464
|
+
["idly", 3],
|
|
465
|
+
["news", -1],
|
|
466
|
+
["only", 7],
|
|
467
|
+
["singly", 8],
|
|
468
|
+
["skies", 2],
|
|
469
|
+
["skis", 1],
|
|
470
|
+
["sky", -1],
|
|
471
|
+
["ugly", 5]
|
|
472
|
+
];
|
|
473
|
+
var as_11 = ["ski", "sky", "idl", "gentl", "ugli", "earli", "onli", "singl"];
|
|
474
|
+
var g_aeo = [17, 64];
|
|
475
|
+
var g_v = [17, 65, 16, 1];
|
|
476
|
+
var g_v_WXY = [1, 17, 65, 208, 1];
|
|
477
|
+
var g_valid_LI = [55, 141, 2];
|
|
478
|
+
var EnglishStemmer = class extends BaseStemmer {
|
|
479
|
+
#r_shortv() {
|
|
480
|
+
lab0: {
|
|
481
|
+
const v_1 = this.limit - this.c;
|
|
482
|
+
lab1: {
|
|
483
|
+
if (!this.out_grouping_b(g_v_WXY, 89, 121)) break lab1;
|
|
484
|
+
if (!this.in_grouping_b(g_v, 97, 121)) break lab1;
|
|
485
|
+
if (!this.out_grouping_b(g_v, 97, 121)) break lab1;
|
|
486
|
+
break lab0;
|
|
487
|
+
}
|
|
488
|
+
this.c = this.limit - v_1;
|
|
489
|
+
lab2: {
|
|
490
|
+
if (!this.out_grouping_b(g_v, 97, 121)) break lab2;
|
|
491
|
+
if (!this.in_grouping_b(g_v, 97, 121)) break lab2;
|
|
492
|
+
if (
|
|
493
|
+
/**@type {boolean}*/
|
|
494
|
+
this.c > this.limit_backward
|
|
495
|
+
) break lab2;
|
|
496
|
+
break lab0;
|
|
497
|
+
}
|
|
498
|
+
this.c = this.limit - v_1;
|
|
499
|
+
if (!this.eq_s_b("past")) return false;
|
|
500
|
+
}
|
|
501
|
+
return true;
|
|
502
|
+
}
|
|
503
|
+
#stem() {
|
|
504
|
+
let a;
|
|
505
|
+
let B_Y_found;
|
|
506
|
+
let I_p2;
|
|
507
|
+
let I_p1;
|
|
508
|
+
lab0: {
|
|
509
|
+
const v_1 = this.c;
|
|
510
|
+
lab1: {
|
|
511
|
+
this.bra = this.c;
|
|
512
|
+
a = this.find_among(a_11);
|
|
513
|
+
if (a === 0) break lab1;
|
|
514
|
+
this.ket = this.c;
|
|
515
|
+
if (
|
|
516
|
+
/**@type {boolean}*/
|
|
517
|
+
this.c < this.limit
|
|
518
|
+
) break lab1;
|
|
519
|
+
if (a > 0) {
|
|
520
|
+
this.slice_from(as_11[a - 1]);
|
|
521
|
+
}
|
|
522
|
+
break lab0;
|
|
523
|
+
}
|
|
524
|
+
this.c = v_1;
|
|
525
|
+
lab2: {
|
|
526
|
+
lab3: {
|
|
527
|
+
if (this.c + 3 > this.limit) break lab3;
|
|
528
|
+
this.c += 3;
|
|
529
|
+
break lab2;
|
|
530
|
+
}
|
|
531
|
+
break lab0;
|
|
532
|
+
}
|
|
533
|
+
this.c = v_1;
|
|
534
|
+
{
|
|
535
|
+
B_Y_found = false;
|
|
536
|
+
const v_2 = this.c;
|
|
537
|
+
lab5: {
|
|
538
|
+
this.bra = this.c;
|
|
539
|
+
if (!this.eq_s("'")) break lab5;
|
|
540
|
+
this.ket = this.c;
|
|
541
|
+
this.slice_del();
|
|
542
|
+
}
|
|
543
|
+
this.c = v_2;
|
|
544
|
+
const v_3 = this.c;
|
|
545
|
+
lab6: {
|
|
546
|
+
this.bra = this.c;
|
|
547
|
+
if (!this.eq_s("y")) break lab6;
|
|
548
|
+
this.ket = this.c;
|
|
549
|
+
this.slice_from("Y");
|
|
550
|
+
B_Y_found = true;
|
|
551
|
+
}
|
|
552
|
+
this.c = v_3;
|
|
553
|
+
const v_4 = this.c;
|
|
554
|
+
while (true) {
|
|
555
|
+
const v_5 = this.c;
|
|
556
|
+
lab8: {
|
|
557
|
+
while (true) {
|
|
558
|
+
const v_6 = this.c;
|
|
559
|
+
lab10: {
|
|
560
|
+
if (!this.in_grouping(g_v, 97, 121)) break lab10;
|
|
561
|
+
this.bra = this.c;
|
|
562
|
+
if (!this.eq_s("y")) break lab10;
|
|
563
|
+
this.ket = this.c;
|
|
564
|
+
this.c = v_6;
|
|
565
|
+
break;
|
|
566
|
+
}
|
|
567
|
+
this.c = v_6;
|
|
568
|
+
if (this.c >= this.limit) break lab8;
|
|
569
|
+
this.c++;
|
|
570
|
+
}
|
|
571
|
+
this.slice_from("Y");
|
|
572
|
+
B_Y_found = true;
|
|
573
|
+
continue;
|
|
574
|
+
}
|
|
575
|
+
this.c = v_5;
|
|
576
|
+
break;
|
|
577
|
+
}
|
|
578
|
+
this.c = v_4;
|
|
579
|
+
}
|
|
580
|
+
{
|
|
581
|
+
I_p1 = this.limit;
|
|
582
|
+
I_p2 = this.limit;
|
|
583
|
+
const v_7 = this.c;
|
|
584
|
+
lab12: {
|
|
585
|
+
lab13: {
|
|
586
|
+
const v_8 = this.c;
|
|
587
|
+
lab14: {
|
|
588
|
+
if (this.find_among(a_0) === 0) break lab14;
|
|
589
|
+
break lab13;
|
|
590
|
+
}
|
|
591
|
+
this.c = v_8;
|
|
592
|
+
if (!this.go_out_grouping(g_v, 97, 121)) break lab12;
|
|
593
|
+
this.c++;
|
|
594
|
+
if (!this.go_in_grouping(g_v, 97, 121)) break lab12;
|
|
595
|
+
this.c++;
|
|
596
|
+
}
|
|
597
|
+
I_p1 = this.c;
|
|
598
|
+
if (!this.go_out_grouping(g_v, 97, 121)) break lab12;
|
|
599
|
+
this.c++;
|
|
600
|
+
if (!this.go_in_grouping(g_v, 97, 121)) break lab12;
|
|
601
|
+
this.c++;
|
|
602
|
+
I_p2 = this.c;
|
|
603
|
+
}
|
|
604
|
+
this.c = v_7;
|
|
605
|
+
}
|
|
606
|
+
this.limit_backward = this.c;
|
|
607
|
+
this.c = this.limit;
|
|
608
|
+
const v_9 = this.limit - this.c;
|
|
609
|
+
lab15: {
|
|
610
|
+
const v_10 = this.limit - this.c;
|
|
611
|
+
lab16: {
|
|
612
|
+
this.ket = this.c;
|
|
613
|
+
if (this.find_among_b(a_1) === 0) {
|
|
614
|
+
this.c = this.limit - v_10;
|
|
615
|
+
break lab16;
|
|
616
|
+
}
|
|
617
|
+
this.bra = this.c;
|
|
618
|
+
this.slice_del();
|
|
619
|
+
}
|
|
620
|
+
this.ket = this.c;
|
|
621
|
+
a = this.find_among_b(a_2);
|
|
622
|
+
if (a === 0) break lab15;
|
|
623
|
+
this.bra = this.c;
|
|
624
|
+
switch (a) {
|
|
625
|
+
case 1: {
|
|
626
|
+
this.slice_from("ss");
|
|
627
|
+
break;
|
|
628
|
+
}
|
|
629
|
+
case 2: {
|
|
630
|
+
lab17: {
|
|
631
|
+
const v_11 = this.limit - this.c;
|
|
632
|
+
lab18: {
|
|
633
|
+
if (this.c - 2 < this.limit_backward) break lab18;
|
|
634
|
+
this.c -= 2;
|
|
635
|
+
this.slice_from("i");
|
|
636
|
+
break lab17;
|
|
637
|
+
}
|
|
638
|
+
this.c = this.limit - v_11;
|
|
639
|
+
this.slice_from("ie");
|
|
640
|
+
}
|
|
641
|
+
break;
|
|
642
|
+
}
|
|
643
|
+
case 3: {
|
|
644
|
+
if (this.c <= this.limit_backward) break lab15;
|
|
645
|
+
this.c--;
|
|
646
|
+
if (!this.go_out_grouping_b(g_v, 97, 121)) break lab15;
|
|
647
|
+
this.c--;
|
|
648
|
+
this.slice_del();
|
|
649
|
+
break;
|
|
650
|
+
}
|
|
651
|
+
}
|
|
652
|
+
}
|
|
653
|
+
this.c = this.limit - v_9;
|
|
654
|
+
const v_12 = this.limit - this.c;
|
|
655
|
+
lab19: {
|
|
656
|
+
this.ket = this.c;
|
|
657
|
+
a = this.find_among_b(a_5);
|
|
658
|
+
this.bra = this.c;
|
|
659
|
+
lab20: {
|
|
660
|
+
const v_13 = this.limit - this.c;
|
|
661
|
+
lab21: {
|
|
662
|
+
switch (a) {
|
|
663
|
+
case 1: {
|
|
664
|
+
const v_14 = this.limit - this.c;
|
|
665
|
+
lab22: {
|
|
666
|
+
if (
|
|
667
|
+
/**@type {boolean}*/
|
|
668
|
+
I_p1 > this.c
|
|
669
|
+
) break lab22;
|
|
670
|
+
lab23: {
|
|
671
|
+
const v_15 = this.limit - this.c;
|
|
672
|
+
lab24: {
|
|
673
|
+
if (this.find_among_b(a_3) === 0) break lab24;
|
|
674
|
+
if (
|
|
675
|
+
/**@type {boolean}*/
|
|
676
|
+
this.c > this.limit_backward
|
|
677
|
+
) break lab24;
|
|
678
|
+
break lab23;
|
|
679
|
+
}
|
|
680
|
+
this.c = this.limit - v_15;
|
|
681
|
+
this.slice_from("ee");
|
|
682
|
+
}
|
|
683
|
+
}
|
|
684
|
+
this.c = this.limit - v_14;
|
|
685
|
+
break;
|
|
686
|
+
}
|
|
687
|
+
case 2: {
|
|
688
|
+
break lab21;
|
|
689
|
+
}
|
|
690
|
+
case 3: {
|
|
691
|
+
a = this.find_among_b(a_4);
|
|
692
|
+
if (a === 0) break lab21;
|
|
693
|
+
switch (a) {
|
|
694
|
+
case 1: {
|
|
695
|
+
const v_16 = this.limit - this.c;
|
|
696
|
+
if (!this.out_grouping_b(g_v, 97, 121)) break lab21;
|
|
697
|
+
if (
|
|
698
|
+
/**@type {boolean}*/
|
|
699
|
+
this.c > this.limit_backward
|
|
700
|
+
) break lab21;
|
|
701
|
+
this.c = this.limit - v_16;
|
|
702
|
+
this.bra = this.c;
|
|
703
|
+
this.slice_from("ie");
|
|
704
|
+
break;
|
|
705
|
+
}
|
|
706
|
+
case 2: {
|
|
707
|
+
if (
|
|
708
|
+
/**@type {boolean}*/
|
|
709
|
+
this.c > this.limit_backward
|
|
710
|
+
) break lab21;
|
|
711
|
+
break;
|
|
712
|
+
}
|
|
713
|
+
}
|
|
714
|
+
break;
|
|
715
|
+
}
|
|
716
|
+
}
|
|
717
|
+
break lab20;
|
|
718
|
+
}
|
|
719
|
+
this.c = this.limit - v_13;
|
|
720
|
+
const v_17 = this.limit - this.c;
|
|
721
|
+
if (!this.go_out_grouping_b(g_v, 97, 121)) break lab19;
|
|
722
|
+
this.c--;
|
|
723
|
+
this.c = this.limit - v_17;
|
|
724
|
+
this.slice_del();
|
|
725
|
+
this.ket = this.c;
|
|
726
|
+
this.bra = this.c;
|
|
727
|
+
const v_18 = this.limit - this.c;
|
|
728
|
+
a = this.find_among_b(a_6);
|
|
729
|
+
switch (a) {
|
|
730
|
+
case 1: {
|
|
731
|
+
this.slice_from("e");
|
|
732
|
+
break lab19;
|
|
733
|
+
}
|
|
734
|
+
case 2: {
|
|
735
|
+
{
|
|
736
|
+
const v_19 = this.limit - this.c;
|
|
737
|
+
lab25: {
|
|
738
|
+
if (!this.in_grouping_b(g_aeo, 97, 111)) break lab25;
|
|
739
|
+
if (
|
|
740
|
+
/**@type {boolean}*/
|
|
741
|
+
this.c > this.limit_backward
|
|
742
|
+
) break lab25;
|
|
743
|
+
break lab19;
|
|
744
|
+
}
|
|
745
|
+
this.c = this.limit - v_19;
|
|
746
|
+
}
|
|
747
|
+
break;
|
|
748
|
+
}
|
|
749
|
+
case 3: {
|
|
750
|
+
if (
|
|
751
|
+
/**@type {boolean}*/
|
|
752
|
+
this.c !== I_p1
|
|
753
|
+
) break lab19;
|
|
754
|
+
const v_20 = this.limit - this.c;
|
|
755
|
+
if (!this.#r_shortv()) break lab19;
|
|
756
|
+
this.c = this.limit - v_20;
|
|
757
|
+
this.slice_from("e");
|
|
758
|
+
break lab19;
|
|
759
|
+
}
|
|
760
|
+
}
|
|
761
|
+
this.c = this.limit - v_18;
|
|
762
|
+
this.ket = this.c;
|
|
763
|
+
if (this.c <= this.limit_backward) break lab19;
|
|
764
|
+
this.c--;
|
|
765
|
+
this.bra = this.c;
|
|
766
|
+
this.slice_del();
|
|
767
|
+
}
|
|
768
|
+
}
|
|
769
|
+
this.c = this.limit - v_12;
|
|
770
|
+
const v_21 = this.limit - this.c;
|
|
771
|
+
lab26: {
|
|
772
|
+
this.ket = this.c;
|
|
773
|
+
lab27: {
|
|
774
|
+
lab28: {
|
|
775
|
+
if (!this.eq_s_b("y")) break lab28;
|
|
776
|
+
break lab27;
|
|
777
|
+
}
|
|
778
|
+
if (!this.eq_s_b("Y")) break lab26;
|
|
779
|
+
}
|
|
780
|
+
this.bra = this.c;
|
|
781
|
+
if (!this.out_grouping_b(g_v, 97, 121)) break lab26;
|
|
782
|
+
if (
|
|
783
|
+
/**@type {boolean}*/
|
|
784
|
+
this.c <= this.limit_backward
|
|
785
|
+
) break lab26;
|
|
786
|
+
this.slice_from("i");
|
|
787
|
+
}
|
|
788
|
+
this.c = this.limit - v_21;
|
|
789
|
+
const v_22 = this.limit - this.c;
|
|
790
|
+
lab29: {
|
|
791
|
+
this.ket = this.c;
|
|
792
|
+
a = this.find_among_b(a_7);
|
|
793
|
+
if (a === 0) break lab29;
|
|
794
|
+
this.bra = this.c;
|
|
795
|
+
if (
|
|
796
|
+
/**@type {boolean}*/
|
|
797
|
+
I_p1 > this.c
|
|
798
|
+
) break lab29;
|
|
799
|
+
switch (a) {
|
|
800
|
+
case 1: {
|
|
801
|
+
this.slice_from("tion");
|
|
802
|
+
break;
|
|
803
|
+
}
|
|
804
|
+
case 2: {
|
|
805
|
+
this.slice_from("ence");
|
|
806
|
+
break;
|
|
807
|
+
}
|
|
808
|
+
case 3: {
|
|
809
|
+
this.slice_from("ance");
|
|
810
|
+
break;
|
|
811
|
+
}
|
|
812
|
+
case 4: {
|
|
813
|
+
this.slice_from("able");
|
|
814
|
+
break;
|
|
815
|
+
}
|
|
816
|
+
case 5: {
|
|
817
|
+
this.slice_from("ent");
|
|
818
|
+
break;
|
|
819
|
+
}
|
|
820
|
+
case 6: {
|
|
821
|
+
this.slice_from("ize");
|
|
822
|
+
break;
|
|
823
|
+
}
|
|
824
|
+
case 7: {
|
|
825
|
+
this.slice_from("ate");
|
|
826
|
+
break;
|
|
827
|
+
}
|
|
828
|
+
case 8: {
|
|
829
|
+
this.slice_from("al");
|
|
830
|
+
break;
|
|
831
|
+
}
|
|
832
|
+
case 9: {
|
|
833
|
+
this.slice_from("ful");
|
|
834
|
+
break;
|
|
835
|
+
}
|
|
836
|
+
case 10: {
|
|
837
|
+
this.slice_from("ous");
|
|
838
|
+
break;
|
|
839
|
+
}
|
|
840
|
+
case 11: {
|
|
841
|
+
this.slice_from("ive");
|
|
842
|
+
break;
|
|
843
|
+
}
|
|
844
|
+
case 12: {
|
|
845
|
+
this.slice_from("ble");
|
|
846
|
+
break;
|
|
847
|
+
}
|
|
848
|
+
case 13: {
|
|
849
|
+
this.slice_from("og");
|
|
850
|
+
break;
|
|
851
|
+
}
|
|
852
|
+
case 14: {
|
|
853
|
+
if (!this.eq_s_b("l")) break lab29;
|
|
854
|
+
this.slice_from("og");
|
|
855
|
+
break;
|
|
856
|
+
}
|
|
857
|
+
case 15: {
|
|
858
|
+
this.slice_from("less");
|
|
859
|
+
break;
|
|
860
|
+
}
|
|
861
|
+
case 16: {
|
|
862
|
+
if (!this.in_grouping_b(g_valid_LI, 99, 116)) break lab29;
|
|
863
|
+
this.slice_del();
|
|
864
|
+
break;
|
|
865
|
+
}
|
|
866
|
+
}
|
|
867
|
+
}
|
|
868
|
+
this.c = this.limit - v_22;
|
|
869
|
+
const v_23 = this.limit - this.c;
|
|
870
|
+
lab30: {
|
|
871
|
+
this.ket = this.c;
|
|
872
|
+
a = this.find_among_b(a_8);
|
|
873
|
+
if (a === 0) break lab30;
|
|
874
|
+
this.bra = this.c;
|
|
875
|
+
if (
|
|
876
|
+
/**@type {boolean}*/
|
|
877
|
+
I_p1 > this.c
|
|
878
|
+
) break lab30;
|
|
879
|
+
switch (a) {
|
|
880
|
+
case 1: {
|
|
881
|
+
this.slice_from("tion");
|
|
882
|
+
break;
|
|
883
|
+
}
|
|
884
|
+
case 2: {
|
|
885
|
+
this.slice_from("ate");
|
|
886
|
+
break;
|
|
887
|
+
}
|
|
888
|
+
case 3: {
|
|
889
|
+
this.slice_from("al");
|
|
890
|
+
break;
|
|
891
|
+
}
|
|
892
|
+
case 4: {
|
|
893
|
+
this.slice_from("ic");
|
|
894
|
+
break;
|
|
895
|
+
}
|
|
896
|
+
case 5: {
|
|
897
|
+
this.slice_del();
|
|
898
|
+
break;
|
|
899
|
+
}
|
|
900
|
+
case 6: {
|
|
901
|
+
if (
|
|
902
|
+
/**@type {boolean}*/
|
|
903
|
+
I_p2 > this.c
|
|
904
|
+
) break lab30;
|
|
905
|
+
this.slice_del();
|
|
906
|
+
break;
|
|
907
|
+
}
|
|
908
|
+
}
|
|
909
|
+
}
|
|
910
|
+
this.c = this.limit - v_23;
|
|
911
|
+
const v_24 = this.limit - this.c;
|
|
912
|
+
lab31: {
|
|
913
|
+
this.ket = this.c;
|
|
914
|
+
a = this.find_among_b(a_9);
|
|
915
|
+
if (a === 0) break lab31;
|
|
916
|
+
this.bra = this.c;
|
|
917
|
+
if (
|
|
918
|
+
/**@type {boolean}*/
|
|
919
|
+
I_p2 > this.c
|
|
920
|
+
) break lab31;
|
|
921
|
+
switch (a) {
|
|
922
|
+
case 1: {
|
|
923
|
+
this.slice_del();
|
|
924
|
+
break;
|
|
925
|
+
}
|
|
926
|
+
case 2: {
|
|
927
|
+
lab32: {
|
|
928
|
+
lab33: {
|
|
929
|
+
if (!this.eq_s_b("s")) break lab33;
|
|
930
|
+
break lab32;
|
|
931
|
+
}
|
|
932
|
+
if (!this.eq_s_b("t")) break lab31;
|
|
933
|
+
}
|
|
934
|
+
this.slice_del();
|
|
935
|
+
break;
|
|
936
|
+
}
|
|
937
|
+
}
|
|
938
|
+
}
|
|
939
|
+
this.c = this.limit - v_24;
|
|
940
|
+
const v_25 = this.limit - this.c;
|
|
941
|
+
lab34: {
|
|
942
|
+
this.ket = this.c;
|
|
943
|
+
a = this.find_among_b(a_10);
|
|
944
|
+
if (a === 0) break lab34;
|
|
945
|
+
this.bra = this.c;
|
|
946
|
+
switch (a) {
|
|
947
|
+
case 1: {
|
|
948
|
+
lab35: {
|
|
949
|
+
lab36: {
|
|
950
|
+
if (
|
|
951
|
+
/**@type {boolean}*/
|
|
952
|
+
I_p2 > this.c
|
|
953
|
+
) break lab36;
|
|
954
|
+
break lab35;
|
|
955
|
+
}
|
|
956
|
+
if (
|
|
957
|
+
/**@type {boolean}*/
|
|
958
|
+
I_p1 > this.c
|
|
959
|
+
) break lab34;
|
|
960
|
+
{
|
|
961
|
+
const v_26 = this.limit - this.c;
|
|
962
|
+
lab37: {
|
|
963
|
+
if (!this.#r_shortv()) break lab37;
|
|
964
|
+
break lab34;
|
|
965
|
+
}
|
|
966
|
+
this.c = this.limit - v_26;
|
|
967
|
+
}
|
|
968
|
+
}
|
|
969
|
+
this.slice_del();
|
|
970
|
+
break;
|
|
971
|
+
}
|
|
972
|
+
case 2: {
|
|
973
|
+
if (
|
|
974
|
+
/**@type {boolean}*/
|
|
975
|
+
I_p2 > this.c
|
|
976
|
+
) break lab34;
|
|
977
|
+
if (!this.eq_s_b("l")) break lab34;
|
|
978
|
+
this.slice_del();
|
|
979
|
+
break;
|
|
980
|
+
}
|
|
981
|
+
}
|
|
982
|
+
}
|
|
983
|
+
this.c = this.limit - v_25;
|
|
984
|
+
this.c = this.limit_backward;
|
|
985
|
+
const v_27 = this.c;
|
|
986
|
+
lab38: {
|
|
987
|
+
if (!B_Y_found) break lab38;
|
|
988
|
+
while (true) {
|
|
989
|
+
const v_28 = this.c;
|
|
990
|
+
lab39: {
|
|
991
|
+
while (true) {
|
|
992
|
+
const v_29 = this.c;
|
|
993
|
+
lab41: {
|
|
994
|
+
this.bra = this.c;
|
|
995
|
+
if (!this.eq_s("Y")) break lab41;
|
|
996
|
+
this.ket = this.c;
|
|
997
|
+
this.c = v_29;
|
|
998
|
+
break;
|
|
999
|
+
}
|
|
1000
|
+
this.c = v_29;
|
|
1001
|
+
if (this.c >= this.limit) break lab39;
|
|
1002
|
+
this.c++;
|
|
1003
|
+
}
|
|
1004
|
+
this.slice_from("y");
|
|
1005
|
+
continue;
|
|
1006
|
+
}
|
|
1007
|
+
this.c = v_28;
|
|
1008
|
+
break;
|
|
1009
|
+
}
|
|
1010
|
+
}
|
|
1011
|
+
this.c = v_27;
|
|
1012
|
+
}
|
|
1013
|
+
return true;
|
|
1014
|
+
}
|
|
1015
|
+
stem(input) {
|
|
1016
|
+
this.setCurrent(input);
|
|
1017
|
+
this.#stem();
|
|
1018
|
+
return this.getCurrent();
|
|
1019
|
+
}
|
|
1020
|
+
};
|
|
1021
|
+
var shared = new EnglishStemmer();
|
|
1022
|
+
function stem(token) {
|
|
1023
|
+
return shared.stem(token);
|
|
1024
|
+
}
|
|
1025
|
+
|
|
1026
|
+
// src/languages/english.ts
|
|
1027
|
+
var stopWords = /* @__PURE__ */ new Set([
|
|
1028
|
+
"a",
|
|
1029
|
+
"an",
|
|
1030
|
+
"the",
|
|
1031
|
+
"i",
|
|
1032
|
+
"me",
|
|
1033
|
+
"my",
|
|
1034
|
+
"myself",
|
|
1035
|
+
"we",
|
|
1036
|
+
"us",
|
|
1037
|
+
"our",
|
|
1038
|
+
"ours",
|
|
1039
|
+
"ourselves",
|
|
1040
|
+
"you",
|
|
1041
|
+
"your",
|
|
1042
|
+
"yours",
|
|
1043
|
+
"yourself",
|
|
1044
|
+
"yourselves",
|
|
1045
|
+
"he",
|
|
1046
|
+
"him",
|
|
1047
|
+
"his",
|
|
1048
|
+
"himself",
|
|
1049
|
+
"she",
|
|
1050
|
+
"her",
|
|
1051
|
+
"hers",
|
|
1052
|
+
"herself",
|
|
1053
|
+
"it",
|
|
1054
|
+
"its",
|
|
1055
|
+
"itself",
|
|
1056
|
+
"they",
|
|
1057
|
+
"them",
|
|
1058
|
+
"their",
|
|
1059
|
+
"theirs",
|
|
1060
|
+
"themselves",
|
|
1061
|
+
"what",
|
|
1062
|
+
"which",
|
|
1063
|
+
"who",
|
|
1064
|
+
"whom",
|
|
1065
|
+
"this",
|
|
1066
|
+
"that",
|
|
1067
|
+
"these",
|
|
1068
|
+
"those",
|
|
1069
|
+
"am",
|
|
1070
|
+
"is",
|
|
1071
|
+
"are",
|
|
1072
|
+
"was",
|
|
1073
|
+
"were",
|
|
1074
|
+
"be",
|
|
1075
|
+
"been",
|
|
1076
|
+
"being",
|
|
1077
|
+
"have",
|
|
1078
|
+
"has",
|
|
1079
|
+
"had",
|
|
1080
|
+
"having",
|
|
1081
|
+
"do",
|
|
1082
|
+
"does",
|
|
1083
|
+
"did",
|
|
1084
|
+
"doing",
|
|
1085
|
+
"will",
|
|
1086
|
+
"would",
|
|
1087
|
+
"shall",
|
|
1088
|
+
"should",
|
|
1089
|
+
"can",
|
|
1090
|
+
"could",
|
|
1091
|
+
"may",
|
|
1092
|
+
"might",
|
|
1093
|
+
"must",
|
|
1094
|
+
"ought",
|
|
1095
|
+
"i'm",
|
|
1096
|
+
"you're",
|
|
1097
|
+
"we're",
|
|
1098
|
+
"they're",
|
|
1099
|
+
"i've",
|
|
1100
|
+
"you've",
|
|
1101
|
+
"we've",
|
|
1102
|
+
"they've",
|
|
1103
|
+
"i'd",
|
|
1104
|
+
"you'd",
|
|
1105
|
+
"he'd",
|
|
1106
|
+
"she'd",
|
|
1107
|
+
"we'd",
|
|
1108
|
+
"they'd",
|
|
1109
|
+
"i'll",
|
|
1110
|
+
"you'll",
|
|
1111
|
+
"he'll",
|
|
1112
|
+
"she'll",
|
|
1113
|
+
"we'll",
|
|
1114
|
+
"they'll",
|
|
1115
|
+
"isn't",
|
|
1116
|
+
"aren't",
|
|
1117
|
+
"wasn't",
|
|
1118
|
+
"weren't",
|
|
1119
|
+
"hasn't",
|
|
1120
|
+
"haven't",
|
|
1121
|
+
"hadn't",
|
|
1122
|
+
"doesn't",
|
|
1123
|
+
"don't",
|
|
1124
|
+
"didn't",
|
|
1125
|
+
"won't",
|
|
1126
|
+
"wouldn't",
|
|
1127
|
+
"shan't",
|
|
1128
|
+
"shouldn't",
|
|
1129
|
+
"can't",
|
|
1130
|
+
"cannot",
|
|
1131
|
+
"couldn't",
|
|
1132
|
+
"mustn't",
|
|
1133
|
+
"and",
|
|
1134
|
+
"but",
|
|
1135
|
+
"if",
|
|
1136
|
+
"or",
|
|
1137
|
+
"because",
|
|
1138
|
+
"as",
|
|
1139
|
+
"until",
|
|
1140
|
+
"while",
|
|
1141
|
+
"of",
|
|
1142
|
+
"at",
|
|
1143
|
+
"by",
|
|
1144
|
+
"for",
|
|
1145
|
+
"with",
|
|
1146
|
+
"about",
|
|
1147
|
+
"against",
|
|
1148
|
+
"between",
|
|
1149
|
+
"into",
|
|
1150
|
+
"through",
|
|
1151
|
+
"during",
|
|
1152
|
+
"before",
|
|
1153
|
+
"after",
|
|
1154
|
+
"above",
|
|
1155
|
+
"below",
|
|
1156
|
+
"to",
|
|
1157
|
+
"from",
|
|
1158
|
+
"up",
|
|
1159
|
+
"down",
|
|
1160
|
+
"in",
|
|
1161
|
+
"out",
|
|
1162
|
+
"on",
|
|
1163
|
+
"off",
|
|
1164
|
+
"over",
|
|
1165
|
+
"under",
|
|
1166
|
+
"again",
|
|
1167
|
+
"further",
|
|
1168
|
+
"then",
|
|
1169
|
+
"once",
|
|
1170
|
+
"here",
|
|
1171
|
+
"there",
|
|
1172
|
+
"when",
|
|
1173
|
+
"where",
|
|
1174
|
+
"why",
|
|
1175
|
+
"how",
|
|
1176
|
+
"all",
|
|
1177
|
+
"any",
|
|
1178
|
+
"both",
|
|
1179
|
+
"each",
|
|
1180
|
+
"few",
|
|
1181
|
+
"more",
|
|
1182
|
+
"most",
|
|
1183
|
+
"other",
|
|
1184
|
+
"some",
|
|
1185
|
+
"such",
|
|
1186
|
+
"no",
|
|
1187
|
+
"nor",
|
|
1188
|
+
"not",
|
|
1189
|
+
"only",
|
|
1190
|
+
"own",
|
|
1191
|
+
"same",
|
|
1192
|
+
"so",
|
|
1193
|
+
"than",
|
|
1194
|
+
"too",
|
|
1195
|
+
"very"
|
|
1196
|
+
]);
|
|
1197
|
+
var english = {
|
|
1198
|
+
name: "english",
|
|
1199
|
+
revision: "ebae3448ae674b59",
|
|
1200
|
+
stemmer: stem,
|
|
1201
|
+
stopWords,
|
|
1202
|
+
tokenizer: {
|
|
1203
|
+
splitPattern: /[^\p{L}\p{M}\p{N}_']+/u,
|
|
1204
|
+
stripPossessive: true
|
|
1205
|
+
}
|
|
1206
|
+
};
|
|
1207
|
+
|
|
1208
|
+
// src/languages/registry.ts
|
|
1209
|
+
var languages = /* @__PURE__ */ new Map();
|
|
1210
|
+
languages.set("english", english);
|
|
1211
|
+
function registerLanguage(module) {
|
|
1212
|
+
languages.set(module.name, module);
|
|
1213
|
+
}
|
|
1214
|
+
function getLanguage(name) {
|
|
1215
|
+
const lang = languages.get(name);
|
|
1216
|
+
if (!lang) {
|
|
1217
|
+
throw new NarsilError(ErrorCodes.LANGUAGE_NOT_SUPPORTED, `Language "${name}" is not registered`, { language: name });
|
|
1218
|
+
}
|
|
1219
|
+
return lang;
|
|
1220
|
+
}
|
|
1221
|
+
|
|
1222
|
+
// src/engine/serial-index-update.ts
|
|
1223
|
+
var updatingByCore = /* @__PURE__ */ new WeakMap();
|
|
1224
|
+
async function withOpenIndex(core, indexName, action) {
|
|
1225
|
+
core.guardShutdown();
|
|
1226
|
+
core.requireIndex(indexName);
|
|
1227
|
+
const release = await core.indexState.acquire(indexName);
|
|
1228
|
+
try {
|
|
1229
|
+
return await action();
|
|
1230
|
+
} finally {
|
|
1231
|
+
release();
|
|
1232
|
+
}
|
|
1233
|
+
}
|
|
1234
|
+
async function oneAtATime(core, indexName, action) {
|
|
1235
|
+
let chains = updatingByCore.get(core);
|
|
1236
|
+
if (chains === void 0) {
|
|
1237
|
+
chains = /* @__PURE__ */ new Map();
|
|
1238
|
+
updatingByCore.set(core, chains);
|
|
1239
|
+
}
|
|
1240
|
+
const updating = chains;
|
|
1241
|
+
const earlier = updating.get(indexName) ?? Promise.resolve();
|
|
1242
|
+
const current = earlier.catch(() => void 0).then(action);
|
|
1243
|
+
updating.set(indexName, current);
|
|
1244
|
+
try {
|
|
1245
|
+
return await current;
|
|
1246
|
+
} finally {
|
|
1247
|
+
if (updating.get(indexName) === current) updating.delete(indexName);
|
|
1248
|
+
}
|
|
1249
|
+
}
|
|
1250
|
+
|
|
1251
|
+
export { getLanguage, getStopWords, getTokenizer, hasStopWords, hasTokenizer, oneAtATime, registerLanguage, registerStopWords, registerTokenizer, resolveIndexAnalysis, withOpenIndex };
|