More lines.
This commit is contained in:
parent
827021f1a3
commit
0f6815f63d
10519
dev-0/out.tsv
Normal file
10519
dev-0/out.tsv
Normal file
File diff suppressed because it is too large
Load Diff
10519
dev-0/out_1000000.tsv
Normal file
10519
dev-0/out_1000000.tsv
Normal file
File diff suppressed because it is too large
Load Diff
12
run.py
12
run.py
@ -30,7 +30,7 @@ class WordPred:
|
|||||||
for w1, w2, w3 in trigrams(tokens, pad_right=True, pad_left=True):
|
for w1, w2, w3 in trigrams(tokens, pad_right=True, pad_left=True):
|
||||||
if w1 and w2 and w3:
|
if w1 and w2 and w3:
|
||||||
self.model[(w2, w3)][w1] += 1
|
self.model[(w2, w3)][w1] += 1
|
||||||
if index == 1000000:
|
if index == 1300000:
|
||||||
break
|
break
|
||||||
|
|
||||||
for word_pair in self.model:
|
for word_pair in self.model:
|
||||||
@ -46,7 +46,7 @@ class WordPred:
|
|||||||
if len(tokens) < 4:
|
if len(tokens) < 4:
|
||||||
prediction = 'the:0.2 be:0.2 to:0.2 of:0.1 and:0.1 a:0.1 :0.1'
|
prediction = 'the:0.2 be:0.2 to:0.2 of:0.1 and:0.1 a:0.1 :0.1'
|
||||||
else:
|
else:
|
||||||
prediction = word_gap_prediction.predict_probs(tokens[0], tokens[1])
|
prediction = wp.predict_probs(tokens[0], tokens[1])
|
||||||
outputf.write(prediction + '\n')
|
outputf.write(prediction + '\n')
|
||||||
|
|
||||||
def predict_probs(self, word1, word2):
|
def predict_probs(self, word1, word2):
|
||||||
@ -70,7 +70,7 @@ class WordPred:
|
|||||||
|
|
||||||
return str_prediction
|
return str_prediction
|
||||||
|
|
||||||
word_gap_prediction = WordPred()
|
wp = WordPred()
|
||||||
word_gap_prediction.read_train_data('train/in.tsv.xz')
|
wp.read_train_data('train/in.tsv.xz')
|
||||||
word_gap_prediction.generate_outputs('dev-0/in.tsv.xz', 'dev-0/out.tsv')
|
wp.generate_outputs('dev-0/in.tsv.xz', 'dev-0/out.tsv')
|
||||||
# word_gap_prediction.generate_outputs('test-A/in.tsv.xz', 'test-A/out.tsv')
|
wp.generate_outputs('test-A/in.tsv.xz', 'test-A/out.tsv')
|
7414
test-A/out.tsv
Normal file
7414
test-A/out.tsv
Normal file
File diff suppressed because it is too large
Load Diff
Loading…
Reference in New Issue
Block a user