gitignore update + run.py reformat
This commit is contained in:
parent
1ff6ba7d37
commit
8b58507f52
3
.gitignore
vendored
3
.gitignore
vendored
@ -6,3 +6,6 @@
|
|||||||
*.o
|
*.o
|
||||||
.DS_Store
|
.DS_Store
|
||||||
.token
|
.token
|
||||||
|
scripts/*
|
||||||
|
solution/*
|
||||||
|
models/*
|
34
run.py
34
run.py
@ -1,24 +1,18 @@
|
|||||||
#!/usr/bin/python3
|
#!/usr/bin/python3
|
||||||
import sys
|
from scripts.language_utils import predict_gaps, train_model, load_lexicon
|
||||||
|
|
||||||
|
|
||||||
for line in sys.stdin:
|
WORDS_LIMIT = 10
|
||||||
_, _, _, _, _, _, left_context, right_context = line.split("\t")
|
|
||||||
|
|
||||||
previous_word = left_context.split()[-1]
|
if __name__ == "__main__":
|
||||||
next_word = right_context.split()[0]
|
lexicon = load_lexicon("./words_alpha.txt")
|
||||||
|
model = train_model("./train/in.tsv.xz", "./train/expected.tsv", lexicon)
|
||||||
if previous_word == "United" and next_word == "of":
|
for i, (directory, lines_no) in enumerate(zip(["dev-0", "test-A"], (10519, 7414))):
|
||||||
print("States:0.9 :0.1")
|
predict_gaps(
|
||||||
elif previous_word == "used":
|
model,
|
||||||
print("to:0.4 it:0.3 as:0.2 :0.1")
|
f"./{directory}/in.tsv.xz",
|
||||||
elif previous_word.lower() == "in":
|
f"./{directory}/out.tsv",
|
||||||
print("the:0.7 a:0.1 an:0.1 :0.1")
|
lexicon,
|
||||||
elif previous_word.lower() == "i":
|
lines_no,
|
||||||
print("am:0.3 was:0.3 have:0.3 :0.1")
|
WORDS_LIMIT,
|
||||||
elif previous_word.lower() in ["he", "she", "it"]:
|
)
|
||||||
print("is:0.3 was:0.3 has:0.3 :0.1")
|
|
||||||
elif previous_word.lower() in "bring":
|
|
||||||
print("something:0.3 it:0.3 them:0.3 :0.1")
|
|
||||||
else:
|
|
||||||
print("the:0.5 a:0.2 an:0.2 :0.1")
|
|
||||||
|
Loading…
Reference in New Issue
Block a user