-
Notifications
You must be signed in to change notification settings - Fork 1
/
log
223 lines (223 loc) · 4.08 KB
/
log
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
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
Trying:
test = "Deze iets langere test bevat de naam Albert Einstein."
Expecting nothing
ok
Trying:
p = Polyglot(parsed_text=test)
Expecting nothing
ok
Trying:
p.start()
Expecting nothing
ok
Trying:
import time
Expecting nothing
ok
Trying:
time.sleep(0.1)
Expecting nothing
ok
Trying:
from pprint import pprint
Expecting nothing
ok
Trying:
pprint(p.join())
Expecting:
{'polyglot': [{'ne': 'Albert Einstein', 'pos': 37, 'type': 'person'}]}
ok
Trying:
test = "Deze iets langere test bevat de naam Einstein."
Expecting nothing
ok
Trying:
p = Spacy(parsed_text=test)
Expecting nothing
ok
Trying:
p.start()
Expecting nothing
ok
Trying:
import time
Expecting nothing
ok
Trying:
time.sleep(0.1)
Expecting nothing
ok
Trying:
from pprint import pprint
Expecting nothing
ok
Trying:
pprint(p.join())
Expecting:
{'spacy': [{'ne': 'Einstein', 'pos': 37, 'type': 'location'}]}
ok
Trying:
t = "Richard Nixon bakt een taart voor zichzelf."
Expecting nothing
ok
Trying:
p = Spotlight(parsed_text=t)
Expecting nothing
ok
Trying:
p.start()
Expecting nothing
ok
Trying:
import time
Expecting nothing
ok
Trying:
time.sleep(1)
Expecting nothing
ok
Trying:
from pprint import pprint
Expecting nothing
ok
Trying:
pprint(p.join())
Expecting:
{'spotlight': [{'ne': 'Richard Nixon', 'pos': 0, 'type': 'other'}]}
ok
Trying:
test = "Deze iets langere test bevat de naam Albert Einstein."
Expecting nothing
ok
Trying:
p = Stanford(parsed_text=test)
Expecting nothing
ok
Trying:
p.start()
Expecting nothing
ok
Trying:
import time
Expecting nothing
ok
Trying:
time.sleep(0.1)
Expecting nothing
ok
Trying:
from pprint import pprint
Expecting nothing
ok
Trying:
pprint(p.join())
Expecting:
{'stanford': [{'ne': 'Albert Einstein', 'pos': 37, 'type': 'person'}]}
ok
Trying:
EXAMPLE_URL = "http://resolver.kb.nl/resolve?"
Expecting nothing
ok
Trying:
EXAMPLE_URL += "urn=ddd:010381561:mpeg21:a0049:ocr"
Expecting nothing
ok
Trying:
ocr_to_dict(EXAMPLE_URL).get("title")
Expecting:
'EERSTE HOOFDSTUK'
ok
Trying:
parsers = {
"polyglot": Polyglot,
"stanford": Stanford,
"spacy": Spacy,
"spotlight": Spotlight,
}
Expecting nothing
ok
Trying:
url = [EXAMPLE_URL]
Expecting nothing
ok
Trying:
parsed_text = ocr_to_dict(url[0])
Expecting nothing
ok
Trying:
tasks = []
Expecting nothing
ok
Trying:
result = {}
Expecting nothing
ok
Trying:
for p in parsers:
tasks.append(parsers[p](parsed_text=parsed_text["p"]))
tasks[-1].start()
Expecting nothing
ok
Trying:
import time
Expecting nothing
ok
Trying:
time.sleep(1)
Expecting nothing
ok
Trying:
for p in tasks:
ner_result = p.join()
result[list(ner_result)[0]] = ner_result[list(ner_result)[0]]
Expecting nothing
ok
Trying:
from pprint import pprint
Expecting nothing
ok
Trying:
pprint(intergrate_results(result, "p", parsed_text["p"], 5)[-1])
Expecting:
{'count': 3,
'left_context': 'als wie haar nadert streelt:',
'ne': 'René',
'ne_context': 'René',
'ner_src': ['stanford', 'spacy', 'polyglot'],
'pos': 5597,
'right_context': 'genoot van zijn charme als',
'source': 'p',
'type': 'person',
'type_certainty': 3,
'types': ['person']}
ok
19 items had no tests:
__main__
__main__.Polyglot.__init__
__main__.Polyglot.join
__main__.Polyglot.run
__main__.Spacy.__init__
__main__.Spacy.join
__main__.Spacy.run
__main__.Spotlight.__init__
__main__.Spotlight.join
__main__.Spotlight.run
__main__.Stanford.__init__
__main__.Stanford.join
__main__.Stanford.run
__main__.context
__main__.index
__main__.intergrate_results
__main__.manual_find
__main__.max_class
__main__.translate
6 items passed all tests:
7 tests in __main__.Polyglot
7 tests in __main__.Spacy
7 tests in __main__.Spotlight
7 tests in __main__.Stanford
3 tests in __main__.ocr_to_dict
11 tests in __main__.test_all
42 tests in 25 items.
42 passed and 0 failed.
Test passed.