From f8acf03acc1e3bd3fb6140fce442b9c61a40329c Mon Sep 17 00:00:00 2001 From: Hui Lan Date: Tue, 31 Aug 2021 21:25:17 +0800 Subject: [PATCH] main.py: let the user have a small chance to get a much more difficult article than his vocabulary level. --- app/main.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/app/main.py b/app/main.py index 9e78216..b2145cb 100644 --- a/app/main.py +++ b/app/main.py @@ -115,7 +115,8 @@ def get_today_article(user_word_list, articleID): if articleID == None: for reading in result: text_level = text_difficulty_level(reading['text'], d3) - if within_range(text_level, user_level, (8.0 - user_level)*0.8): + factor = random.gauss(0.8, 0.1) # a number drawn from Gaussian distribution with a mean of 0.8 and a stand deviation of 1 + if within_range(text_level, user_level, (8.0 - user_level)*factor): d = reading break