wingbot 3.68.1 → 3.68.3
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
package/src/Ai.js
CHANGED
|
@@ -282,6 +282,7 @@ class Ai {
|
|
|
282
282
|
* @param {Function|string} [options.extractValue] - entity extractor
|
|
283
283
|
* @param {boolean} [options.matchWholeWords] - match whole words at regular expression
|
|
284
284
|
* @param {boolean} [options.replaceDiacritics] - keep diacritics when matching regexp
|
|
285
|
+
* @param {boolean} [options.caseSensitiveRegex] - make regex case sensitive
|
|
285
286
|
* @param {string[]} [options.dependencies] - array of dependent entities
|
|
286
287
|
* @param {boolean} [options.clearOverlaps] - let longer entities from NLP to replace entity
|
|
287
288
|
* @returns {this}
|
|
@@ -110,12 +110,12 @@ function conversationsApi (
|
|
|
110
110
|
subscribtions
|
|
111
111
|
});
|
|
112
112
|
} else if (options.mapper) {
|
|
113
|
-
mapState = (d) =>
|
|
114
|
-
...d,
|
|
113
|
+
mapState = (d) => ({
|
|
114
|
+
...mapObject(d, defaultMapperFactory(options.mapper)),
|
|
115
115
|
lastInteraction: d.lastInteraction || (new Date(0)),
|
|
116
116
|
history,
|
|
117
117
|
subscribtions
|
|
118
|
-
}
|
|
118
|
+
});
|
|
119
119
|
} else {
|
|
120
120
|
mapState = (d) => ({
|
|
121
121
|
...d,
|
|
@@ -58,6 +58,7 @@ const { iterateThroughWords } = require('../utils/ai');
|
|
|
58
58
|
* @prop {Function|string} [extractValue] - entity extractor
|
|
59
59
|
* @prop {boolean} [matchWholeWords] - match whole words at regular expression
|
|
60
60
|
* @prop {boolean} [replaceDiacritics] - keep diacritics when matching regexp
|
|
61
|
+
* @prop {boolean} [options.caseSensitiveRegex] - make regex case sensitive
|
|
61
62
|
* @prop {string[]} [dependencies] - array of dependent entities
|
|
62
63
|
* @prop {boolean} [clearOverlaps] - let longer entities from NLP to replace entity
|
|
63
64
|
*/
|
|
@@ -576,6 +577,7 @@ class CustomEntityDetectionModel {
|
|
|
576
577
|
* @param {boolean} [options.matchWholeWords] - match whole words at regular expression
|
|
577
578
|
* @param {boolean} [options.replaceDiacritics] - replace diacritics when matching regexp
|
|
578
579
|
* @param {string[]} [options.dependencies] - array of dependent entities
|
|
580
|
+
* @param {boolean} [options.caseSensitiveRegex] - make regex case sensitive
|
|
579
581
|
*/
|
|
580
582
|
_regexpToDetector (regexp, options) {
|
|
581
583
|
const { dependencies = [], extractValue = null } = options;
|
|
@@ -609,9 +611,13 @@ class CustomEntityDetectionModel {
|
|
|
609
611
|
replaced = `(?<=(^|[^a-z0-9\u00C0-\u017F]))${replaced}(?=([^a-z0-9\u00C0-\u017F]|$))`;
|
|
610
612
|
}
|
|
611
613
|
|
|
612
|
-
const r = new RegExp(replaced, 'i');
|
|
613
|
-
const lc =
|
|
614
|
+
const r = new RegExp(replaced, options.caseSensitiveRegex ? '' : 'i');
|
|
615
|
+
const lc = options.caseSensitiveRegex
|
|
616
|
+
? text
|
|
617
|
+
: text.toLocaleLowerCase();
|
|
618
|
+
|
|
614
619
|
let matchText = lc;
|
|
620
|
+
|
|
615
621
|
if (options.replaceDiacritics) {
|
|
616
622
|
matchText = replaceDiacritics(matchText);
|
|
617
623
|
}
|