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