You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
24 lines
689 B
24 lines
689 B
4 years ago
|
import logging
|
||
|
|
||
|
from discord.ext import commands
|
||
|
|
||
|
from miyu_bot.commands.common.fuzzy_matching import romanize, FuzzyMatcher
|
||
|
|
||
|
|
||
|
class Utility(commands.Cog):
|
||
|
def __init__(self, bot: commands.Bot):
|
||
|
self.bot = bot
|
||
|
self.logger = logging.getLogger(__name__)
|
||
|
|
||
|
@commands.command(hidden=True)
|
||
|
async def romanize(self, ctx: commands.Context, *, arg: str):
|
||
|
await ctx.send(romanize(arg))
|
||
|
|
||
|
@commands.command(hidden=True, ignore_extra=False)
|
||
|
async def similarity_score(self, ctx: commands.Context, source: str, target: str):
|
||
|
await ctx.send(str(FuzzyMatcher().score(romanize(source), romanize(target))))
|
||
|
|
||
|
|
||
|
def setup(bot):
|
||
|
bot.add_cog(Utility(bot))
|