@bloomreach/clarity-utils 1.0.3 → 1.0.5

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/index.mjs CHANGED
@@ -1,47 +1,1546 @@
1
+ // src/enums.ts
2
+ var EN_WORDS = {
3
+ questions: [
4
+ "who",
5
+ "what",
6
+ "when",
7
+ "where",
8
+ "why",
9
+ "how",
10
+ "which",
11
+ "can",
12
+ "should",
13
+ "could",
14
+ "would",
15
+ "will",
16
+ "have",
17
+ "has",
18
+ "is",
19
+ "are",
20
+ "do",
21
+ "does",
22
+ "did"
23
+ ],
24
+ pronouns: [
25
+ "i",
26
+ "me",
27
+ "my",
28
+ "mine",
29
+ "we",
30
+ "us",
31
+ "our",
32
+ "you",
33
+ "your",
34
+ "it",
35
+ "he",
36
+ "him",
37
+ "his",
38
+ "she",
39
+ "her",
40
+ "they",
41
+ "them",
42
+ "their"
43
+ ],
44
+ commonVerbs: [
45
+ "is",
46
+ "are",
47
+ "was",
48
+ "were",
49
+ "do",
50
+ "does",
51
+ "did",
52
+ "have",
53
+ "need",
54
+ "want",
55
+ "look",
56
+ "help",
57
+ "know",
58
+ "think",
59
+ "make",
60
+ "create",
61
+ "find",
62
+ "get",
63
+ "buy",
64
+ "use",
65
+ "install",
66
+ "fix",
67
+ "recommend",
68
+ "tell",
69
+ "show",
70
+ "compare",
71
+ "explain"
72
+ ],
73
+ stopwords: [
74
+ "the",
75
+ "a",
76
+ "an",
77
+ "i",
78
+ "me",
79
+ "my",
80
+ "is",
81
+ "it",
82
+ "in",
83
+ "on",
84
+ "at",
85
+ "to",
86
+ "for",
87
+ "of",
88
+ "and",
89
+ "or",
90
+ "but",
91
+ "not",
92
+ "so",
93
+ "if",
94
+ "by",
95
+ "with",
96
+ "from",
97
+ "that",
98
+ "this",
99
+ "about"
100
+ ],
101
+ support: [
102
+ // Orders / tracking / delivery
103
+ "order",
104
+ "package",
105
+ "shipment",
106
+ "tracking",
107
+ "delivery",
108
+ "delayed",
109
+ "late",
110
+ "lost",
111
+ "missing",
112
+ "cancel",
113
+ "modify",
114
+ // Returns / refunds / exchanges
115
+ "return",
116
+ "exchange",
117
+ "refund",
118
+ "replacement",
119
+ "eligible",
120
+ "eligibility",
121
+ // Product issues
122
+ "warranty",
123
+ "damaged",
124
+ "broken",
125
+ "defective",
126
+ "wrong",
127
+ "incorrect",
128
+ // Account / login
129
+ "password",
130
+ "login",
131
+ "account",
132
+ "locked",
133
+ "verification",
134
+ "otp",
135
+ // Loyalty / promos / gift cards
136
+ "loyalty",
137
+ "rewards",
138
+ "reward",
139
+ "points",
140
+ "point",
141
+ "promo",
142
+ "promos",
143
+ "promotion",
144
+ "promotions",
145
+ "coupon",
146
+ "coupons",
147
+ "discount",
148
+ "discounts",
149
+ "gift",
150
+ "gifts",
151
+ // Shipping / payments / billing
152
+ "shipping",
153
+ "payment",
154
+ "payments",
155
+ "billing",
156
+ "charged",
157
+ "charge",
158
+ "invoice",
159
+ "receipt",
160
+ "declined",
161
+ // Product info / sizing / inventory
162
+ "size",
163
+ "sizing",
164
+ "fit",
165
+ "care",
166
+ "stock",
167
+ "restock",
168
+ "availability",
169
+ // Company / policy
170
+ "sustainability",
171
+ "ethics",
172
+ "careers",
173
+ "privacy",
174
+ "terms",
175
+ // Human support
176
+ "agent",
177
+ "representative",
178
+ "support",
179
+ "human",
180
+ "talk",
181
+ "speak",
182
+ "help",
183
+ // Technical / service issues
184
+ "api",
185
+ "failure",
186
+ "server",
187
+ "technical",
188
+ "website",
189
+ "checkout",
190
+ "app"
191
+ ],
192
+ contractions: {
193
+ "won't": "will not",
194
+ "can't": "cannot",
195
+ "don't": "do not",
196
+ "doesn't": "does not",
197
+ "didn't": "did not",
198
+ "isn't": "is not",
199
+ "aren't": "are not",
200
+ "wasn't": "was not",
201
+ "weren't": "were not",
202
+ "haven't": "have not",
203
+ "hasn't": "has not",
204
+ "hadn't": "had not",
205
+ "wouldn't": "would not",
206
+ "shouldn't": "should not",
207
+ "couldn't": "could not",
208
+ "what's": "what is",
209
+ "what're": "what are",
210
+ "how's": "how is",
211
+ "where's": "where is",
212
+ "who's": "who is",
213
+ "that's": "that is",
214
+ "there's": "there is",
215
+ "it's": "it is",
216
+ "i'm": "i am",
217
+ "i'd": "i would",
218
+ "i'll": "i will",
219
+ "i've": "i have",
220
+ "we're": "we are",
221
+ "we've": "we have",
222
+ "we'd": "we would",
223
+ "they're": "they are",
224
+ "they've": "they have",
225
+ "you're": "you are",
226
+ "you've": "you have",
227
+ "you'd": "you would"
228
+ }
229
+ };
230
+ var DE_WORDS = {
231
+ questions: [
232
+ "wer",
233
+ "was",
234
+ "wann",
235
+ "wo",
236
+ "warum",
237
+ "wieso",
238
+ "weshalb",
239
+ "wie",
240
+ "welche",
241
+ "welcher",
242
+ "welches",
243
+ "kann",
244
+ "kannst",
245
+ "k\xF6nnen",
246
+ "soll",
247
+ "sollte",
248
+ "k\xF6nnte",
249
+ "w\xFCrde",
250
+ "wird",
251
+ "hat",
252
+ "habe",
253
+ "haben",
254
+ "ist",
255
+ "sind",
256
+ "tust",
257
+ "tun"
258
+ ],
259
+ pronouns: [
260
+ "ich",
261
+ "mich",
262
+ "mir",
263
+ "mein",
264
+ "meine",
265
+ "meiner",
266
+ "meinen",
267
+ "wir",
268
+ "uns",
269
+ "unser",
270
+ "unsere",
271
+ "du",
272
+ "dich",
273
+ "dir",
274
+ "dein",
275
+ "deine",
276
+ "sie",
277
+ "ihnen",
278
+ "er",
279
+ "ihn",
280
+ "ihm",
281
+ "sein",
282
+ "seine",
283
+ "ihr",
284
+ "ihre",
285
+ "es"
286
+ ],
287
+ commonVerbs: [
288
+ "ist",
289
+ "sind",
290
+ "war",
291
+ "waren",
292
+ "tut",
293
+ "tun",
294
+ "tat",
295
+ "taten",
296
+ "hat",
297
+ "habe",
298
+ "haben",
299
+ "hatte",
300
+ "hatten",
301
+ "brauche",
302
+ "brauchen",
303
+ "m\xF6chte",
304
+ "m\xF6chten",
305
+ "will",
306
+ "willst",
307
+ "wollen",
308
+ "suche",
309
+ "suchen",
310
+ "hilf",
311
+ "helfen",
312
+ "wei\xDF",
313
+ "denke",
314
+ "denken",
315
+ "mache",
316
+ "machen",
317
+ "erstelle",
318
+ "erstellen",
319
+ "finde",
320
+ "finden",
321
+ "kaufe",
322
+ "kaufen",
323
+ "benutze",
324
+ "benutzen",
325
+ "installiere",
326
+ "installieren",
327
+ "repariere",
328
+ "reparieren",
329
+ "empfehle",
330
+ "empfehlen",
331
+ "sage",
332
+ "sagen",
333
+ "zeige",
334
+ "zeigen",
335
+ "vergleiche",
336
+ "vergleichen",
337
+ "erkl\xE4re",
338
+ "erkl\xE4ren"
339
+ ],
340
+ stopwords: [
341
+ "der",
342
+ "die",
343
+ "das",
344
+ "den",
345
+ "dem",
346
+ "des",
347
+ "ein",
348
+ "eine",
349
+ "einen",
350
+ "einer",
351
+ "eines",
352
+ "ich",
353
+ "mich",
354
+ "mein",
355
+ "ist",
356
+ "es",
357
+ "in",
358
+ "an",
359
+ "auf",
360
+ "zu",
361
+ "f\xFCr",
362
+ "von",
363
+ "und",
364
+ "oder",
365
+ "aber",
366
+ "nicht",
367
+ "also",
368
+ "falls",
369
+ "mit",
370
+ "aus",
371
+ "dass",
372
+ "dieser",
373
+ "diese",
374
+ "dieses",
375
+ "\xFCber"
376
+ ],
377
+ support: [
378
+ // Bestellungen / Tracking / Lieferung
379
+ "bestellung",
380
+ "bestellungen",
381
+ "paket",
382
+ "sendung",
383
+ "versand",
384
+ "lieferung",
385
+ "tracking",
386
+ "verz\xF6gert",
387
+ "versp\xE4tet",
388
+ "verloren",
389
+ "fehlt",
390
+ "fehlend",
391
+ "stornieren",
392
+ "storno",
393
+ "\xE4ndern",
394
+ // Rücksendungen / Erstattungen / Umtausch
395
+ "r\xFCcksendung",
396
+ "r\xFCckgabe",
397
+ "retoure",
398
+ "umtausch",
399
+ "r\xFCckerstattung",
400
+ "erstattung",
401
+ "ersatz",
402
+ "berechtigt",
403
+ "anspruch",
404
+ // Produktprobleme
405
+ "garantie",
406
+ "besch\xE4digt",
407
+ "kaputt",
408
+ "defekt",
409
+ "falsch",
410
+ "fehlerhaft",
411
+ // Konto / Anmeldung
412
+ "passwort",
413
+ "anmelden",
414
+ "login",
415
+ "konto",
416
+ "gesperrt",
417
+ "verifizierung",
418
+ "otp",
419
+ // Treue / Aktionen / Geschenke
420
+ "treue",
421
+ "treueprogramm",
422
+ "pr\xE4mien",
423
+ "punkte",
424
+ "aktion",
425
+ "gutschein",
426
+ "rabatt",
427
+ "geschenk",
428
+ "geschenkkarte",
429
+ // Versand / Zahlung / Abrechnung
430
+ "versandkosten",
431
+ "zahlung",
432
+ "abrechnung",
433
+ "belastet",
434
+ "rechnung",
435
+ "beleg",
436
+ "quittung",
437
+ "abgelehnt",
438
+ // Produktinfo / Größen / Lager
439
+ "gr\xF6\xDFe",
440
+ "passform",
441
+ "pflege",
442
+ "lager",
443
+ "verf\xFCgbarkeit",
444
+ // Unternehmen / Richtlinien
445
+ "nachhaltigkeit",
446
+ "ethik",
447
+ "karriere",
448
+ "datenschutz",
449
+ "bedingungen",
450
+ "agb",
451
+ // Menschlicher Support
452
+ "mitarbeiter",
453
+ "vertreter",
454
+ "support",
455
+ "mensch",
456
+ "sprechen",
457
+ "reden",
458
+ "hilfe",
459
+ // Technische / Service-Probleme
460
+ "api",
461
+ "fehler",
462
+ "server",
463
+ "technisch",
464
+ "webseite",
465
+ "kasse",
466
+ "app",
467
+ // More
468
+ "r\xFCckgabe",
469
+ "zur\xFCckgeben",
470
+ "bestellstatus",
471
+ "lieferstatus"
472
+ ]
473
+ };
474
+ var FR_WORDS = {
475
+ questions: [
476
+ "qui",
477
+ "que",
478
+ "quoi",
479
+ "quand",
480
+ "o\xF9",
481
+ "pourquoi",
482
+ "comment",
483
+ "combien",
484
+ "quel",
485
+ "quelle",
486
+ "quels",
487
+ "quelles",
488
+ "peux",
489
+ "peut",
490
+ "peuvent",
491
+ "dois",
492
+ "doit",
493
+ "devrait",
494
+ "pourrait",
495
+ "aurait",
496
+ "sera",
497
+ "est",
498
+ "sont",
499
+ "fait",
500
+ "font",
501
+ "ai",
502
+ "as",
503
+ "a",
504
+ "avons",
505
+ "avez",
506
+ "ont"
507
+ ],
508
+ pronouns: [
509
+ "je",
510
+ "moi",
511
+ "mon",
512
+ "ma",
513
+ "mes",
514
+ "mien",
515
+ "mienne",
516
+ "nous",
517
+ "notre",
518
+ "nos",
519
+ "n\xF4tre",
520
+ "tu",
521
+ "te",
522
+ "toi",
523
+ "ton",
524
+ "ta",
525
+ "tes",
526
+ "vous",
527
+ "votre",
528
+ "vos",
529
+ "il",
530
+ "lui",
531
+ "son",
532
+ "sa",
533
+ "ses",
534
+ "elle",
535
+ "ils",
536
+ "elles",
537
+ "leur",
538
+ "leurs"
539
+ ],
540
+ commonVerbs: [
541
+ "est",
542
+ "sont",
543
+ "\xE9tait",
544
+ "\xE9taient",
545
+ "fait",
546
+ "font",
547
+ "faisait",
548
+ "ai",
549
+ "as",
550
+ "a",
551
+ "avons",
552
+ "avez",
553
+ "ont",
554
+ "avait",
555
+ "avaient",
556
+ "besoin",
557
+ "veux",
558
+ "veut",
559
+ "voulons",
560
+ "voulez",
561
+ "veulent",
562
+ "cherche",
563
+ "cherchons",
564
+ "cherchez",
565
+ "aide",
566
+ "aider",
567
+ "sais",
568
+ "sait",
569
+ "savez",
570
+ "savons",
571
+ "pense",
572
+ "pensons",
573
+ "pensez",
574
+ "fais",
575
+ "faisons",
576
+ "faites",
577
+ "cr\xE9e",
578
+ "cr\xE9er",
579
+ "trouve",
580
+ "trouver",
581
+ "ach\xE8te",
582
+ "acheter",
583
+ "utilise",
584
+ "utiliser",
585
+ "installe",
586
+ "installer",
587
+ "r\xE9pare",
588
+ "r\xE9parer",
589
+ "recommande",
590
+ "recommander",
591
+ "dis",
592
+ "dites",
593
+ "montre",
594
+ "montrer",
595
+ "compare",
596
+ "comparer",
597
+ "explique",
598
+ "expliquer"
599
+ ],
600
+ stopwords: [
601
+ "le",
602
+ "la",
603
+ "les",
604
+ "un",
605
+ "une",
606
+ "des",
607
+ "du",
608
+ "au",
609
+ "aux",
610
+ "je",
611
+ "me",
612
+ "mon",
613
+ "est",
614
+ "il",
615
+ "elle",
616
+ "dans",
617
+ "sur",
618
+ "\xE0",
619
+ "pour",
620
+ "de",
621
+ "et",
622
+ "ou",
623
+ "mais",
624
+ "pas",
625
+ "donc",
626
+ "si",
627
+ "par",
628
+ "avec",
629
+ "depuis",
630
+ "que",
631
+ "ce",
632
+ "cette",
633
+ "ces"
634
+ ],
635
+ support: [
636
+ // Commandes / suivi / livraison
637
+ "commande",
638
+ "commandes",
639
+ "colis",
640
+ "envoi",
641
+ "exp\xE9dition",
642
+ "livraison",
643
+ "suivi",
644
+ "retard\xE9",
645
+ "retard",
646
+ "perdu",
647
+ "manquant",
648
+ "annuler",
649
+ "annulation",
650
+ "modifier",
651
+ // Retours / remboursements / échanges
652
+ "retour",
653
+ "retours",
654
+ "\xE9change",
655
+ "remboursement",
656
+ "remplacement",
657
+ "\xE9ligible",
658
+ "\xE9ligibilit\xE9",
659
+ // Problèmes produit
660
+ "garantie",
661
+ "endommag\xE9",
662
+ "cass\xE9",
663
+ "d\xE9fectueux",
664
+ "incorrect",
665
+ "erron\xE9",
666
+ // Compte / connexion
667
+ "mot de passe",
668
+ "motdepasse",
669
+ "connexion",
670
+ "identifiant",
671
+ "compte",
672
+ "verrouill\xE9",
673
+ "v\xE9rification",
674
+ "otp",
675
+ // Fidélité / promos / cadeaux
676
+ "fid\xE9lit\xE9",
677
+ "r\xE9compenses",
678
+ "points",
679
+ "promo",
680
+ "promotion",
681
+ "coupon",
682
+ "remise",
683
+ "r\xE9duction",
684
+ "cadeau",
685
+ // Livraison / paiement / facturation
686
+ "paiement",
687
+ "facturation",
688
+ "factur\xE9",
689
+ "facture",
690
+ "re\xE7u",
691
+ "refus\xE9",
692
+ // Info produit / taille / stock
693
+ "taille",
694
+ "pointure",
695
+ "ajustement",
696
+ "entretien",
697
+ "stock",
698
+ "disponibilit\xE9",
699
+ // Entreprise / politique
700
+ "durabilit\xE9",
701
+ "\xE9thique",
702
+ "carri\xE8res",
703
+ "confidentialit\xE9",
704
+ "conditions",
705
+ // Support humain
706
+ "agent",
707
+ "repr\xE9sentant",
708
+ "support",
709
+ "humain",
710
+ "parler",
711
+ "aide",
712
+ // Technique / service
713
+ "api",
714
+ "panne",
715
+ "serveur",
716
+ "technique",
717
+ "site",
718
+ "paiement",
719
+ "app",
720
+ "application",
721
+ // More
722
+ "remboursement",
723
+ "retard",
724
+ "site web"
725
+ ],
726
+ elisionPrefixes: ["j", "n", "qu", "l", "d", "c", "m", "t", "s"]
727
+ };
728
+ var IT_WORDS = {
729
+ questions: [
730
+ "chi",
731
+ "cosa",
732
+ "che",
733
+ "quando",
734
+ "dove",
735
+ "perch\xE9",
736
+ "perch\xE8",
737
+ "come",
738
+ "quanto",
739
+ "quanti",
740
+ "quante",
741
+ "quale",
742
+ "quali",
743
+ "posso",
744
+ "pu\xF2",
745
+ "possono",
746
+ "devo",
747
+ "deve",
748
+ "dovrebbe",
749
+ "potrebbe",
750
+ "vorrebbe",
751
+ "sar\xE0",
752
+ "ho",
753
+ "ha",
754
+ "hanno",
755
+ "\xE8",
756
+ "sono",
757
+ "fa",
758
+ "fanno",
759
+ "fai"
760
+ ],
761
+ pronouns: [
762
+ "io",
763
+ "mi",
764
+ "me",
765
+ "mio",
766
+ "mia",
767
+ "miei",
768
+ "mie",
769
+ "noi",
770
+ "ci",
771
+ "nostro",
772
+ "nostra",
773
+ "nostri",
774
+ "nostre",
775
+ "tu",
776
+ "ti",
777
+ "te",
778
+ "tuo",
779
+ "tua",
780
+ "tuoi",
781
+ "tue",
782
+ "voi",
783
+ "vi",
784
+ "vostro",
785
+ "vostra",
786
+ "vostri",
787
+ "vostre",
788
+ "lui",
789
+ "lei",
790
+ "suo",
791
+ "sua",
792
+ "suoi",
793
+ "sue",
794
+ "loro"
795
+ ],
796
+ commonVerbs: [
797
+ "\xE8",
798
+ "sono",
799
+ "era",
800
+ "erano",
801
+ "fa",
802
+ "fanno",
803
+ "faceva",
804
+ "ha",
805
+ "ho",
806
+ "hai",
807
+ "abbiamo",
808
+ "avete",
809
+ "hanno",
810
+ "aveva",
811
+ "avevano",
812
+ "bisogno",
813
+ "voglio",
814
+ "vuole",
815
+ "vogliamo",
816
+ "volete",
817
+ "vogliono",
818
+ "cerco",
819
+ "cerca",
820
+ "cerchiamo",
821
+ "cercate",
822
+ "aiuto",
823
+ "aiutare",
824
+ "so",
825
+ "sa",
826
+ "sappiamo",
827
+ "sapete",
828
+ "penso",
829
+ "pensa",
830
+ "pensiamo",
831
+ "faccio",
832
+ "facciamo",
833
+ "fate",
834
+ "creo",
835
+ "creare",
836
+ "trovo",
837
+ "trovare",
838
+ "compro",
839
+ "comprare",
840
+ "uso",
841
+ "usare",
842
+ "installo",
843
+ "installare",
844
+ "riparo",
845
+ "riparare",
846
+ "raccomando",
847
+ "raccomandare",
848
+ "dimmi",
849
+ "dire",
850
+ "mostra",
851
+ "mostrare",
852
+ "confronto",
853
+ "confrontare",
854
+ "spiego",
855
+ "spiegare"
856
+ ],
857
+ stopwords: [
858
+ "il",
859
+ "lo",
860
+ "la",
861
+ "i",
862
+ "gli",
863
+ "le",
864
+ "un",
865
+ "uno",
866
+ "una",
867
+ "io",
868
+ "mi",
869
+ "mio",
870
+ "\xE8",
871
+ "in",
872
+ "su",
873
+ "a",
874
+ "per",
875
+ "di",
876
+ "da",
877
+ "e",
878
+ "ed",
879
+ "o",
880
+ "ma",
881
+ "non",
882
+ "cos\xEC",
883
+ "se",
884
+ "con",
885
+ "che",
886
+ "questo",
887
+ "questa",
888
+ "questi",
889
+ "queste"
890
+ ],
891
+ support: [
892
+ // Ordini / tracciamento / consegna
893
+ "ordine",
894
+ "ordini",
895
+ "pacco",
896
+ "spedizione",
897
+ "consegna",
898
+ "tracciamento",
899
+ "ritardato",
900
+ "ritardo",
901
+ "perso",
902
+ "mancante",
903
+ "annullare",
904
+ "annullamento",
905
+ "modificare",
906
+ // Resi / rimborsi / cambi
907
+ "reso",
908
+ "resi",
909
+ "cambio",
910
+ "rimborso",
911
+ "sostituzione",
912
+ "idoneo",
913
+ "idoneit\xE0",
914
+ // Problemi prodotto
915
+ "garanzia",
916
+ "danneggiato",
917
+ "rotto",
918
+ "difettoso",
919
+ "sbagliato",
920
+ "errato",
921
+ // Account / accesso
922
+ "password",
923
+ "accesso",
924
+ "login",
925
+ "account",
926
+ "bloccato",
927
+ "verifica",
928
+ "otp",
929
+ // Fedeltà / promozioni / regali
930
+ "fedelt\xE0",
931
+ "premi",
932
+ "punti",
933
+ "promozione",
934
+ "promo",
935
+ "coupon",
936
+ "sconto",
937
+ "regalo",
938
+ // Spedizione / pagamento / fatturazione
939
+ "pagamento",
940
+ "fatturazione",
941
+ "addebitato",
942
+ "fattura",
943
+ "ricevuta",
944
+ "rifiutato",
945
+ // Info prodotto / taglie / scorte
946
+ "taglia",
947
+ "misura",
948
+ "vestibilit\xE0",
949
+ "cura",
950
+ "scorta",
951
+ "disponibilit\xE0",
952
+ // Azienda / policy
953
+ "sostenibilit\xE0",
954
+ "etica",
955
+ "carriere",
956
+ "privacy",
957
+ "termini",
958
+ // Supporto umano
959
+ "agente",
960
+ "rappresentante",
961
+ "supporto",
962
+ "umano",
963
+ "parlare",
964
+ "aiuto",
965
+ // Tecnico / servizio
966
+ "api",
967
+ "guasto",
968
+ "server",
969
+ "tecnico",
970
+ "sito",
971
+ "checkout",
972
+ "app",
973
+ // More
974
+ "assistenza",
975
+ "restituzione",
976
+ "stato ordine"
977
+ ],
978
+ elisionPrefixes: ["c", "l", "d", "un", "m", "t", "s", "all", "nell", "dell", "sull", "quell"]
979
+ };
980
+ var NL_WORDS = {
981
+ questions: [
982
+ "wie",
983
+ "wat",
984
+ "wanneer",
985
+ "waar",
986
+ "waarom",
987
+ "hoe",
988
+ "hoeveel",
989
+ "welke",
990
+ "welk",
991
+ "kan",
992
+ "kunt",
993
+ "kunnen",
994
+ "zou",
995
+ "zal",
996
+ "moet",
997
+ "heb",
998
+ "heeft",
999
+ "hebben",
1000
+ "is",
1001
+ "zijn",
1002
+ "doe",
1003
+ "doet",
1004
+ "doen"
1005
+ ],
1006
+ pronouns: [
1007
+ "ik",
1008
+ "mij",
1009
+ "me",
1010
+ "mijn",
1011
+ "wij",
1012
+ "we",
1013
+ "ons",
1014
+ "onze",
1015
+ "jij",
1016
+ "je",
1017
+ "jou",
1018
+ "jouw",
1019
+ "u",
1020
+ "uw",
1021
+ "hij",
1022
+ "hem",
1023
+ "zijn",
1024
+ "zij",
1025
+ "ze",
1026
+ "haar",
1027
+ "hen",
1028
+ "hun",
1029
+ "het"
1030
+ ],
1031
+ commonVerbs: [
1032
+ "is",
1033
+ "zijn",
1034
+ "was",
1035
+ "waren",
1036
+ "doet",
1037
+ "doe",
1038
+ "doen",
1039
+ "deed",
1040
+ "deden",
1041
+ "heb",
1042
+ "heeft",
1043
+ "hebben",
1044
+ "had",
1045
+ "hadden",
1046
+ "nodig",
1047
+ "wil",
1048
+ "willen",
1049
+ "wilde",
1050
+ "zoek",
1051
+ "zoeken",
1052
+ "help",
1053
+ "helpen",
1054
+ "weet",
1055
+ "weten",
1056
+ "denk",
1057
+ "denken",
1058
+ "maak",
1059
+ "maken",
1060
+ "maakte",
1061
+ "cre\xEBer",
1062
+ "cre\xEBren",
1063
+ "vind",
1064
+ "vinden",
1065
+ "vond",
1066
+ "koop",
1067
+ "kopen",
1068
+ "gebruik",
1069
+ "gebruiken",
1070
+ "installeer",
1071
+ "installeren",
1072
+ "repareer",
1073
+ "repareren",
1074
+ "raad",
1075
+ "aanraden",
1076
+ "vertel",
1077
+ "vertellen",
1078
+ "toon",
1079
+ "tonen",
1080
+ "vergelijk",
1081
+ "vergelijken",
1082
+ "leg",
1083
+ "uitleggen"
1084
+ ],
1085
+ stopwords: [
1086
+ "de",
1087
+ "het",
1088
+ "een",
1089
+ "ik",
1090
+ "mij",
1091
+ "mijn",
1092
+ "is",
1093
+ "in",
1094
+ "op",
1095
+ "aan",
1096
+ "naar",
1097
+ "voor",
1098
+ "van",
1099
+ "en",
1100
+ "of",
1101
+ "maar",
1102
+ "niet",
1103
+ "dus",
1104
+ "als",
1105
+ "door",
1106
+ "met",
1107
+ "vanaf",
1108
+ "dat",
1109
+ "dit",
1110
+ "deze",
1111
+ "die",
1112
+ "over"
1113
+ ],
1114
+ support: [
1115
+ // Bestellingen / tracking / levering
1116
+ "bestelling",
1117
+ "bestellingen",
1118
+ "pakket",
1119
+ "zending",
1120
+ "verzending",
1121
+ "levering",
1122
+ "tracking",
1123
+ "vertraagd",
1124
+ "laat",
1125
+ "verloren",
1126
+ "ontbrekend",
1127
+ "annuleren",
1128
+ "wijzigen",
1129
+ // Retouren / terugbetalingen / ruilen
1130
+ "retour",
1131
+ "retourneren",
1132
+ "ruil",
1133
+ "terugbetaling",
1134
+ "restitutie",
1135
+ "vervanging",
1136
+ "geschikt",
1137
+ "geschiktheid",
1138
+ // Productproblemen
1139
+ "garantie",
1140
+ "beschadigd",
1141
+ "kapot",
1142
+ "defect",
1143
+ "verkeerd",
1144
+ "onjuist",
1145
+ // Account / inloggen
1146
+ "wachtwoord",
1147
+ "inloggen",
1148
+ "login",
1149
+ "account",
1150
+ "geblokkeerd",
1151
+ "verificatie",
1152
+ "otp",
1153
+ // Loyaliteit / promoties / cadeaus
1154
+ "loyaliteit",
1155
+ "beloningen",
1156
+ "punten",
1157
+ "promo",
1158
+ "promotie",
1159
+ "kortingsbon",
1160
+ "korting",
1161
+ "cadeau",
1162
+ "cadeaubon",
1163
+ // Verzending / betaling / facturering
1164
+ "verzending",
1165
+ "betaling",
1166
+ "facturering",
1167
+ "gefactureerd",
1168
+ "factuur",
1169
+ "bonnetje",
1170
+ "kassabon",
1171
+ "geweigerd",
1172
+ // Productinfo / maten / voorraad
1173
+ "maat",
1174
+ "pasvorm",
1175
+ "verzorging",
1176
+ "voorraad",
1177
+ "beschikbaarheid",
1178
+ // Bedrijf / beleid
1179
+ "duurzaamheid",
1180
+ "ethiek",
1181
+ "carri\xE8res",
1182
+ "privacy",
1183
+ "voorwaarden",
1184
+ // Menselijke ondersteuning
1185
+ "medewerker",
1186
+ "vertegenwoordiger",
1187
+ "ondersteuning",
1188
+ "mens",
1189
+ "praten",
1190
+ "spreken",
1191
+ "hulp",
1192
+ // Technisch / service
1193
+ "api",
1194
+ "storing",
1195
+ "server",
1196
+ "technisch",
1197
+ "website",
1198
+ "afrekenen",
1199
+ "app",
1200
+ // More
1201
+ "klantenservice",
1202
+ "bestelstatus",
1203
+ "terugsturen"
1204
+ ]
1205
+ };
1206
+ var ES_WORDS = {
1207
+ questions: [
1208
+ "qui\xE9n",
1209
+ "quien",
1210
+ "qu\xE9",
1211
+ "que",
1212
+ "cu\xE1ndo",
1213
+ "cuando",
1214
+ "d\xF3nde",
1215
+ "donde",
1216
+ "porqu\xE9",
1217
+ "porque",
1218
+ "c\xF3mo",
1219
+ "como",
1220
+ "cu\xE1l",
1221
+ "cual",
1222
+ "cu\xE1les",
1223
+ "cuales",
1224
+ "cu\xE1nto",
1225
+ "cuanto",
1226
+ "cu\xE1ntos",
1227
+ "puedo",
1228
+ "puede",
1229
+ "pueden",
1230
+ "podr\xEDa",
1231
+ "deber\xEDa",
1232
+ "ser\xEDa",
1233
+ "ha",
1234
+ "han",
1235
+ "es",
1236
+ "son",
1237
+ "hace",
1238
+ "hacen"
1239
+ ],
1240
+ pronouns: [
1241
+ "yo",
1242
+ "me",
1243
+ "m\xED",
1244
+ "mi",
1245
+ "m\xEDo",
1246
+ "m\xEDa",
1247
+ "m\xEDos",
1248
+ "m\xEDas",
1249
+ "nosotros",
1250
+ "nosotras",
1251
+ "nos",
1252
+ "nuestro",
1253
+ "nuestra",
1254
+ "nuestros",
1255
+ "nuestras",
1256
+ "t\xFA",
1257
+ "tu",
1258
+ "te",
1259
+ "ti",
1260
+ "tuyo",
1261
+ "tuya",
1262
+ "tuyos",
1263
+ "tuyas",
1264
+ "usted",
1265
+ "ustedes",
1266
+ "vosotros",
1267
+ "vosotras",
1268
+ "vuestro",
1269
+ "vuestra",
1270
+ "\xE9l",
1271
+ "ella",
1272
+ "su",
1273
+ "sus",
1274
+ "suyo",
1275
+ "suya",
1276
+ "ellos",
1277
+ "ellas",
1278
+ "les",
1279
+ "los",
1280
+ "las",
1281
+ "le",
1282
+ "la",
1283
+ "lo"
1284
+ ],
1285
+ commonVerbs: [
1286
+ "es",
1287
+ "son",
1288
+ "era",
1289
+ "eran",
1290
+ "est\xE1",
1291
+ "est\xE1n",
1292
+ "hace",
1293
+ "hacen",
1294
+ "hac\xEDa",
1295
+ "ha",
1296
+ "he",
1297
+ "has",
1298
+ "hemos",
1299
+ "hab\xE9is",
1300
+ "han",
1301
+ "hab\xEDa",
1302
+ "hab\xEDan",
1303
+ "necesito",
1304
+ "necesita",
1305
+ "necesitamos",
1306
+ "necesitan",
1307
+ "quiero",
1308
+ "quiere",
1309
+ "queremos",
1310
+ "quer\xE9is",
1311
+ "quieren",
1312
+ "busco",
1313
+ "busca",
1314
+ "buscamos",
1315
+ "buscan",
1316
+ "ayuda",
1317
+ "ayudar",
1318
+ "s\xE9",
1319
+ "sabe",
1320
+ "sabemos",
1321
+ "saben",
1322
+ "pienso",
1323
+ "piensa",
1324
+ "pensamos",
1325
+ "hago",
1326
+ "hacemos",
1327
+ "creo",
1328
+ "crear",
1329
+ "encuentro",
1330
+ "encontrar",
1331
+ "compro",
1332
+ "comprar",
1333
+ "uso",
1334
+ "usar",
1335
+ "instalo",
1336
+ "instalar",
1337
+ "reparo",
1338
+ "reparar",
1339
+ "recomiendo",
1340
+ "recomendar",
1341
+ "dime",
1342
+ "decir",
1343
+ "muestra",
1344
+ "mostrar",
1345
+ "comparo",
1346
+ "comparar",
1347
+ "explico",
1348
+ "explicar"
1349
+ ],
1350
+ stopwords: [
1351
+ "el",
1352
+ "la",
1353
+ "los",
1354
+ "las",
1355
+ "un",
1356
+ "una",
1357
+ "unos",
1358
+ "unas",
1359
+ "yo",
1360
+ "me",
1361
+ "mi",
1362
+ "es",
1363
+ "en",
1364
+ "a",
1365
+ "al",
1366
+ "para",
1367
+ "de",
1368
+ "del",
1369
+ "y",
1370
+ "e",
1371
+ "o",
1372
+ "u",
1373
+ "pero",
1374
+ "no",
1375
+ "as\xED",
1376
+ "si",
1377
+ "por",
1378
+ "con",
1379
+ "desde",
1380
+ "que",
1381
+ "este",
1382
+ "esta",
1383
+ "estos",
1384
+ "estas",
1385
+ "sobre"
1386
+ ],
1387
+ support: [
1388
+ // Pedidos / seguimiento / entrega
1389
+ "pedido",
1390
+ "pedidos",
1391
+ "paquete",
1392
+ "env\xEDo",
1393
+ "entrega",
1394
+ "seguimiento",
1395
+ "retrasado",
1396
+ "tarde",
1397
+ "perdido",
1398
+ "faltante",
1399
+ "cancelar",
1400
+ "cancelaci\xF3n",
1401
+ "modificar",
1402
+ // Devoluciones / reembolsos / cambios
1403
+ "devoluci\xF3n",
1404
+ "devoluciones",
1405
+ "cambio",
1406
+ "reembolso",
1407
+ "reemplazo",
1408
+ "elegible",
1409
+ "elegibilidad",
1410
+ // Problemas de producto
1411
+ "garant\xEDa",
1412
+ "da\xF1ado",
1413
+ "roto",
1414
+ "defectuoso",
1415
+ "incorrecto",
1416
+ "equivocado",
1417
+ // Cuenta / acceso
1418
+ "contrase\xF1a",
1419
+ "acceso",
1420
+ "login",
1421
+ "cuenta",
1422
+ "bloqueada",
1423
+ "bloqueado",
1424
+ "verificaci\xF3n",
1425
+ "otp",
1426
+ // Fidelidad / promos / regalos
1427
+ "fidelidad",
1428
+ "recompensas",
1429
+ "puntos",
1430
+ "promo",
1431
+ "promoci\xF3n",
1432
+ "cup\xF3n",
1433
+ "descuento",
1434
+ "regalo",
1435
+ // Envío / pago / facturación
1436
+ "env\xEDo",
1437
+ "pago",
1438
+ "facturaci\xF3n",
1439
+ "cobrado",
1440
+ "cargo",
1441
+ "factura",
1442
+ "recibo",
1443
+ "rechazado",
1444
+ // Info producto / tallas / stock
1445
+ "talla",
1446
+ "tama\xF1o",
1447
+ "ajuste",
1448
+ "cuidado",
1449
+ "inventario",
1450
+ "disponibilidad",
1451
+ // Empresa / política
1452
+ "sostenibilidad",
1453
+ "\xE9tica",
1454
+ "carreras",
1455
+ "privacidad",
1456
+ "t\xE9rminos",
1457
+ // Soporte humano
1458
+ "agente",
1459
+ "representante",
1460
+ "soporte",
1461
+ "humano",
1462
+ "hablar",
1463
+ "ayuda",
1464
+ // Técnico / servicio
1465
+ "api",
1466
+ "fallo",
1467
+ "servidor",
1468
+ "t\xE9cnico",
1469
+ "sitio",
1470
+ "pago",
1471
+ "app",
1472
+ // More
1473
+ "atenci\xF3n al cliente",
1474
+ "estado del pedido",
1475
+ "devolver",
1476
+ "empleo",
1477
+ "trabajo"
1478
+ ]
1479
+ };
1480
+ var DEFAULT_WORDS = {
1481
+ "en-gb": EN_WORDS,
1482
+ "en-us": EN_WORDS,
1483
+ "en-ca": EN_WORDS,
1484
+ "de-de": DE_WORDS,
1485
+ "fr-fr": FR_WORDS,
1486
+ "fr-ca": FR_WORDS,
1487
+ "it-it": IT_WORDS,
1488
+ "nl-nl": NL_WORDS,
1489
+ "es-es": ES_WORDS,
1490
+ "es-us": ES_WORDS
1491
+ };
1492
+ var DEFAULT_LOCALE = "en-us";
1493
+ var resolveDefaultWords = (locale) => {
1494
+ var _a, _b;
1495
+ return (_b = DEFAULT_WORDS[(_a = locale == null ? void 0 : locale.toLowerCase()) != null ? _a : DEFAULT_LOCALE]) != null ? _b : DEFAULT_WORDS[DEFAULT_LOCALE];
1496
+ };
1497
+
1
1498
  // src/utils.ts
