mirror of
https://github.com/nonebot/nonebot2.git
synced 2025-07-29 09:10:22 +00:00
Fix a bug
This commit is contained in:
@ -25,7 +25,7 @@ def parse_potential_commands(sentence):
|
|||||||
processed = False
|
processed = False
|
||||||
for regex in processor[0]:
|
for regex in processor[0]:
|
||||||
for word, flag in segmentation:
|
for word, flag in segmentation:
|
||||||
if re.match(regex, word):
|
if re.search(regex, word):
|
||||||
result = processor[1](sentence, segmentation)
|
result = processor[1](sentence, segmentation)
|
||||||
if result:
|
if result:
|
||||||
potential_commands.append(result)
|
potential_commands.append(result)
|
||||||
|
@ -2,12 +2,12 @@ import re
|
|||||||
|
|
||||||
from nl_processor import as_processor
|
from nl_processor import as_processor
|
||||||
|
|
||||||
_keywords = ('天气', '气温', '空气(质量)?', '温度', '多少度', '(风|雨|雪|冰雹|霜|雾|霾)')
|
_keywords = ('天气', '气温', '空气(质量)?', '温度', '多少度', '风|雨|雪|冰雹|霜|雾|霾')
|
||||||
|
|
||||||
|
|
||||||
def _match_keywords(word):
|
def _match_keywords(word):
|
||||||
for regex in _keywords:
|
for regex in _keywords:
|
||||||
if re.match(regex, word):
|
if re.search(regex, word):
|
||||||
return True
|
return True
|
||||||
return False
|
return False
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user