wingbot 3.67.14 → 3.67.16
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 +1 -1
- package/src/Responder.js +4 -1
- package/src/ReturnSender.js +19 -0
- package/src/fuzzy/levenshtein.js +2 -4
package/package.json
CHANGED
package/src/Responder.js
CHANGED
|
@@ -247,7 +247,10 @@ class Responder {
|
|
|
247
247
|
limit,
|
|
248
248
|
onlyFlag
|
|
249
249
|
);
|
|
250
|
-
const { responseTexts = [] } =
|
|
250
|
+
const { responseTexts = [], requestTexts = [] } = this._messageSender;
|
|
251
|
+
transcript.push(...requestTexts.map((text) => ({
|
|
252
|
+
fromBot: false, text
|
|
253
|
+
})));
|
|
251
254
|
transcript.push(...responseTexts.map((text) => ({
|
|
252
255
|
fromBot: true, text
|
|
253
256
|
})));
|
package/src/ReturnSender.js
CHANGED
|
@@ -212,6 +212,25 @@ class ReturnSender {
|
|
|
212
212
|
return this._simulatesOptIn;
|
|
213
213
|
}
|
|
214
214
|
|
|
215
|
+
/**
|
|
216
|
+
* @returns {string[]}
|
|
217
|
+
*/
|
|
218
|
+
get requestTexts () {
|
|
219
|
+
const text = extractText(this._incommingMessage);
|
|
220
|
+
|
|
221
|
+
if (!text) {
|
|
222
|
+
return [];
|
|
223
|
+
}
|
|
224
|
+
|
|
225
|
+
const filter = this._confidentInput
|
|
226
|
+
? this.confidentInputFilter
|
|
227
|
+
: this.textFilter;
|
|
228
|
+
|
|
229
|
+
return [
|
|
230
|
+
filter(text).trim()
|
|
231
|
+
];
|
|
232
|
+
}
|
|
233
|
+
|
|
215
234
|
/**
|
|
216
235
|
* @returns {string[]}
|
|
217
236
|
*/
|
package/src/fuzzy/levenshtein.js
CHANGED
|
@@ -156,9 +156,8 @@ function relativeLevenshtein (
|
|
|
156
156
|
|
|
157
157
|
const leftNum = left.replace(/[^0-9]+/g, '');
|
|
158
158
|
const rightNum = right.replace(/[^0-9]+/g, '');
|
|
159
|
-
const numLen =
|
|
160
|
-
const
|
|
161
|
-
const numLev = numLen ? levenshtein(leftNum, rightNum) * useNumK : 0;
|
|
159
|
+
const numLen = Math.max(leftNum.length, rightNum.length);
|
|
160
|
+
const numLev = numLen ? levenshtein(leftNum, rightNum) * NUMERIC_KOEF : 0;
|
|
162
161
|
|
|
163
162
|
if (stemLen < 3) {
|
|
164
163
|
return addSeed(seed, len + numLen, levenshtein(left, right) + numLev) * wordHandicap;
|
|
@@ -190,7 +189,6 @@ function relativeLevenshtein (
|
|
|
190
189
|
|
|
191
190
|
const r = (vStem + vSuffix) * wordHandicap;
|
|
192
191
|
|
|
193
|
-
// console.log(`#levenshtein "${left}" <- ${right}: ${r.toFixed(3)}`);
|
|
194
192
|
return r;
|
|
195
193
|
}
|
|
196
194
|
|