@@ 293-341 (lines=49) @@ | ||
290 | } |
|
291 | } |
|
292 | ] |
|
293 | }) |
|
294 | ||
295 | def testnormalFormProductionR8(self): |
|
296 | tree = computeTree(data.mistake()) |
|
297 | NamedEntityMerging(tree).merge() |
|
298 | PrepositionMerging(tree).merge() |
|
299 | qw = simplify(tree) |
|
300 | result = normalFormProduction(tree, qw) |
|
301 | self.assertEqual(result, { |
|
302 | "type": "triple", |
|
303 | "subject": { |
|
304 | "type": "resource", |
|
305 | "value": "mistake" |
|
306 | }, |
|
307 | "object": { |
|
308 | "type": "missing" |
|
309 | }, |
|
310 | "predicate": { |
|
311 | "type": "list", |
|
312 | "list": [ |
|
313 | { |
|
314 | "type": "resource", |
|
315 | "value": "place" |
|
316 | }, |
|
317 | { |
|
318 | "type": "resource", |
|
319 | "value": "location" |
|
320 | }, |
|
321 | { |
|
322 | "type": "resource", |
|
323 | "value": "residence" |
|
324 | }, |
|
325 | { |
|
326 | "type": "resource", |
|
327 | "value": "country" |
|
328 | }, |
|
329 | { |
|
330 | "type": "resource", |
|
331 | "value": "city" |
|
332 | }, |
|
333 | { |
|
334 | "type": "resource", |
|
335 | "value": "town" |
|
336 | }, |
|
337 | { |
|
338 | "type": "resource", |
|
339 | "value": "state" |
|
340 | }, |
|
341 | { |
|
342 | "type": "resource", |
|
343 | "value": "locality" |
|
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 | "index": 0, |
|
82 | "type": "nth" |
|
83 | }, |
|
84 | { |
|
85 | "list": { |
|
86 | "predicate": { |
|
87 | "value": "default", |
|
88 | "type": "resource" |
|
89 | }, |
|
90 | "list": { |
|
91 | "value": "Sullivan opera", |
|
92 | "type": "resource" |
|
93 | }, |
|
94 | "type": "sort" |
|
95 | }, |
|
96 | "index": 0, |
|
97 | "type": "nth" |
|
98 | } |
|
99 | ], |
|
100 | "type": "intersection" |
|
101 | }) |