challenging-america-word-ga.../simple.py
2023-03-29 11:18:28 +02:00

24 lines
717 B
Python

import random
most_popular_words = [
"be:0.5 and:0.2 of:0.1 :0.2",
"a:0.5 in:0.2 to:0.1 :0.2",
"have:0.5 too:0.2 it:0.1 :0.2",
"I:0.5 that:0.2 for:0.1 :0.2",
"you:0.5 he:0.2 with:0.1 :0.2",
"on:0.5 do:0.2 say:0.1 :0.2",
"this:0.5 they:0.2 at:0.1 :0.2",
"but:0.5 we:0.2 his:0.1 :0.2"
]
folder = "dev-0"
with open(folder + "/in.tsv", "r", encoding='utf-8') as in_file:
lines = in_file.readlines()
with open(folder + "/out.tsv", "w", encoding='utf-8') as out_file:
for line in lines:
out_file.write(random.choice(most_popular_words) + "\n")
# słowo:prawdopodobieństwo słowo:prawdopodobieństwo :prawdopodobieństwo-reszty słów
# "the:0.2 at:0.3 :0.1"