use max tags instead of min score as display limit
This commit is contained in:
parent
2dd21cc80d
commit
db471d5559
10
tagger.py
10
tagger.py
|
@ -130,11 +130,11 @@ class FileScanner(HTMLParser):
|
||||||
return ''
|
return ''
|
||||||
|
|
||||||
|
|
||||||
def display_tags(tags, min_score):
|
def display_tags(tags, max_tags):
|
||||||
# Die Ergebnisse auf der Konsole ausgeben.
|
# Die Ergebnisse auf der Konsole ausgeben.
|
||||||
for tag in tags:
|
for index, tag in enumerate(tags,):
|
||||||
if tag.score <= min_score:
|
if index >= max_tags:
|
||||||
continue
|
break
|
||||||
print(f"Score: {tag.score:>3} Word: {tag.name}")
|
print(f"Score: {tag.score:>3} Word: {tag.name}")
|
||||||
|
|
||||||
|
|
||||||
|
@ -171,7 +171,7 @@ def main():
|
||||||
scanner = FileScanner(file)
|
scanner = FileScanner(file)
|
||||||
tags = scanner.scan_file()
|
tags = scanner.scan_file()
|
||||||
# Die Ergebnisse auf der Konsole ausgeben
|
# Die Ergebnisse auf der Konsole ausgeben
|
||||||
display_tags(tags, min_score=20)
|
display_tags(tags, max_tags=10)
|
||||||
# Die eingestellte Anzahl an Tags für die Ausgabedatei übernehmen, sofern vorhanden.
|
# Die eingestellte Anzahl an Tags für die Ausgabedatei übernehmen, sofern vorhanden.
|
||||||
final_tags[title] = tags[:TAGS_PER_ARTICLE] if len(tags) > TAGS_PER_ARTICLE else tags
|
final_tags[title] = tags[:TAGS_PER_ARTICLE] if len(tags) > TAGS_PER_ARTICLE else tags
|
||||||
# Die Ausgabedatei schreiben
|
# Die Ausgabedatei schreiben
|
||||||
|
|
Loading…
Reference in a new issue