@bloomreach/clarity-utils 1.0.2 → 1.0.4

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