Use jaccard in percent-diff

This commit is contained in:
Dragon Fire
2021-05-16 13:15:08 -04:00
parent 882ce7a7e3
commit ffc1528f09
3 changed files with 11 additions and 9 deletions
+3 -1
View File
@@ -108,5 +108,7 @@
"You will be called upon to help a friend in trouble.", "You will be called upon to help a friend in trouble.",
"You will hear pleasant news.", "You will hear pleasant news.",
"Your power is in your ability to decide.", "Your power is in your ability to decide.",
"When two men in a business always agree, one of them is unnecessary." "When two men in a business always agree, one of them is unnecessary.",
"The change you started already has far-reaching effects. Be ready.",
"When you begin to coast you're on the downgrade."
] ]
+2 -2
View File
@@ -1,5 +1,5 @@
const Command = require('../../structures/Command'); const Command = require('../../structures/Command');
const stringSimilarity = require('string-similarity'); const wuzzy = require('wuzzy');
module.exports = class PercentDiffCommand extends Command { module.exports = class PercentDiffCommand extends Command {
constructor(client) { constructor(client) {
@@ -25,7 +25,7 @@ module.exports = class PercentDiffCommand extends Command {
} }
run(msg, { text1, text2 }) { run(msg, { text1, text2 }) {
const diff = stringSimilarity.compareTwoStrings(text1, text2); const diff = wuzzy.jaccard(text1.toLowerCase(), text2.toLowerCase());
return msg.reply(`${Math.round(diff * 100)}%`); return msg.reply(`${Math.round(diff * 100)}%`);
} }
}; };
+6 -6
View File
@@ -1,6 +1,6 @@
{ {
"name": "xiao", "name": "xiao",
"version": "139.6.0", "version": "139.6.1",
"description": "Your personal server companion.", "description": "Your personal server companion.",
"main": "Xiao.js", "main": "Xiao.js",
"private": true, "private": true,
@@ -49,7 +49,7 @@
"discord.js": "^12.5.3", "discord.js": "^12.5.3",
"discord.js-commando": "github:discordjs/Commando", "discord.js-commando": "github:discordjs/Commando",
"discord.js-docs": "github:TeeSeal/discord.js-docs", "discord.js-docs": "github:TeeSeal/discord.js-docs",
"dotenv": "^9.0.0", "dotenv": "^9.0.2",
"emoji-regex": "^9.2.2", "emoji-regex": "^9.2.2",
"eslint": "^7.26.0", "eslint": "^7.26.0",
"fen-validator": "^1.4.1", "fen-validator": "^1.4.1",
@@ -65,7 +65,7 @@
"kuroshiro": "^1.1.2", "kuroshiro": "^1.1.2",
"kuroshiro-analyzer-kuromoji": "^1.1.0", "kuroshiro-analyzer-kuromoji": "^1.1.0",
"leven": "^3.1.0", "leven": "^3.1.0",
"mathjs": "^9.3.2", "mathjs": "^9.4.0",
"moment": "^2.29.1", "moment": "^2.29.1",
"moment-duration-format": "^2.3.2", "moment-duration-format": "^2.3.2",
"moment-timezone": "^0.5.33", "moment-timezone": "^0.5.33",
@@ -79,16 +79,16 @@
"semver": "^7.3.5", "semver": "^7.3.5",
"sherlockjs": "^1.4.0", "sherlockjs": "^1.4.0",
"stackblur-canvas": "^2.5.0", "stackblur-canvas": "^2.5.0",
"string-similarity": "^4.0.4",
"tesseract.js": "^2.1.4", "tesseract.js": "^2.1.4",
"text-diff": "^1.0.1", "text-diff": "^1.0.1",
"tictactoe-minimax-ai": "^1.2.1", "tictactoe-minimax-ai": "^1.2.1",
"twemoji-parser": "^13.0.0", "twemoji-parser": "^13.0.0",
"user-agents": "^1.0.646", "user-agents": "^1.0.654",
"valid-url": "^1.0.9", "valid-url": "^1.0.9",
"wavefile": "^11.0.0", "wavefile": "^11.0.0",
"winston": "^3.3.3", "winston": "^3.3.3",
"ytdl-core": "^4.7.0", "wuzzy": "^0.1.7",
"ytdl-core": "^4.8.0",
"zip-to-timezone": "^1.1.5" "zip-to-timezone": "^1.1.5"
}, },
"optionalDependencies": { "optionalDependencies": {