mirror of
https://github.com/nonebot/nonebot2.git
synced 2025-07-28 08:41:29 +00:00
完成适配器化改造,所有上报数据统一、接口调用等都改成通过不同消息源的适配器来完成,插件和消息源的耦合
This commit is contained in:
@ -19,12 +19,13 @@ def as_processor(keywords=None):
|
||||
|
||||
def parse_potential_commands(sentence):
|
||||
segmentation = list(jieba.posseg.cut(sentence=sentence))
|
||||
print('分词结果:', segmentation)
|
||||
print('分词结果:', ['[' + s.flag + ']' + s.word for s in segmentation])
|
||||
potential_commands = []
|
||||
for processor in _processors:
|
||||
processed = False
|
||||
for regex in processor[0]:
|
||||
for word, flag in segmentation:
|
||||
for s in segmentation:
|
||||
word, flag = s.word, s.flag
|
||||
if re.search(regex, word):
|
||||
result = processor[1](sentence, segmentation)
|
||||
if result:
|
||||
|
Reference in New Issue
Block a user