Пример #1
0
 def test_load(self):
     Dictionary.load(dict_file)
Пример #2
0
ROOT = 'C:\\Users\\lenovo\\.qqbot-tmp\\plugins\\'

import configparser
config = configparser.ConfigParser()
config.read(ROOT + 'app.conf', encoding='utf8')
dict_path = config.get('DICTIONARY', 'dict_path')
model_save_path = config.get('MODEL', 'save_path')
embedding_dim = int(config.get('MODEL', 'embedding_dim'))
hidden_dim = int(config.get('MODEL', 'hidden_dim'))
num_layers = int(config.get('MODEL', 'num_layers'))

jieba.load_userdict(dict_path)

_dict = Dictionary([])
model_dict_path = os.path.join(model_save_path, 'freq1.dict')
_dict.load(model_dict_path)

rep = Replier(model_save_path, _dict, num_layers, embedding_dim, hidden_dim)
rep.load('freq1_(3.562772035598755)')

REPLY_TIME = {}
REPLY_TIME['ME'] = 0


def get_errmsg(key):
    limit = len(MSG[key]) - 1
    idx = random.randint(0, limit)
    return MSG[key][idx]


def onQQMessage(bot, contact, member, content):