reverse sorting and change upper letter multiplier
This commit is contained in:
parent
e9ad3efbeb
commit
0d35f715f4
1 changed files with 2 additions and 2 deletions
|
@ -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):
|
||||
|
|
Loading…
Reference in a new issue