wingbot 3.26.0 → 3.26.1
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/package.json
CHANGED
|
@@ -194,8 +194,14 @@ class CustomEntityDetectionModel {
|
|
|
194
194
|
}
|
|
195
195
|
}
|
|
196
196
|
|
|
197
|
-
_escapeRegex (string) {
|
|
198
|
-
|
|
197
|
+
_escapeRegex (string, shouldReplaceDiacritics) {
|
|
198
|
+
const ret = string.replace(/[-/\\^$*+?.()|[\]{}]/g, '\\$&');
|
|
199
|
+
|
|
200
|
+
if (!shouldReplaceDiacritics) {
|
|
201
|
+
return ret;
|
|
202
|
+
}
|
|
203
|
+
|
|
204
|
+
return replaceDiacritics(ret);
|
|
199
205
|
}
|
|
200
206
|
|
|
201
207
|
/**
|
|
@@ -426,7 +432,7 @@ class CustomEntityDetectionModel {
|
|
|
426
432
|
let replaced = source.replace(/@[A-Z0-9-]+/g, (value) => {
|
|
427
433
|
const matchingEntities = entities
|
|
428
434
|
.filter((e) => `@${e.entity.toUpperCase()}` === value)
|
|
429
|
-
.map((e) => this._escapeRegex(e.text));
|
|
435
|
+
.map((e) => this._escapeRegex(e.text, options.replaceDiacritics));
|
|
430
436
|
|
|
431
437
|
if (matchingEntities.length === 0) {
|
|
432
438
|
return value;
|