mirror of
https://gitlab.crans.org/bde/nk20
synced 2024-11-27 02:43:01 +00:00
[WEI] For each bus, choose a random word which score is higher than the mid score
Signed-off-by: Yohann D'ANELLO <ynerant@crans.org>
This commit is contained in:
parent
dbc7b3444b
commit
d888d5863a
@ -49,9 +49,13 @@ class WEISurveyForm2021(forms.Form):
|
|||||||
# Update seed
|
# Update seed
|
||||||
rng.randint(0, information.step)
|
rng.randint(0, information.step)
|
||||||
|
|
||||||
preferred_words = {bus: [word for word in WORDS if bus.size > 0
|
buses = WEISurveyAlgorithm2021.get_buses()
|
||||||
and WEIBusInformation2021(bus).scores[word] >= 50]
|
scores = sum((list(WEIBusInformation2021(bus).scores.values()) for bus in buses), [])
|
||||||
for bus in WEISurveyAlgorithm2021.get_buses()}
|
average_score = sum(scores) / len(scores)
|
||||||
|
|
||||||
|
preferred_words = {bus: [word for word in WORDS
|
||||||
|
if WEIBusInformation2021(bus).scores[word] >= average_score]
|
||||||
|
for bus in buses}
|
||||||
while words is None or len(set(words)) != len(words):
|
while words is None or len(set(words)) != len(words):
|
||||||
# Ensure that there is no the same word 2 times
|
# Ensure that there is no the same word 2 times
|
||||||
words = [rng.choice(words) for _ignored2, words in preferred_words.items()]
|
words = [rng.choice(words) for _ignored2, words in preferred_words.items()]
|
||||||
|
Loading…
Reference in New Issue
Block a user