2
1499
  var isPunct = (s) => !/\w/.test(s);
3
- var CONTRACTIONS = {
4
- "won't": "will not",
5
- "can't": "cannot",
6
- "don't": "do not",
7
- "doesn't": "does not",
8
- "didn't": "did not",
9
- "isn't": "is not",
10
- "aren't": "are not",
11
- "wasn't": "was not",
12
- "weren't": "were not",
13
- "haven't": "have not",
14
- "hasn't": "has not",
15
- "hadn't": "had not",
16
- "wouldn't": "would not",
17
- "shouldn't": "should not",
18
- "couldn't": "could not",
19
- "what's": "what is",
20
- "what're": "what are",
21
- "how's": "how is",
22
- "where's": "where is",
23
- "who's": "who is",
24
- "that's": "that is",
25
- "there's": "there is",
26
- "it's": "it is",
27
- "i'm": "i am",
28
- "i'd": "i would",
29
- "i'll": "i will",
30
- "i've": "i have",
31
- "we're": "we are",
32
- "we've": "we have",
33
- "we'd": "we would",
34
- "they're": "they are",
35
- "they've": "they have",
36
- "you're": "you are",
37
- "you've": "you have",
38
- "you'd": "you would"
1500
+ var splitElisions = (query, prefixes) => {
1501
+ if (!prefixes || prefixes.length === 0) return query;
1502
+ const pattern = new RegExp(`\\b(${prefixes.join("|")})'(?=\\w)`, "gi");
1503
+ return query.replace(pattern, "$1' ");
39
1504
  };
40
- var expandContractions = (query) => query.replace(/[\w']+/g, (word) => {
41
- var _a;
42
- return (_a = CONTRACTIONS[word]) != null ? _a : word;
43
- });
44
- var tokenize = (query) => expandContractions(query).split(/\s+/).filter(Boolean);
1505
+ var expandContractions = (query, contractions) => {
1506
+ if (!contractions) return query;
1507
+ return query.replace(/[\w']+/g, (word) => {
1508
+ var _a;
1509
+ return (_a = contractions[word]) != null ? _a : word;
1510
+ });
1511
+ };
1512
+ var tokenize = (query, locale) => {
1513
+ const words = resolveDefaultWords(locale);
1514
+ const elided = splitElisions(query, words.elisionPrefixes);
1515
+ const expanded = expandContractions(elided, words.contractions);
1516
+ return expanded.split(/\s+/).filter(Boolean);
1517
+ };
1518
+ var matchPhrases = (a) => {
1519
+ const matched = [];
1520
+ for (const phrase of a.phrases) {
1521
+ const phraseTokens = phrase.split(/\s+/).filter(Boolean);
1522
+ if (phraseTokens.length === 0) continue;
1523
+ if (phraseTokens.length === 1) {
1524
+ if (a.tokens.includes(phraseTokens[0])) matched.push(phrase);
1525
+ continue;
1526
+ }
1527
+ for (let i = 0; i <= a.tokens.length - phraseTokens.length; i++) {
1528
+ let hit = true;
1529
+ for (let j = 0; j < phraseTokens.length; j++) {
1530
+ if (a.tokens[i + j] !== phraseTokens[j]) {
1531
+ hit = false;
1532
+ break;
1533
+ }
1534
+ }
1535
+ if (hit) {
1536
+ matched.push(phrase);
1537
+ break;
1538
+ }
1539
+ }
1540
+ }
1541
+ return matched;
1542
+ };
1543
+ var countPhraseTokens = (phrases) => phrases.reduce((sum, p) => sum + p.split(/\s+/).filter(Boolean).length, 0);
45
1544
 
46
1545
  // src/modes/length.ts
47
1546
  var checkLength = (value, c) => {
@@ -83,263 +1582,79 @@ var checkWord = (word, c) => {
83
1582
  };
84
1583
  var checkList = (lower, c) => checkPuncts(lower, c) && tokenize(lower).every((word) => checkWord(word, c));
85
1584
 
86
- // src/enums.ts
87
- var DEFAULT_SUPPORT_WORDS = [
88
- // Orders / tracking / delivery
89
- "order",
90
- "package",
91
- "shipment",
92
- "tracking",
93
- "delivery",
94
- "delayed",
95
- "late",
96
- "lost",
97
- "missing",
98
- "cancel",
99
- "modify",
100
- // Returns / refunds / exchanges
101
- "return",
102
- "exchange",
103
- "refund",
104
- "replacement",
105
- "eligible",
106
- "eligibility",
107
- // 'money back',
108
- // Product issues
109
- "warranty",
110
- "damaged",
111
- "broken",
112
- "defective",
113
- "wrong",
114
- "incorrect",
115
- // Account / login
116
- "password",
117
- "login",
118
- // 'sign in',
119
- "account",
120
- "locked",
121
- "verification",
122
- "otp",
123
- // Loyalty / promos / gift cards
124
- "loyalty",
125
- "rewards",
126
- "points",
127
- "promo",
128
- "coupon",
129
- "discount",
130
- "gift",
131
- // Shipping / payments / billing
132
- "shipping",
133
- "payment",
134
- "billing",
135
- "charged",
136
- "charge",
137
- "invoice",
138
- "receipt",
139
- "declined",
140
- // Product info / sizing / inventory
141
- "size",
142
- "sizing",
143
- "fit",
144
- "care",
145
- "stock",
146
- "restock",
147
- "availability",
148
- // Company / policy
149
- "sustainability",
150
- "ethics",
151
- "careers",
152
- "privacy",
153
- "terms",
154
- // Human support
155
- "agent",
156
- "representative",
157
- "support",
158
- "human",
159
- "talk",
160
- "speak",
161
- "help",
162
- // Technical / service issues
163
- "api",
164
- "failure",
165
- "server",
166
- "technical",
167
- "website",
168
- "checkout",
169
- "app",
170
- "something"
171
- ];
172
- var DEFAULT_QUESTION_WORDS = [
173
- "who",
174
- "what",
175
- "when",
176
- "where",
177
- "why",
178
- "how",
179
- "which",
180
- "can",
181
- "should",
182
- "could",
183
- "would",
184
- "will",
185
- "have",
186
- "has",
187
- "is",
188
- "are",
189
- "do",
190
- "does",
191
- "did"
192
- ];
193
- var DEFAULT_PRONOUNS = [
194
- "i",
195
- "me",
196
- "my",
197
- "mine",
198
- "we",
199
- "us",
200
- "our",
201
- "you",
202
- "your",
203
- "it",
204
- "he",
205
- "him",
206
- "his",
207
- "she",
208
- "her",
209
- "they",
210
- "them",
211
- "their"
212
- ];
213
- var DEFAULT_COMMON_VERBS = [
214
- "is",
215
- "are",
216
- "was",
217
- "were",
218
- "do",
219
- "does",
220
- "did",
221
- "have",
222
- "need",
223
- "want",
224
- "look",
225
- "help",
226
- "know",
227
- "think",
228
- "make",
229
- "create",
230
- "find",
231
- "get",
232
- "buy",
233
- "use",
234
- "install",
235
- "fix",
236
- "recommend",
237
- "tell",
238
- "show",
239
- "compare",
240
- "explain"
241
- ];
242
- var DEFAULT_STOPWORDS = [
243
- "the",
244
- "a",
245
- "an",
246
- "i",
247
- "me",
248
- "my",
249
- "is",
250
- "it",
251
- "in",
252
- "on",
253
- "at",
254
- "to",
255
- "for",
256
- "of",
257
- "and",
258
- "or",
259
- "but",
260
- "not",
261
- "so",
262
- "if",
263
- "by",
264
- "with",
265
- "from",
266
- "that",
267
- "this",
268
- "about"
269
- ];
270
-
271
1585
  // src/modes/score.ts
272
1586
  var scoreQuery = (query, c) => {
273
1587
  var _a, _b, _c, _d, _e;
274
- const tokens = tokenize(query);
1588
+ const tokens = tokenize(query, c.locale);
275
1589
  if (tokens.length === 0) return true;
276
- const questionWords = (_a = c.scoreQuestionWords) != null ? _a : DEFAULT_QUESTION_WORDS;
277
- const pronouns = (_b = c.scorePronouns) != null ? _b : DEFAULT_PRONOUNS;
278
- const commonVerbs = (_c = c.scoreCommonVerbs) != null ? _c : DEFAULT_COMMON_VERBS;
279
- const stopwords = (_d = c.scoreStopwords) != null ? _d : DEFAULT_STOPWORDS;
280
- const supportWords = (_e = c.scoreSupportWords) != null ? _e : DEFAULT_SUPPORT_WORDS;
281
- const matchedSupportWords = tokens.filter((t) => supportWords.includes(t));
1590
+ const defaults = resolveDefaultWords(c.locale);
1591
+ const questionWords = (_a = c.scoreQuestionWords) != null ? _a : defaults.questions;
1592
+ const pronouns = (_b = c.scorePronouns) != null ? _b : defaults.pronouns;
1593
+ const commonVerbs = (_c = c.scoreCommonVerbs) != null ? _c : defaults.commonVerbs;
1594
+ const stopwords = (_d = c.scoreStopwords) != null ? _d : defaults.stopwords;
1595
+ const supportWords = (_e = c.scoreSupportWords) != null ? _e : defaults.support;
1596
+ const matchedSupportWords = matchPhrases({ tokens, phrases: supportWords });
282
1597
  if (matchedSupportWords.length > 0) {
283
- console.log(` [H] support words: found [${matchedSupportWords.join(", ")}] \u2192 conversational (override)`);
1598
+ console.log(` [A] support words: found [${matchedSupportWords.join(", ")}] \u2192 conversational (override)`);
284
1599
  return false;
285
1600
  }
286
1601
  let scoreKeyword = 0;
287
1602
  let scoreConversational = 0;
288
1603
  if (tokens.length <= 3) {
289
1604
  scoreKeyword += 2;
290
- console.log(` [A] token count: word count=${tokens.length} \u22643 \u2192 keyword +2`);
1605
+ console.log(` [B] token count: word count=${tokens.length} \u22643 \u2192 keyword +2`);
291
1606
  } else if (tokens.length >= 6) {
292
1607
  scoreConversational += 2;
293
- console.log(` [A] token count: word count=${tokens.length} \u22656 \u2192 conversational +2`);
1608
+ console.log(` [B] token count: word count=${tokens.length} \u22656 \u2192 conversational +2`);
294
1609
  } else {
295
- console.log(` [A] token count: word count=${tokens.length} (no score)`);
1610
+ console.log(` [B] token count: word count=${tokens.length} (no score)`);
296
1611
  }
297
- const matchedQuestionWords = tokens.filter((t) => questionWords.includes(t));
1612
+ const matchedQuestionWords = matchPhrases({ tokens, phrases: questionWords });
298
1613
  if (matchedQuestionWords.length > 0) {
299
1614
  scoreConversational += 2;
300
- console.log(` [B] question words: found [${matchedQuestionWords.join(", ")}] \u2192 conversational +2`);
1615
+ console.log(` [C] question words: found [${matchedQuestionWords.join(", ")}] \u2192 conversational +2`);
301
1616
  } else {
302
- console.log(` [B] question words: none`);
1617
+ console.log(` [C] question words: none`);
303
1618
  }
304
- const matchedPronouns = tokens.filter((t) => pronouns.includes(t));
1619
+ const matchedPronouns = matchPhrases({ tokens, phrases: pronouns });
305
1620
  if (matchedPronouns.length > 0) {
306
1621
  scoreConversational += 1;
307
- console.log(` [C] pronouns: found [${matchedPronouns.join(", ")}] \u2192 conversational +1`);
1622
+ console.log(` [D] pronouns: found [${matchedPronouns.join(", ")}] \u2192 conversational +1`);
308
1623
  } else {
309
- console.log(` [C] pronouns: none`);
1624
+ console.log(` [D] pronouns: none`);
310
1625
  }
311
- const matchedVerbs = tokens.filter((t) => commonVerbs.includes(t));
1626
+ const matchedVerbs = matchPhrases({ tokens, phrases: commonVerbs });
312
1627
  if (matchedVerbs.length > 0) {
313
1628
  scoreConversational += 1;
314
- console.log(` [D] common verbs: found [${matchedVerbs.join(", ")}] \u2192 conversational +1`);
1629
+ console.log(` [E] common verbs: found [${matchedVerbs.join(", ")}] \u2192 conversational +1`);
315
1630
  } else {
316
- console.log(` [D] common verbs: none`);
1631
+ console.log(` [E] common verbs: none`);
317
1632
  }
318
1633
  if (query.includes("?")) {
319
1634
  scoreConversational += 3;
320
- console.log(` [E] question mark: found \u2192 conversational +3`);
1635
+ console.log(` [F] question mark: found \u2192 conversational +3`);
321
1636
  } else {
322
- console.log(` [E] question mark: none`);
1637
+ console.log(` [F] question mark: none`);
323
1638
  }
324
- const stopwordCount = tokens.filter((t) => stopwords.includes(t)).length;
1639
+ const stopwordCount = countPhraseTokens(matchPhrases({ tokens, phrases: stopwords }));
325
1640
  const stopwordRatio = stopwordCount / tokens.length;
326
1641
  if (stopwordRatio > 0.4) {
327
1642
  scoreConversational += 2;
328
1643
  console.log(
329
- ` [F] stopword ratio: ${stopwordRatio.toFixed(2)} (${stopwordCount}/${tokens.length}) >0.4 \u2192 conversational +2`
1644
+ ` [G] stopword ratio: ${stopwordRatio.toFixed(2)} (${stopwordCount}/${tokens.length}) >0.4 \u2192 conversational +2`
330
1645
  );
331
1646
  } else {
332
1647
  scoreKeyword += 1;
333
1648
  console.log(
334
- ` [F] stopword ratio: ${stopwordRatio.toFixed(2)} (${stopwordCount}/${tokens.length}) \u22640.4 \u2192 keyword +1`
1649
+ ` [G] stopword ratio: ${stopwordRatio.toFixed(2)} (${stopwordCount}/${tokens.length}) \u22640.4 \u2192 keyword +1`
335
1650
  );
336
1651
  }
337
1652
  const avgLen = tokens.reduce((sum, t) => sum + t.length, 0) / tokens.length;
338
1653
  if (avgLen >= 6) {
339
1654
  scoreKeyword += 1;
340
- console.log(` [G] avg token length: ${avgLen.toFixed(2)} \u22656 \u2192 keyword +1`);
1655
+ console.log(` [H] avg token length: ${avgLen.toFixed(2)} \u22656 \u2192 keyword +1`);
341
1656
  } else {
342
- console.log(` [G] avg token length: ${avgLen.toFixed(2)} (no score)`);
1657
+ console.log(` [H] avg token length: ${avgLen.toFixed(2)} (no score)`);
343
1658
  }
344
1659
  const result = scoreKeyword >= scoreConversational;
345
1660
  console.log(
@@ -406,7 +1721,7 @@ var isSearch = (value, config) => {
406
1721
  const c = resolveConfig(config);
407
1722
  const lower = value.toLowerCase();
408
1723
  const tokens = tokenize(lower);
409
- console.group(`[isSearch] "${value}" | mode=${c.mode} | tokens=[${tokens.join(", ")}]`);
1724
+ console.group(`[isSearch] "${value}" | mode=${c.mode} | tokens=[${tokens.join(", ")}] | locale=${c.locale}`);
410
1725
  if (c.mode === "mixed" || c.mode === "list") {
411
1726
  console.log(
412
1727
  `lists: blackWordSet=${(_b = (_a = c.blackWordSet) == null ? void 0 : _a.size) != null ? _b : 0} blackPunctSet=${(_d = (_c = c.blackPunctSet) == null ? void 0 : _c.size) != null ? _d : 0} whiteSet=${(_f = (_e = c.whiteSet) == null ? void 0 : _e.size) != null ? _f : 0} whiteList=${(_h = (_g = c.whiteList) == null ? void 0 : _g.length) != null ? _h : 0}`