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