From 410cfc62a34651e937d5ad4d7084fe2401828fb4 Mon Sep 17 00:00:00 2001 From: Addell FikraPlus+ Date: Sun, 5 Feb 2017 20:06:51 +0100 Subject: [PATCH] Enhancement of the decimal percent of similarity in levenshtein_distance --- chatterbot/comparisons.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/chatterbot/comparisons.py b/chatterbot/comparisons.py index fc5f166be..af10508b6 100644 --- a/chatterbot/comparisons.py +++ b/chatterbot/comparisons.py @@ -47,7 +47,7 @@ def levenshtein_distance(statement, other_statement): ) # Calculate a decimal percent of the similarity - percent = int(round(100 * similarity.ratio())) / 100.0 + percent = round(similarity.ratio(), 2) return percent