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:
|
Returns:
|
||||||
list of suggestions from vocabulary (could be empty if there are no matches)
|
list of suggestions from vocabulary (could be empty if there are no matches)
|
||||||
"""
|
"""
|
||||||
if string in vocabulary:
|
#if string in vocabulary:
|
||||||
return [string]
|
# return [string]
|
||||||
# no exact match. Determine suggestions and return sorted with highest match first.
|
|
||||||
return [tup[1] for tup in sorted([(string_similarity(string, sugg), sugg) for sugg in vocabulary],
|
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]
|
key=lambda tup: tup[0], reverse=True) if tup[0] >= cutoff][:maxnum]
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue