From 3fba0bdbe3437e9a1e21c6fa568fd729c2d93510 Mon Sep 17 00:00:00 2001 From: Griatch Date: Sun, 22 Apr 2012 21:54:28 +0200 Subject: [PATCH] Changed suggestion system to give more suggestions also if the help entry catches the exact match. --- src/utils/utils.py | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/src/utils/utils.py b/src/utils/utils.py index 5364a98a7a..52c123ea0d 100644 --- a/src/utils/utils.py +++ b/src/utils/utils.py @@ -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]