@@ 293-341 (lines=49) @@ | ||
290 | ] |
|
291 | }) |
|
292 | ||
293 | def testnormalFormProductionR8(self): |
|
294 | tree = computeTree(data.mistake()) |
|
295 | NamedEntityMerging(tree).merge() |
|
296 | PrepositionMerging(tree).merge() |
|
297 | qw = simplify(tree) |
|
298 | result = normalFormProduction(tree, qw) |
|
299 | self.assertEqual(result, { |
|
300 | "type": "triple", |
|
301 | "subject": { |
|
302 | "type": "resource", |
|
303 | "value": "mistake" |
|
304 | }, |
|
305 | "object": { |
|
306 | "type": "missing" |
|
307 | }, |
|
308 | "predicate": { |
|
309 | "type": "list", |
|
310 | "list": [ |
|
311 | { |
|
312 | "type": "resource", |
|
313 | "value": "place" |
|
314 | }, |
|
315 | { |
|
316 | "type": "resource", |
|
317 | "value": "location" |
|
318 | }, |
|
319 | { |
|
320 | "type": "resource", |
|
321 | "value": "residence" |
|
322 | }, |
|
323 | { |
|
324 | "type": "resource", |
|
325 | "value": "country" |
|
326 | }, |
|
327 | { |
|
328 | "type": "resource", |
|
329 | "value": "city" |
|
330 | }, |
|
331 | { |
|
332 | "type": "resource", |
|
333 | "value": "town" |
|
334 | }, |
|
335 | { |
|
336 | "type": "resource", |
|
337 | "value": "state" |
|
338 | }, |
|
339 | { |
|
340 | "type": "resource", |
|
341 | "value": "locality" |
|
342 | } |
|
343 | ] |
|
344 | } |
|
@@ 11-58 (lines=48) @@ | ||
8 | ||
9 | class StandardTripleTests(TestCase): |
|
10 | ||
11 | def testAndnormalFormProduction(self): |
|
12 | tree = computeTree(data.give_chief()) |
|
13 | NamedEntityMerging(tree).merge() |
|
14 | PrepositionMerging(tree).merge() |
|
15 | qw = simplify(tree) |
|
16 | result = normalFormProduction(tree, qw) |
|
17 | self.assertEqual(result, { |
|
18 | "list": [ |
|
19 | { |
|
20 | "type": "triple", |
|
21 | "subject": { |
|
22 | "type": "resource", |
|
23 | "value": "chief" |
|
24 | }, |
|
25 | "object": { |
|
26 | "type": "missing" |
|
27 | }, |
|
28 | "predicate": { |
|
29 | "list": [ |
|
30 | { |
|
31 | "type": "resource", |
|
32 | "value": "identity" |
|
33 | } |
|
34 | ], |
|
35 | "type": "list" |
|
36 | } |
|
37 | }, |
|
38 | { |
|
39 | "type": "triple", |
|
40 | "subject": { |
|
41 | "type": "resource", |
|
42 | "value": "prime minister" |
|
43 | }, |
|
44 | "object": { |
|
45 | "type": "missing" |
|
46 | }, |
|
47 | "predicate": { |
|
48 | "list": [ |
|
49 | { |
|
50 | "type": "resource", |
|
51 | "value": "identity" |
|
52 | } |
|
53 | ], |
|
54 | "type": "list" |
|
55 | } |
|
56 | } |
|
57 | ], |
|
58 | "type": "intersection" |
|
59 | }) |
|
60 | ||
61 | def testSuperlativenormalFormProduction(self): |
|
@@ 61-98 (lines=38) @@ | ||
58 | "type": "intersection" |
|
59 | }) |
|
60 | ||
61 | def testSuperlativenormalFormProduction(self): |
|
62 | tree = computeTree(data.give_opera()) |
|
63 | NamedEntityMerging(tree).merge() |
|
64 | PrepositionMerging(tree).merge() |
|
65 | qw = simplify(tree) |
|
66 | result = normalFormProduction(tree, qw) |
|
67 | self.assertEqual(result, { |
|
68 | "list": [ |
|
69 | { |
|
70 | "list": { |
|
71 | "predicate": { |
|
72 | "value": "default", |
|
73 | "type": "resource" |
|
74 | }, |
|
75 | "list": { |
|
76 | "value": "Gilbert", |
|
77 | "type": "resource" |
|
78 | }, |
|
79 | "type": "sort" |
|
80 | }, |
|
81 | "type": "first" |
|
82 | }, |
|
83 | { |
|
84 | "list": { |
|
85 | "predicate": { |
|
86 | "value": "default", |
|
87 | "type": "resource" |
|
88 | }, |
|
89 | "list": { |
|
90 | "value": "Sullivan opera", |
|
91 | "type": "resource" |
|
92 | }, |
|
93 | "type": "sort" |
|
94 | }, |
|
95 | "type": "first" |
|
96 | } |
|
97 | ], |
|
98 | "type": "intersection" |
|
99 | }) |
|
100 | ||
101 | def testnormalFormProduction1(self): |