Skip to content

Commit

Permalink
aichaos#92 Add special handling for [*]
Browse files Browse the repository at this point in the history
  • Loading branch information
hungtu committed May 19, 2017
1 parent 6b5ef3f commit ecfeb9a
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions rivescript/sorting.py
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,13 @@ def __init__(self, pattern, index, weight, inherit = sys.maxsize):
# Without any words number of stars does not matter, they all mean match any.
self.star = sys.maxsize # Make sure "*" is last in the list, "* love *" > "*"

# Special handle for the case "[*]", since self.len is not re-set, self.len = -2 < 0. Thus, "[*]" > "*"
elif (self.option == 1) & (self.wordcount == -2):
self.wordcount = sys.maxsize
self.star = sys.maxsize
self.pound = sys.maxsize
self.under = sys.maxsize
self.option = sys.maxsize

def sort_trigger_set(triggers, exclude_previous=True, say=None):
"""Sort a group of triggers in optimal sorting order.
Expand Down

0 comments on commit ecfeb9a

Please sign in to comment.