mirror of
https://github.com/evennia/evennia.git
synced 2026-04-04 15:07:16 +02:00
Changed suggestion system to give more suggestions also if the help entry catches the exact match.
This commit is contained in:
parent
e4006bf386
commit
3fba0bdbe3
1 changed files with 2 additions and 3 deletions
|
|
@ -713,8 +713,7 @@ def string_suggestions(string, vocabulary, cutoff=0.6, maxnum=3):
|
|||
Returns:
|
||||
list of suggestions from vocabulary (could be empty if there are no matches)
|
||||
"""
|
||||
if string in vocabulary:
|
||||
return [string]
|
||||
# no exact match. Determine suggestions and return sorted with highest match first.
|
||||
#if string in vocabulary:
|
||||
# return [string]
|
||||
return [tup[1] for tup in sorted([(string_similarity(string, sugg), sugg) for sugg in vocabulary],
|
||||
key=lambda tup: tup[0], reverse=True) if tup[0] >= cutoff][:maxnum]
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue