reverse sorting and change upper letter multiplier

This commit is contained in:
OneNewDev 2022-05-07 19:50:36 +02:00
parent e9ad3efbeb
commit 0d35f715f4

View file

@ -43,12 +43,12 @@ class FileScanner(HTMLParser):
if len(word) <= 3:
score //= 2
upper_letters_count = len(upper_check.findall(tag_name))
score *= upper_letters_count
score += upper_letters_count * 5
if word not in words_with_usage:
words_with_usage[word] = Tag(name=tag_name, score=score)
else:
words_with_usage[word].score += score
sorted_list = sorted(words_with_usage.values(), key=lambda tag: tag.score, reverse=False)
sorted_list = sorted(words_with_usage.values(), key=lambda tag: tag.score, reverse=True)
display_result(sorted_list)
def handle_starttag(self, tag, attrs):