mirror of
https://github.com/nonebot/nonebot2.git
synced 2025-07-27 16:21:28 +00:00
Little improvement
This commit is contained in:
@ -26,7 +26,9 @@ def parse_potential_commands(sentence):
|
||||
for regex in processor[0]:
|
||||
for word, flag in segmentation:
|
||||
if re.match(regex, word):
|
||||
potential_commands.append(processor[1](sentence, segmentation))
|
||||
result = processor[1](sentence, segmentation)
|
||||
if result:
|
||||
potential_commands.append(result)
|
||||
processed = True
|
||||
# A word matched, skip the rest of words
|
||||
break
|
||||
@ -34,5 +36,7 @@ def parse_potential_commands(sentence):
|
||||
# Current processor has processed, skip the rest of keywords
|
||||
break
|
||||
for func in _processors_without_keyword:
|
||||
potential_commands.append(func(sentence, segmentation))
|
||||
result = func(sentence, segmentation)
|
||||
if result:
|
||||
potential_commands.append(result)
|
||||
return potential_commands
|
||||
|
Reference in New Issue
Block a user