diff options
| author | 2023-11-15 10:15:12 +0800 | |
|---|---|---|
| committer | 2023-11-15 10:15:12 +0800 | |
| commit | dfecacde300b0a38907fb6a1d4aa22a202b57f0d (patch) | |
| tree | 29f60fdbffdbf72e437db3d4797df4baab9cbba2 /example/plugins/tf/__init__.py | |
| parent | db609bc298b8fe9f63de4263fa4ac99b197bf0cd (diff) | |
| download | HydroRoll-dfecacde300b0a38907fb6a1d4aa22a202b57f0d.tar.gz HydroRoll-dfecacde300b0a38907fb6a1d4aa22a202b57f0d.zip | |
refactor: embedded BasePluginConfig in utils
Diffstat (limited to 'example/plugins/tf/__init__.py')
| -rw-r--r-- | example/plugins/tf/__init__.py | 52 |
1 files changed, 0 insertions, 52 deletions
diff --git a/example/plugins/tf/__init__.py b/example/plugins/tf/__init__.py deleted file mode 100644 index ce78d97..0000000 --- a/example/plugins/tf/__init__.py +++ /dev/null @@ -1,52 +0,0 @@ - -from iamai import Plugin -from iamai.log import logger as _logger -from HydroRoll.models.cos_sim import cosSim -import jieba - -logger = _logger - - -texts = [ - "你好 HydroRoll", - "你好 水系", - "hi 水系", - "hi HydroRoll", - "hello 水系", - "hello HydroRoll", - "hola 水系", - "hola HydroRoll", -] - -cos_Sim = cosSim(texts) -logger.info(f"{cos_Sim.calcuSim('你好')}") - -cos_Sim.save('cos.h5') - -model = cosSim.load('cos.h5') - -logger.info(f"{model}") - -# class Sim(Plugin): -# async def handle(self) -> None: -# try: - -# txt_list = eval(self.event.message.get_plain_text()[5:]) -# if len(txt_list) == 1: -# await self.event.reply(f"{cos_Sim.CalcuSim(txt_list)}") -# elif len(txt_list) == 2: -# corpuss = [" ".join(jieba.cut(text)) -# for text in eval(self.event.message.get_plain_text()[5:])] -# await self.event.reply(str(corpuss)) -# vocabulary = cos_Sim.getVocabulary(corpuss) -# v = cos_Sim.getVectors(corpuss, vocabulary=vocabulary) -# await self.event.reply(f"weight\n=========\n{v}") -# await self.event.reply(f"相似度\n=========\n{cos_Sim.cos_sim(v[0], v[1])}") -# except Exception as e: -# await self.event.reply(f"{e!r}") - -# async def rule(self) -> bool: -# return self.event.type == "message" and self.event.message.startswith(".cos") - - - |
