-
Notifications
You must be signed in to change notification settings - Fork 2
/
test_scorers.py
38 lines (25 loc) · 947 Bytes
/
test_scorers.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
#!/usr/bin/env python3
import scorer_ic
import scorer_ngrams
def test_Case_IC():
print('\nRunning IC test')
# IC
icscorer = scorer_ic.scorer_ic()
test_input = open('tests/test_Case_IC.txt', 'r').read().split('\n\n')
for line in test_input:
input_line, score_line = line.split('\n')
print (icscorer.score(input_line,len(input_line)))
assert round(icscorer.score(input_line,len(input_line)),5) == float(score_line)
print('Done!')
'''
def test_Case_IC():
print('\nRunning bigram test')
# IC
icscorer = scorer_ic.scorer_ic()
test_input = open('tests/test_Case_BI.txt', 'r').read().split('\n\n')
for line in test_input:
input_line, score_line = line.split('\n')
print (icscorer.score(input_line,len(input_line)))
assert round(icscorer.score(input_line,len(input_line)),5) == float(score_line)
print('Done!')
'''