文件
ChatBot/EasyTools.js

27 行
699 B
JavaScript

"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
// EasyTools : 提供语言分析(不准确)
const Width = 5; //默认权重
var FIn = ((Arr, Location, IsIt) => {
var Back = false;
for (var i = -(Width - 1) / 2; i < Width; i++) {
if (Arr[Location.valueOf() + i] == IsIt) {
Back = true;
}
}
return Back;
});
exports.EasyTools = {
分析: ((A, B) => {
var KeyA = A.split("");
var KeyB = B.split("");
var EC = 0;
KeyA.forEach((v, i) => {
if (FIn(KeyB, i, v)) {
EC = EC + 1;
}
});
return (EC / (KeyA.length + KeyB.length) * 2);
})
};