From 47f8459deb8037d933ecb8a73090e6e3c7e7d925 Mon Sep 17 00:00:00 2001 From: AlberLC Date: Thu, 8 Dec 2022 23:18:42 +0100 Subject: [PATCH] Update flanautils --- flanarunas/constants.py | 2 +- flanarunas/flana_runas.py | 6 +++--- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/flanarunas/constants.py b/flanarunas/constants.py index cc510b7..4f34cd5 100644 --- a/flanarunas/constants.py +++ b/flanarunas/constants.py @@ -1,3 +1,3 @@ VERSIONS_ENDPOINT = 'https://ddragon.leagueoflegends.com/api/versions.json' CHAMPIONS_BASE_ENDPOINT = 'https://ddragon.leagueoflegends.com/cdn/{}/data/en_US/champion.json' -MIN_RATIO = 0.8 +MIN_SCORE = 0.8 diff --git a/flanarunas/flana_runas.py b/flanarunas/flana_runas.py index eac716b..e9afa99 100644 --- a/flanarunas/flana_runas.py +++ b/flanarunas/flana_runas.py @@ -64,9 +64,9 @@ def get_page_rune_champion(self, rune_page: RunePage) -> Champion: for word in rune_page.name.split(): best_match = ScoreMatch(None, 0) for champion in self.champions: - match_ratio = jellyfish.jaro_winkler_similarity(flanautils.remove_accents(word.lower()), flanautils.remove_accents(champion.name.lower())) - if match_ratio >= constants.MIN_RATIO and match_ratio > best_match.score: - best_match = ScoreMatch(champion, match_ratio) + match_score = jellyfish.jaro_winkler_similarity(flanautils.remove_accents(word.lower()), flanautils.remove_accents(champion.name.lower())) + if match_score >= constants.MIN_SCORE and match_score > best_match.score: + best_match = ScoreMatch(champion, match_score) if best_match.element is not None: return best_match.element