challenging-america-word-ga.../first_take.py

21 lines
642 B
Python

import sys
for line in sys.stdin:
_, _, _, _, _, _, l_context, r_context = line.split("\t")
prev_word = l_context.split()[-1]
next_word = r_context.split()[0]
if prev_word == "United" and next_word == "of":
print("States:0.9 :0.1")
elif prev_word == "used":
print("to:0.5 it:0.3 :0.2")
elif prev_word.lower() == "in":
print("the:0.7 a:0.1 an:0.1 :0.1")
elif prev_word.lower() == "i":
print("am:0.3 was:0.3 have:0.3 :0.1")
elif prev_word.lower() in ["he", "she", "it"]:
print("is:0.3 was:0.3 has:0.3 :0.1")
else:
print("the:0.5 a:0.2 an:0.2 :0.1")