Commit bd0de0b5df684cb5aa8f591c4763d79406208ea8
1 parent
28b17074
Uzupełnienie zbioru selektorów
Showing
11 changed files
with
52 additions
and
10 deletions
LCGlexicon/ENIAM_LCGlexicon.ml
@@ -251,10 +251,12 @@ let make_node id orth lemma pos syntax weight cat_list is_raised = | @@ -251,10 +251,12 @@ let make_node id orth lemma pos syntax weight cat_list is_raised = | ||
251 | | Ctype -> ("CTYPE", SubstVar "ctype") :: attrs | 251 | | Ctype -> ("CTYPE", SubstVar "ctype") :: attrs |
252 | | Mode -> ("MODE", SubstVar "mode") :: attrs | 252 | | Mode -> ("MODE", SubstVar "mode") :: attrs |
253 | | Psem -> ("PSEM", SubstVar "psem") :: attrs | 253 | | Psem -> ("PSEM", SubstVar "psem") :: attrs |
254 | + | Icat -> attrs | ||
254 | | Inumber -> attrs | 255 | | Inumber -> attrs |
255 | | Igender -> attrs | 256 | | Igender -> attrs |
256 | | Iperson -> attrs | 257 | | Iperson -> attrs |
257 | | Nperson -> attrs | 258 | | Nperson -> attrs |
259 | + | Ncat -> attrs | ||
258 | | Plemma -> attrs | 260 | | Plemma -> attrs |
259 | | Unumber -> attrs | 261 | | Unumber -> attrs |
260 | | Ucase -> attrs | 262 | | Ucase -> attrs |
LCGlexicon/ENIAM_LCGlexiconTypes.ml
@@ -27,7 +27,7 @@ type categories = {lemma: string; pos: string; pos2: string; cat: string; coerce | @@ -27,7 +27,7 @@ type categories = {lemma: string; pos: string; pos2: string; cat: string; coerce | ||
27 | type selector = | 27 | type selector = |
28 | Lemma | (*NewLemma |*) Pos | Pos2 | Cat | Coerced | Number | Case | Gender | Person | Grad | Praep | | 28 | Lemma | (*NewLemma |*) Pos | Pos2 | Cat | Coerced | Number | Case | Gender | Person | Grad | Praep | |
29 | Acm | Aspect | Negation | Mood | Tense | Nsyn | Nsem | Ctype | Mode | Psem | | 29 | Acm | Aspect | Negation | Mood | Tense | Nsyn | Nsem | Ctype | Mode | Psem | |
30 | - Inumber | Igender | Iperson | Nperson | Plemma | | 30 | + Icat | Inumber | Igender | Iperson | Nperson | Ncat | Plemma | |
31 | Unumber | Ucase | Ugender | Uperson | Amode | 31 | Unumber | Ucase | Ugender | Uperson | Amode |
32 | 32 | ||
33 | module OrderedSelector = struct | 33 | module OrderedSelector = struct |
LCGlexicon/ENIAMcategoriesPL.ml
@@ -431,7 +431,7 @@ let clarify_categories proper cat coerced = function | @@ -431,7 +431,7 @@ let clarify_categories proper cat coerced = function | ||
431 | let selector_names = StringSet.of_list [ | 431 | let selector_names = StringSet.of_list [ |
432 | "lemma";"pos";"pos2";"cat";"coerced";"number";"case";"gender";"person";"grad"; | 432 | "lemma";"pos";"pos2";"cat";"coerced";"number";"case";"gender";"person";"grad"; |
433 | "praep";"acm";"aspect";"negation";"mood";"tense";"nsyn";"nsem";"ctype";"mode";"psem"; | 433 | "praep";"acm";"aspect";"negation";"mood";"tense";"nsyn";"nsem";"ctype";"mode";"psem"; |
434 | - "inumber";"igender";"iperson";"nperson";"plemma"; | 434 | + "icat";"inumber";"igender";"iperson";"nperson";"ncat";"plemma"; |
435 | "unumber";"ucase";"ugender";"uperson";"amode"] | 435 | "unumber";"ucase";"ugender";"uperson";"amode"] |
436 | 436 | ||
437 | 437 | ||
@@ -458,10 +458,12 @@ let string_of_selector = function | @@ -458,10 +458,12 @@ let string_of_selector = function | ||
458 | | Ctype -> "ctype" | 458 | | Ctype -> "ctype" |
459 | | Mode -> "mode" | 459 | | Mode -> "mode" |
460 | | Psem -> "psem" | 460 | | Psem -> "psem" |
461 | + | Icat -> "icat" | ||
461 | | Inumber -> "inumber" | 462 | | Inumber -> "inumber" |
462 | | Igender -> "igender" | 463 | | Igender -> "igender" |
463 | | Iperson -> "iperson" | 464 | | Iperson -> "iperson" |
464 | | Nperson -> "nperson" | 465 | | Nperson -> "nperson" |
466 | + | Ncat -> "ncat" | ||
465 | | Plemma -> "plemma" | 467 | | Plemma -> "plemma" |
466 | | Unumber -> "unumber" | 468 | | Unumber -> "unumber" |
467 | | Ucase -> "ucase" | 469 | | Ucase -> "ucase" |
@@ -497,10 +499,12 @@ let selector_of_string = function | @@ -497,10 +499,12 @@ let selector_of_string = function | ||
497 | | "ctype" -> Ctype | 499 | | "ctype" -> Ctype |
498 | | "mode" -> Mode | 500 | | "mode" -> Mode |
499 | | "psem" -> Psem | 501 | | "psem" -> Psem |
502 | + | "icat" -> Icat | ||
500 | | "inumber" -> Inumber | 503 | | "inumber" -> Inumber |
501 | | "igender" -> Igender | 504 | | "igender" -> Igender |
502 | | "iperson" -> Iperson | 505 | | "iperson" -> Iperson |
503 | | "nperson" -> Nperson | 506 | | "nperson" -> Nperson |
507 | + | "ncat" -> Ncat | ||
504 | | "plemma" -> Plemma | 508 | | "plemma" -> Plemma |
505 | | "unumber" -> Unumber | 509 | | "unumber" -> Unumber |
506 | | "ucase" -> Ucase | 510 | | "ucase" -> Ucase |
semantics/ENIAMsemGraph.ml
@@ -34,7 +34,7 @@ let rec make_args_list = function | @@ -34,7 +34,7 @@ let rec make_args_list = function | ||
34 | let symbols = StringSet.of_list [ | 34 | let symbols = StringSet.of_list [ |
35 | "symbol"; "date"; "date-interval"; "hour-minute"; "hour"; "hour-minute-interval"; "hour-interval"; | 35 | "symbol"; "date"; "date-interval"; "hour-minute"; "hour"; "hour-minute-interval"; "hour-interval"; |
36 | "year"; "year-interval"; "day"; "day-interval"; "day-month"; "day-month-interval"; "month-interval"; "roman"; "roman-interval"; | 36 | "year"; "year-interval"; "day"; "day-interval"; "day-month"; "day-month-interval"; "month-interval"; "roman"; "roman-interval"; |
37 | - "match-result"; "url"; "email"; "obj-id"; "building-number"; | 37 | + "match-result"; "url"; "email"; "phone-number"; "obj-id"; "building-number"; |
38 | "month-lex"; "day-lex"] | 38 | "month-lex"; "day-lex"] |
39 | 39 | ||
40 | let rec get_person = function | 40 | let rec get_person = function |
@@ -172,6 +172,7 @@ let create_normal_concept tokens lex_sems t cat coerced = | @@ -172,6 +172,7 @@ let create_normal_concept tokens lex_sems t cat coerced = | ||
172 | | "GRAD",Val "com" -> {c with c_relations=Tuple[c.c_relations;SingleRelation (Val "com")]} | 172 | | "GRAD",Val "com" -> {c with c_relations=Tuple[c.c_relations;SingleRelation (Val "com")]} |
173 | | "GRAD",Val "sup" -> {c with c_relations=Tuple[c.c_relations;SingleRelation (Val "sup")]} | 173 | | "GRAD",Val "sup" -> {c with c_relations=Tuple[c.c_relations;SingleRelation (Val "sup")]} |
174 | | "ASPECT",_ -> c | 174 | | "ASPECT",_ -> c |
175 | + | "CTYPE",_ -> c (* FIXME1: trzeba zaznaczyć pytajność w grafie, CTYPE pojawia się w dwu węzłach *) | ||
175 | (* | "TYPE",Val "int" -> {c with c_quant=Tuple[c.c_quant;Val "interrogative"]} *) | 176 | (* | "TYPE",Val "int" -> {c with c_quant=Tuple[c.c_quant;Val "interrogative"]} *) |
176 | | "TYPE",_ -> c (* FIXME *) | 177 | | "TYPE",_ -> c (* FIXME *) |
177 | | "PERS",_ -> c | 178 | | "PERS",_ -> c |
@@ -273,13 +274,19 @@ let create_normal_concept tokens lex_sems t cat coerced = | @@ -273,13 +274,19 @@ let create_normal_concept tokens lex_sems t cat coerced = | ||
273 | make_relation t (Context cx) else | 274 | make_relation t (Context cx) else |
274 | if t.lemma = "<root>" then t.args else | 275 | if t.lemma = "<root>" then t.args else |
275 | if t.lemma = "<merge>" then RemoveRelation("null","",t.args) else | 276 | if t.lemma = "<merge>" then RemoveRelation("null","",t.args) else |
276 | - if t.pos = "interp" && t.lemma = "?" && t.args = Dot then SingleRelation(Val "int") else | 277 | + (* if t.pos = "interp" && t.lemma = "?" && t.args = Dot then SingleRelation(Val "int") else *) |
278 | + if t.pos = "interp" && t.lemma = "?" then | ||
279 | + make_relation t (AddSingleRelation(Val "int",RemoveRelation("CORE","",t.args))) else (* FIXME1: to powinno tworzyć kontekst i zaznaczać ze jest interrogative *) | ||
277 | if t.pos = "interp" && t.lemma = ":" then | 280 | if t.pos = "interp" && t.lemma = ":" then |
278 | make_relation t (RemoveRelation("CORE","",t.args)) else | 281 | make_relation t (RemoveRelation("CORE","",t.args)) else |
279 | if t.pos = "interp" && t.lemma = "</sentence>" then | 282 | if t.pos = "interp" && t.lemma = "</sentence>" then |
280 | let l = (*List.rev*) (make_args_list t.args) in | 283 | let l = (*List.rev*) (make_args_list t.args) in |
281 | Xlist.fold (List.tl l) (RemoveRelation("null","",List.hd l)) (fun t s -> AddRelation(t,"Next","Clause",RemoveRelation("null","",s))) else | 284 | Xlist.fold (List.tl l) (RemoveRelation("null","",List.hd l)) (fun t s -> AddRelation(t,"Next","Clause",RemoveRelation("null","",s))) else |
282 | if t.pos = "interp" && t.lemma = "<sentence>" then t.args else | 285 | if t.pos = "interp" && t.lemma = "<sentence>" then t.args else |
286 | + if t.pos = "interp" && t.lemma = "</query>" then | ||
287 | + let l = (*List.rev*) (make_args_list t.args) in | ||
288 | + Xlist.fold (List.tl l) (List.hd l) (fun t s -> AddRelation(t,"Next","Sentence",s)) else | ||
289 | + if t.pos = "interp" && t.lemma = "<query>" then t.args else | ||
283 | (* if t.pos = "interp" && t.lemma = "”s" then | 290 | (* if t.pos = "interp" && t.lemma = "”s" then |
284 | let l = List.rev (make_args_list t.args) in | 291 | let l = List.rev (make_args_list t.args) in |
285 | let x = Xlist.fold (List.tl l) (List.hd l) (fun t s -> AddRelation(RemoveRelation t,"Next","Sentence",RemoveRelation s)) in | 292 | let x = Xlist.fold (List.tl l) (List.hd l) (fun t s -> AddRelation(RemoveRelation t,"Next","Sentence",RemoveRelation s)) in |
@@ -340,6 +347,7 @@ let rec translate_node tokens lex_sems t = | @@ -340,6 +347,7 @@ let rec translate_node tokens lex_sems t = | ||
340 | | "NEGATION",s -> t,("NEGATION",s) :: attrs,cat,coerced | 347 | | "NEGATION",s -> t,("NEGATION",s) :: attrs,cat,coerced |
341 | | "MOOD",s -> t,("MOOD",s) :: attrs,cat,coerced | 348 | | "MOOD",s -> t,("MOOD",s) :: attrs,cat,coerced |
342 | | "TENSE",s -> t,("TENSE",s) :: attrs,cat,coerced | 349 | | "TENSE",s -> t,("TENSE",s) :: attrs,cat,coerced |
350 | + | "CTYPE",s -> t,("CTYPE",s) :: attrs,cat,coerced | ||
343 | | "controller",s -> t,("controller",s) :: attrs,cat,coerced | 351 | | "controller",s -> t,("controller",s) :: attrs,cat,coerced |
344 | | "controllee",s -> t,("controllee",s) :: attrs,cat,coerced | 352 | | "controllee",s -> t,("controllee",s) :: attrs,cat,coerced |
345 | | "coref",s -> t,attrs,cat,coerced | 353 | | "coref",s -> t,attrs,cat,coerced |
@@ -388,6 +396,7 @@ let rec make_tree_rec references = function | @@ -388,6 +396,7 @@ let rec make_tree_rec references = function | ||
388 | | SingleRelation r -> SingleRelation r | 396 | | SingleRelation r -> SingleRelation r |
389 | (* | TripleRelation(r,a,s,t) -> TripleRelation(r,a,make_tree_rec references s,make_tree_rec references t) *) | 397 | (* | TripleRelation(r,a,s,t) -> TripleRelation(r,a,make_tree_rec references s,make_tree_rec references t) *) |
390 | | AddRelation(t,r,a,s) -> AddRelation(make_tree_rec references t,r,a,make_tree_rec references s) | 398 | | AddRelation(t,r,a,s) -> AddRelation(make_tree_rec references t,r,a,make_tree_rec references s) |
399 | + | AddSingleRelation(r,s) -> AddSingleRelation(r,make_tree_rec references s) | ||
391 | | RemoveRelation(r,a,t) -> RemoveRelation(r,a,make_tree_rec references t) | 400 | | RemoveRelation(r,a,t) -> RemoveRelation(r,a,make_tree_rec references t) |
392 | | SetContextName(s,t) -> SetContextName(s,make_tree_rec references t) | 401 | | SetContextName(s,t) -> SetContextName(s,make_tree_rec references t) |
393 | | CreateContext(s,t) -> CreateContext(s,make_tree_rec references t) | 402 | | CreateContext(s,t) -> CreateContext(s,make_tree_rec references t) |
@@ -414,6 +423,7 @@ let rec validate_translation r = function | @@ -414,6 +423,7 @@ let rec validate_translation r = function | ||
414 | | SingleRelation _ -> () | 423 | | SingleRelation _ -> () |
415 | (* | TripleRelation(_,_,s,t) -> validate_translation r s; validate_translation r t *) | 424 | (* | TripleRelation(_,_,s,t) -> validate_translation r s; validate_translation r t *) |
416 | | AddRelation(t,_,_,s) -> validate_translation r t; validate_translation r s | 425 | | AddRelation(t,_,_,s) -> validate_translation r t; validate_translation r s |
426 | + | AddSingleRelation(_,s) -> validate_translation r s | ||
417 | | RemoveRelation(_,_,t) -> validate_translation r t | 427 | | RemoveRelation(_,_,t) -> validate_translation r t |
418 | | SetContextName(s,t) -> validate_translation r t | 428 | | SetContextName(s,t) -> validate_translation r t |
419 | | CreateContext(s,t) -> validate_translation r t | 429 | | CreateContext(s,t) -> validate_translation r t |
@@ -508,6 +518,13 @@ let rec reduce_tree = function | @@ -508,6 +518,13 @@ let rec reduce_tree = function | ||
508 | (* | TripleRelation(r,a,s,t) -> TripleRelation(r,a,reduce_tree s,reduce_tree t) *) | 518 | (* | TripleRelation(r,a,s,t) -> TripleRelation(r,a,reduce_tree s,reduce_tree t) *) |
509 | (* | AddRelation(Concept c,r,a,s) -> reduce_tree (Concept{c with c_relations=Tuple[Relation(Val r,Val a,s);c.c_relations]}) | 519 | (* | AddRelation(Concept c,r,a,s) -> reduce_tree (Concept{c with c_relations=Tuple[Relation(Val r,Val a,s);c.c_relations]}) |
510 | | AddRelation(Context c,r,a,s) -> reduce_tree (Context{c with cx_relations=Tuple[Relation(Val r,Val a,s);c.cx_relations]})*) | 520 | | AddRelation(Context c,r,a,s) -> reduce_tree (Context{c with cx_relations=Tuple[Relation(Val r,Val a,s);c.cx_relations]})*) |
521 | + | AddSingleRelation(r,t) -> | ||
522 | + (match reduce_tree t with | ||
523 | + Concept t -> Concept{t with c_relations=Tuple[t.c_relations;SingleRelation r]} | ||
524 | + | Context({cx_sense=Val "czy"} as t) -> Context t | ||
525 | + | Context({cx_sense=Val "jaki"} as t) -> Context t | ||
526 | + | Context({cx_sense=Dot} as t) -> Context{t with cx_sense=Val "czy"} | ||
527 | + | t -> AddSingleRelation(r,t)) | ||
511 | | AddRelation(t,r,a,s) -> simplify_tree_add_relation r a (reduce_tree s) (reduce_tree t) | 528 | | AddRelation(t,r,a,s) -> simplify_tree_add_relation r a (reduce_tree s) (reduce_tree t) |
512 | (* let t = reduce_tree t in | 529 | (* let t = reduce_tree t in |
513 | let s = reduce_tree s in | 530 | let s = reduce_tree s in |
semantics/ENIAMsemGraphOf.ml
@@ -270,6 +270,13 @@ let rec print_graph2_rec file edge_rev edge_label edge_style edge_head upper = f | @@ -270,6 +270,13 @@ let rec print_graph2_rec file edge_rev edge_label edge_style edge_head upper = f | ||
270 | let _ = print_graph2_rec file false "" "" "" id t in | 270 | let _ = print_graph2_rec file false "" "" "" id t in |
271 | let _ = print_graph2_rec file false "" "" "" id s in | 271 | let _ = print_graph2_rec file false "" "" "" id s in |
272 | id | 272 | id |
273 | + | AddSingleRelation(role,t) -> | ||
274 | + let id = !id_counter in | ||
275 | + incr id_counter; | ||
276 | + fprintf file " %d [shape=circle,label=\"AddSingleRelation\\n%s\"]\n" id (ENIAMsemStringOf.linear_term 0 role); | ||
277 | + print_edge2 file edge_rev edge_label edge_style edge_head "" upper id; | ||
278 | + let _ = print_graph2_rec file false "" "" "" id t in | ||
279 | + id | ||
273 | | RemoveRelation(role,role_attr,t) -> | 280 | | RemoveRelation(role,role_attr,t) -> |
274 | let id = !id_counter in | 281 | let id = !id_counter in |
275 | incr id_counter; | 282 | incr id_counter; |
semantics/ENIAMsemLatexOf.ml
@@ -75,6 +75,7 @@ let rec linear_term c = function | @@ -75,6 +75,7 @@ let rec linear_term c = function | ||
75 | | SingleRelation r -> "{\\bf singlerelation}(" ^ linear_term 0 r ^ ")" | 75 | | SingleRelation r -> "{\\bf singlerelation}(" ^ linear_term 0 r ^ ")" |
76 | (* | TripleRelation(r,a,c,t) -> "{\\bf triplerelation}(" ^ (*linear_term 0*) r ^ "," ^ (*linear_term 0*) a ^ "," ^ linear_term 0 c ^ "," ^ linear_term 0 t ^ ")" *) | 76 | (* | TripleRelation(r,a,c,t) -> "{\\bf triplerelation}(" ^ (*linear_term 0*) r ^ "," ^ (*linear_term 0*) a ^ "," ^ linear_term 0 c ^ "," ^ linear_term 0 t ^ ")" *) |
77 | | AddRelation(t,r,a,s) -> "{\\bf addrelation}(" ^ linear_term 0 t ^ "," ^ r ^ "," ^ a ^ "," ^ linear_term 0 s ^ ")" | 77 | | AddRelation(t,r,a,s) -> "{\\bf addrelation}(" ^ linear_term 0 t ^ "," ^ r ^ "," ^ a ^ "," ^ linear_term 0 s ^ ")" |
78 | + | AddSingleRelation(r,s) -> "{\\bf addrelation}(" ^ linear_term 0 r ^ "," ^ linear_term 0 s ^ ")" | ||
78 | | RemoveRelation(r,a,t) -> "{\\bf removerelation}(" ^ r ^ "," ^ a ^ "," ^ linear_term 0 t ^ ")" | 79 | | RemoveRelation(r,a,t) -> "{\\bf removerelation}(" ^ r ^ "," ^ a ^ "," ^ linear_term 0 t ^ ")" |
79 | | SetContextName(s,t) -> "{\\bf setcontextname}(" ^ linear_term 0 s ^ "," ^ linear_term 0 t ^ ")" | 80 | | SetContextName(s,t) -> "{\\bf setcontextname}(" ^ linear_term 0 s ^ "," ^ linear_term 0 t ^ ")" |
80 | | CreateContext(s,t) -> "{\\bf createcontext}(" ^ linear_term 0 (Context s) ^ "," ^ linear_term 0 t ^ ")" | 81 | | CreateContext(s,t) -> "{\\bf createcontext}(" ^ linear_term 0 (Context s) ^ "," ^ linear_term 0 t ^ ")" |
semantics/ENIAMsemLexicon.ml
@@ -45,7 +45,7 @@ let parse_multi p = function | @@ -45,7 +45,7 @@ let parse_multi p = function | ||
45 | | tokens -> tokens,p | 45 | | tokens -> tokens,p |
46 | 46 | ||
47 | let parse_morf p = function | 47 | let parse_morf p = function |
48 | - [T "1"] -> {p with is_necessary=Opt} | 48 | + [T "1"] -> if p.is_necessary=Multi then p else {p with is_necessary=Opt} |
49 | | tokens -> | 49 | | tokens -> |
50 | let l = Xlist.map (try Lexer.split_symbol (T "*") [] tokens with _ -> failwith "parse_morf: split_symbol *") (function | 50 | let l = Xlist.map (try Lexer.split_symbol (T "*") [] tokens with _ -> failwith "parse_morf: split_symbol *") (function |
51 | [T s] -> Atom s | 51 | [T s] -> Atom s |
semantics/ENIAMsemStringOf.ml
@@ -52,6 +52,7 @@ let rec linear_term c = function | @@ -52,6 +52,7 @@ let rec linear_term c = function | ||
52 | | SingleRelation r -> "singlerelation(" ^ linear_term 0 r ^ ")" | 52 | | SingleRelation r -> "singlerelation(" ^ linear_term 0 r ^ ")" |
53 | (* | TripleRelation(r,a,c,t) -> "triplerelation(" ^ r ^ "," ^ a ^ "," ^ linear_term 0 c ^ "," ^ linear_term 0 t ^ ")" *) | 53 | (* | TripleRelation(r,a,c,t) -> "triplerelation(" ^ r ^ "," ^ a ^ "," ^ linear_term 0 c ^ "," ^ linear_term 0 t ^ ")" *) |
54 | | AddRelation(t,r,a,s) -> "addrelation(" ^ linear_term 0 t ^ "," ^ r ^ "," ^ a ^ "," ^ linear_term 0 s ^ ")" | 54 | | AddRelation(t,r,a,s) -> "addrelation(" ^ linear_term 0 t ^ "," ^ r ^ "," ^ a ^ "," ^ linear_term 0 s ^ ")" |
55 | + | AddSingleRelation(r,s) -> "addsinglerelation(" ^ linear_term 0 r ^ "," ^ linear_term 0 s ^ ")" | ||
55 | | RemoveRelation(r,a,t) -> "removerelation(" ^ r ^ "," ^ a ^ "," ^ linear_term 0 t ^ ")" | 56 | | RemoveRelation(r,a,t) -> "removerelation(" ^ r ^ "," ^ a ^ "," ^ linear_term 0 t ^ ")" |
56 | | SetContextName(s,t) -> "setcontextname(" ^ linear_term 0 s ^ "," ^ linear_term 0 t ^ ")" | 57 | | SetContextName(s,t) -> "setcontextname(" ^ linear_term 0 s ^ "," ^ linear_term 0 t ^ ")" |
57 | | CreateContext(s,t) -> "createcontext(" ^ linear_term 0 (Context s) ^ "," ^ linear_term 0 t ^ ")" | 58 | | CreateContext(s,t) -> "createcontext(" ^ linear_term 0 (Context s) ^ "," ^ linear_term 0 t ^ ")" |
semantics/ENIAMsemTypes.ml
@@ -72,7 +72,8 @@ and linear_term = | @@ -72,7 +72,8 @@ and linear_term = | ||
72 | | RevRelation of string * string * linear_term (* role * role_attr * concept *) | 72 | | RevRelation of string * string * linear_term (* role * role_attr * concept *) |
73 | | SingleRelation of linear_term | 73 | | SingleRelation of linear_term |
74 | (* | TripleRelation of string * string * linear_term * linear_term (* role * role_attr * concept *) *) | 74 | (* | TripleRelation of string * string * linear_term * linear_term (* role * role_attr * concept *) *) |
75 | - | AddRelation of linear_term * string * string * linear_term (* nadrządnik * role * role_attr * podrzędnik *) | 75 | + | AddRelation of linear_term * string * string * linear_term (* nadrzędnik * role * role_attr * podrzędnik *) |
76 | + | AddSingleRelation of linear_term * linear_term (* role * podrzędnik *) | ||
76 | | RemoveRelation of string * string * linear_term | 77 | | RemoveRelation of string * string * linear_term |
77 | | SetContextName of linear_term * linear_term (* sense * concept *) | 78 | | SetContextName of linear_term * linear_term (* sense * concept *) |
78 | | CreateContext of context * linear_term (* context * args *) | 79 | | CreateContext of context * linear_term (* context * args *) |
semantics/ENIAMsemValence.ml
@@ -220,7 +220,9 @@ let string_of_arg arg = | @@ -220,7 +220,9 @@ let string_of_arg arg = | ||
220 | String.concat ", " (Xlist.map arg (fun ((arg_symbol,dir),t) -> (string_of_argdir dir) ^ arg_symbol ^ ":" ^ ENIAM_LCGstringOf.linear_term 0 t)) | 220 | String.concat ", " (Xlist.map arg (fun ((arg_symbol,dir),t) -> (string_of_argdir dir) ^ arg_symbol ^ ":" ^ ENIAM_LCGstringOf.linear_term 0 t)) |
221 | 221 | ||
222 | let string_of_position p = | 222 | let string_of_position p = |
223 | - (string_of_argdir p.dir) ^ String.concat "+" (StringSet.to_list p.morfs) | 223 | + (string_of_argdir p.dir) ^ |
224 | + (if p.is_multi then "?" else "") ^ | ||
225 | + String.concat "+" (StringSet.to_list p.morfs) | ||
224 | 226 | ||
225 | let manage_arg p t = | 227 | let manage_arg p t = |
226 | let t = SetAttr("gf",Val (ENIAMwalStringOf.gf p.gf),t) in | 228 | let t = SetAttr("gf",Val (ENIAMwalStringOf.gf p.gf),t) in |
@@ -383,8 +385,10 @@ let rec assign_frames_rec tokens lex_sems tree arg_symbols visited = function | @@ -383,8 +385,10 @@ let rec assign_frames_rec tokens lex_sems tree arg_symbols visited = function | ||
383 | let frame = ENIAMsemLexicon.extend_frame phsymbol frame in | 385 | let frame = ENIAMsemLexicon.extend_frame phsymbol frame in |
384 | (* print_endline "passed"; *) | 386 | (* print_endline "passed"; *) |
385 | (attrs,symbol,frame,Xlist.rev_map frame.positions (translate_position (string_of_int t.id))) :: frames | 387 | (attrs,symbol,frame,Xlist.rev_map frame.positions (translate_position (string_of_int t.id))) :: frames |
386 | - with Not_found -> (*print_endline "rejected";*) frames) in | ||
387 | - if frames = [] then failwith "assign_frames_rec: no frame" else | 388 | + with Not_found -> |
389 | + (* print_endline "rejected"; *) | ||
390 | + frames) in | ||
391 | + if frames = [] then failwith ("assign_frames_rec: no frame phsymbol='" ^ phsymbol ^ "' node='" ^ t.lemma ^ "'") else | ||
388 | let prong_attrs = get_prong_attrs t.attrs in | 392 | let prong_attrs = get_prong_attrs t.attrs in |
389 | let e = ENIAM_LCGreductions.get_variant_label () in | 393 | let e = ENIAM_LCGreductions.get_variant_label () in |
390 | let l,_ = Xlist.fold frames ([],1) (fun (l,n) (attrs,symbol,frame,positions) -> | 394 | let l,_ = Xlist.fold frames ([],1) (fun (l,n) (attrs,symbol,frame,positions) -> |
@@ -404,7 +408,9 @@ let rec assign_frames_rec tokens lex_sems tree arg_symbols visited = function | @@ -404,7 +408,9 @@ let rec assign_frames_rec tokens lex_sems tree arg_symbols visited = function | ||
404 | ("fopinion",Val (ENIAMwalStringOf.opinion frame.fopinion)) :: | 408 | ("fopinion",Val (ENIAMwalStringOf.opinion frame.fopinion)) :: |
405 | ("sopinion",Val (ENIAMwalStringOf.opinion frame.sopinion)) :: attrs; args=args; symbol=symbol}) :: | 409 | ("sopinion",Val (ENIAMwalStringOf.opinion frame.sopinion)) :: attrs; args=args; symbol=symbol}) :: |
406 | l,n+1))) in | 410 | l,n+1))) in |
407 | - if l = [] then ((*print_endline ("assign_frames_rec 4: no frame assingment found for " ^ t.lemma ^ " " ^ ENIAM_LCGstringOf.linear_term 0 t.symbol);*)raise (NoFrame(t.lemma,ENIAM_LCGstringOf.linear_term 0 t.symbol,visited))) else | 411 | + if l = [] then ( |
412 | + (* print_endline ("assign_frames_rec 4: no frame assingment found for " ^ t.lemma ^ " " ^ ENIAM_LCGstringOf.linear_term 0 t.symbol); *) | ||
413 | + raise (NoFrame(t.lemma,ENIAM_LCGstringOf.linear_term 0 t.symbol,visited))) else | ||
408 | Variant(e,l),visited | 414 | Variant(e,l),visited |
409 | | Variant(e,l) -> | 415 | | Variant(e,l) -> |
410 | let a = ref "" in | 416 | let a = ref "" in |
semantics/ENIAMsemXMLof.ml
@@ -61,6 +61,9 @@ let rec linear_term = function | @@ -61,6 +61,9 @@ let rec linear_term = function | ||
61 | | AddRelation(t,r,a,s) -> | 61 | | AddRelation(t,r,a,s) -> |
62 | Xml.Element("AddRelation",["role",r;"role_attribute",a], | 62 | Xml.Element("AddRelation",["role",r;"role_attribute",a], |
63 | [Xml.Element("",[],[linear_term t]);Xml.Element("",[],[linear_term s])]) | 63 | [Xml.Element("",[],[linear_term t]);Xml.Element("",[],[linear_term s])]) |
64 | + | AddSingleRelation(r,s) -> | ||
65 | + Xml.Element("AddSingleRelation",[], | ||
66 | + [Xml.Element("",[],[linear_term r]);Xml.Element("",[],[linear_term s])]) | ||
64 | | RemoveRelation(r,a,t) -> Xml.Element("RemoveRelation",["role",r;"role_attribute",a],[linear_term t]) | 67 | | RemoveRelation(r,a,t) -> Xml.Element("RemoveRelation",["role",r;"role_attribute",a],[linear_term t]) |
65 | | SetContextName(s,t) -> | 68 | | SetContextName(s,t) -> |
66 | Xml.Element("SetContextName",[],[linear_term s;linear_term t]) | 69 | Xml.Element("SetContextName",[],[linear_term s;linear_term t]) |