Skip to content

Commit

Permalink
Update flanautils
Browse files Browse the repository at this point in the history
  • Loading branch information
AlberLC committed Dec 8, 2022
1 parent 46205d6 commit 47f8459
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
2 changes: 1 addition & 1 deletion flanarunas/constants.py
Original file line number Diff line number Diff line change
@@ -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
6 changes: 3 additions & 3 deletions flanarunas/flana_runas.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit 47f8459

Please sign in to comment.