readabilite: minimum score requirement

master
pictuga 2020-04-25 12:24:36 +02:00
parent 59ef5af9e2
commit c86572374e
1 changed files with 2 additions and 2 deletions

View File

@ -307,14 +307,14 @@ def get_best_node(ranked_grades):
return lowest return lowest
def get_article(data, url=None, encoding=None, debug=False): def get_article(data, url=None, encoding=None, debug=False, threshold=5):
" Input a raw html string, returns a raw html string of the article " " Input a raw html string, returns a raw html string of the article "
html = parse(data, encoding) html = parse(data, encoding)
score_all(html) score_all(html)
scores = rank_grades(get_all_scores(html)) scores = rank_grades(get_all_scores(html))
if not len(scores): if not len(scores) or scores[0][1] < threshold:
return None return None
best = get_best_node(scores) best = get_best_node(scores)