Commit 07bef54c54ffa9673b4e6258e2af2d4b820a1bce
1 parent
44e8be87
różne zmiany
Showing
77 changed files
with
90000 additions
and
1161 deletions
Too many changes to show.
To preserve performance only 43 of 77 files are displayed.
LCGlexicon/ENIAM_LCGlexicon.ml
... | ... | @@ -24,8 +24,8 @@ open ENIAMcategoriesPL |
24 | 24 | |
25 | 25 | let rec find_selector s = function |
26 | 26 | (t,Eq,x :: _) :: l -> if t = s then x else find_selector s l |
27 | - | (t,_,_) :: l -> if t = s then failwith "find_selector 1" else find_selector s l | |
28 | - | [] -> failwith "find_selector 2" | |
27 | + | (t,_,_) :: l -> if t = s then failwith ("find_selector 2: " ^ string_of_selector s) else find_selector s l | |
28 | + | [] -> failwith ("find_selector 2: " ^ string_of_selector s) | |
29 | 29 | |
30 | 30 | let rec get_syntax rev = function |
31 | 31 | Syntax syntax :: rule -> syntax, (List.rev rev) @ rule |
... | ... | @@ -42,6 +42,17 @@ let rec get_bracket rev = function |
42 | 42 | | t :: rule -> get_bracket (t :: rev) rule |
43 | 43 | | [] -> false, List.rev rev |
44 | 44 | |
45 | +let rec get_coord rev = function | |
46 | + Coord :: rule -> Coord, (List.rev rev) @ rule | |
47 | + | PreCoord :: rule -> PreCoord, (List.rev rev) @ rule | |
48 | + | t :: rule -> get_coord (t :: rev) rule | |
49 | + | [] -> NoCoord, List.rev rev | |
50 | + | |
51 | +let rec get_cost rev = function | |
52 | + Cost n :: rule -> n, (List.rev rev) @ rule | |
53 | + | t :: rule -> get_cost (t :: rev) rule | |
54 | + | [] -> 0, List.rev rev | |
55 | + | |
45 | 56 | let rec get_raised rev = function |
46 | 57 | Raised raised :: rule -> raised, (List.rev rev) @ rule |
47 | 58 | | t :: rule -> get_raised (t :: rev) rule |
... | ... | @@ -59,21 +70,25 @@ let merge_quant pos_quants quants = |
59 | 70 | else (cat,v) :: l, map) in |
60 | 71 | List.rev (SelectorMap.fold map l (fun l cat v -> (cat,v) :: l)) |
61 | 72 | |
62 | -let assign_quantifiers (selectors,rule,weight) = | |
63 | - let pos = find_selector Pos selectors in | |
73 | +let assign_quantifiers e = | |
74 | + let pos = find_selector Pos e.selectors in | |
64 | 75 | let categories = |
65 | 76 | try StringMap.find pos_categories pos |
66 | 77 | with Not_found -> failwith ("assign_quantifiers: unknown part of speech " ^ pos) in |
67 | 78 | let categories = Xlist.map categories (fun s -> s,Top) in |
68 | - let syntax,rule = get_syntax [] rule in | |
79 | + let syntax,rule = get_syntax [] e.rule in | |
69 | 80 | let quant,rule = get_quant [] rule in |
81 | + let coord,rule = get_coord [] rule in | |
70 | 82 | let bracket,rule = get_bracket [] rule in |
71 | 83 | let quant = merge_quant categories quant in |
72 | - selectors, (bracket,quant,syntax),(rule,weight) | |
84 | + let cost,rule = get_cost [] rule in | |
85 | + {e with rule=rule; bracket=bracket; coord=coord; quant=quant; syntax=syntax; cost=cost} | |
73 | 86 | |
74 | 87 | let rec check_quantifiers_int_rec (selectors,syntax) quants = function |
75 | 88 | Atom x -> () |
76 | 89 | | AVar "schema" -> () |
90 | + | AVar "local-schema" -> () | |
91 | + | AVar "distant-schema" -> () | |
77 | 92 | | AVar x -> |
78 | 93 | if not (SelectorSet.mem quants (selector_of_string x)) |
79 | 94 | then failwith ("Variable '" ^ x ^ "' is not quantified in rule " ^ string_of_selectors selectors ^ ": " ^ ENIAM_LCGstringOf.grammar_symbol 0 syntax) |
... | ... | @@ -87,25 +102,25 @@ let rec check_quantifiers_rec rule quants = function |
87 | 102 | | Imp(s,d,t) -> check_quantifiers_rec rule quants s; check_quantifiers_rec rule quants t |
88 | 103 | | One -> () |
89 | 104 | | ImpSet(s,l) -> check_quantifiers_rec rule quants s; Xlist.iter l (fun (_,t) -> check_quantifiers_rec rule quants t) |
90 | - | Star s -> check_quantifiers_rec rule quants s | |
105 | + | Conj s -> check_quantifiers_rec rule quants s | |
91 | 106 | | Maybe s -> check_quantifiers_rec rule quants s |
92 | 107 | | _ -> failwith "check_quantifiers_rec" |
93 | 108 | |
94 | -let check_quantifiers (selectors,(bracket,quant,syntax),_) = | |
95 | - let quants = Xlist.fold quant SelectorSet.empty (fun quants (q,_) -> SelectorSet.add quants q) in | |
96 | - check_quantifiers_rec (selectors,syntax) quants syntax | |
109 | +let check_quantifiers e = | |
110 | + let quants = Xlist.fold e.quant SelectorSet.empty (fun quants (q,_) -> SelectorSet.add quants q) in | |
111 | + check_quantifiers_rec (e.selectors,e.syntax) quants e.syntax | |
97 | 112 | |
98 | -let assign_semantics (selectors,(bracket,quant,syntax),(rule,weight)) = | |
113 | +let assign_semantics e = | |
99 | 114 | let semantics = try |
100 | - let raised,rule = get_raised [] rule in | |
115 | + let raised,rule = get_raised [] e.rule in | |
101 | 116 | if rule <> [] then failwith "assign_semantics 1" else |
102 | - RaisedSem(Xlist.map quant fst, raised) | |
117 | + RaisedSem(Xlist.map e.quant fst, raised) | |
103 | 118 | with Not_found -> (try |
104 | - let term,rule = get_sem_term [] rule in | |
119 | + let term,rule = get_sem_term [] e.rule in | |
105 | 120 | if rule <> [] then failwith "assign_semantics 2" else |
106 | - TermSem(Xlist.map quant fst,term) | |
107 | - with Not_found -> BasicSem(Xlist.map quant fst)) in | |
108 | - selectors,(bracket,quant,syntax),(semantics,weight) | |
121 | + TermSem(Xlist.map e.quant fst,term) | |
122 | + with Not_found -> BasicSem(Xlist.map e.quant fst)) in | |
123 | + {e with rule=[]; semantics=semantics} | |
109 | 124 | |
110 | 125 | let rec add_x_args_rec = function |
111 | 126 | Imp(s,d,t) -> Imp(add_x_args_rec s,d,t) |
... | ... | @@ -133,9 +148,9 @@ let rec is_raised_syntax = function |
133 | 148 | | t -> failwith ("is_raised_syntax: " ^ ENIAM_LCGstringOf.grammar_symbol 0 t) |
134 | 149 | |
135 | 150 | |
136 | -let add_x_args (selectors,(bracket,quant,syntax),(semantics,weight)) = | |
137 | - if is_raised_syntax syntax then (selectors,(bracket,quant,syntax),(semantics,weight)) | |
138 | - else (selectors,(bracket,quant,add_x_args_rec syntax),(semantics,weight)) | |
151 | +let add_x_args e = | |
152 | + if is_raised_syntax e.syntax then e | |
153 | + else {e with syntax=add_x_args_rec e.syntax} | |
139 | 154 | |
140 | 155 | let rec extract_category pat rev = function |
141 | 156 | (cat,rel,v) :: l -> if cat = pat then rel,v,(List.rev rev @ l) else extract_category pat ((cat,rel,v) :: rev) l |
... | ... | @@ -143,17 +158,17 @@ let rec extract_category pat rev = function |
143 | 158 | |
144 | 159 | let dict_of_grammar grammar = |
145 | 160 | (* print_endline "dict_of_grammar"; *) |
146 | - Xlist.fold grammar StringMap.empty (fun dict (selectors,(bracket,quant,syntax),semantics) -> | |
147 | - let pos_rel,poss,selectors = try extract_category Pos [] selectors with Not_found -> failwith "dict_of_grammar 1" in | |
161 | + Xlist.fold grammar StringMap.empty (fun dict e -> | |
162 | + let pos_rel,poss,selectors = try extract_category Pos [] e.selectors with Not_found -> failwith "dict_of_grammar 1" in | |
148 | 163 | let lemma_rel,lemmas,selectors = try extract_category Lemma [] selectors with Not_found -> Eq,[],selectors in |
149 | 164 | if pos_rel <> Eq || lemma_rel <> Eq then failwith "dict_of_grammar 2" else |
150 | - let rule = selectors,(bracket,quant,syntax),semantics in | |
165 | + let e = {e with selectors=selectors} in | |
151 | 166 | Xlist.fold poss dict (fun dict pos -> |
152 | 167 | let dict2,l = try StringMap.find dict pos with Not_found -> StringMap.empty,[] in |
153 | 168 | let dict2,l = |
154 | - if lemmas = [] then dict2,rule :: l else | |
169 | + if lemmas = [] then dict2,e :: l else | |
155 | 170 | Xlist.fold lemmas dict2 (fun dict2 lemma -> |
156 | - StringMap.add_inc dict2 lemma [rule] (fun l -> rule :: l)),l in | |
171 | + StringMap.add_inc dict2 lemma [e] (fun l -> e :: l)),l in | |
157 | 172 | StringMap.add dict pos (dict2,l))) |
158 | 173 | |
159 | 174 | let make_rules x_flag filename = |
... | ... | @@ -164,39 +179,57 @@ let make_rules x_flag filename = |
164 | 179 | let lexicon = if x_flag then List.rev (Xlist.rev_map lexicon add_x_args) else lexicon in |
165 | 180 | dict_of_grammar lexicon |
166 | 181 | |
182 | +let make_rules_list x_flag filenames = | |
183 | + let lexicon = Xlist.fold filenames [] (fun lexicon filename -> | |
184 | + ENIAM_LCGlexiconParser.load_lexicon filename @ lexicon) in | |
185 | + let lexicon = List.rev (Xlist.rev_map lexicon assign_quantifiers) in | |
186 | + Xlist.iter lexicon check_quantifiers; | |
187 | + let lexicon = List.rev (Xlist.rev_map lexicon assign_semantics) in | |
188 | + let lexicon = if x_flag then List.rev (Xlist.rev_map lexicon add_x_args) else lexicon in | |
189 | + dict_of_grammar lexicon | |
190 | + | |
167 | 191 | let find_rules rules cats = |
168 | 192 | let lex_rules,rules = try StringMap.find rules cats.pos with Not_found -> failwith ("find_rules: unable to find rules for category '" ^ cats.pos ^ "' lemma='" ^ cats.lemma ^ "'") in |
169 | 193 | (* Printf.printf "find_rules: %s %s |rules|=%d\n" cats.lemma cats.pos (Xlist.size rules); *) |
170 | 194 | let rules = try StringMap.find lex_rules cats.lemma @ rules with Not_found -> rules in |
171 | - Xlist.fold rules [] (fun rules (selectors,syntax,semantics) -> | |
195 | + Xlist.fold rules [] (fun rules e -> | |
172 | 196 | try |
173 | - let cats = apply_selectors cats selectors in | |
174 | - (cats,syntax,semantics) :: rules | |
197 | + let cats = apply_selectors cats e.selectors in | |
198 | + {e with cats=cats; selectors=[]} :: rules | |
175 | 199 | with Not_found -> rules) |
176 | 200 | |
177 | 201 | let prepare_lex_entries rules lex_entries cats = |
178 | 202 | Xlist.fold lex_entries rules (fun rules (selectors,rule) -> |
179 | 203 | let selectors = (Pos,Eq,[cats.pos]) :: selectors in |
180 | - let selectors,(bracket,quant,syntax),(rule,weight) = assign_quantifiers (selectors,[Syntax rule],0.) in | |
181 | - let selectors,(bracket,quant,syntax),(semantics,weight) = assign_semantics (selectors,(bracket,quant,syntax),(rule,weight)) in | |
204 | + let e = assign_quantifiers {empty_entry with selectors=selectors; rule=[Syntax rule]; weight=0.} in | |
205 | + let e = assign_semantics e in | |
182 | 206 | try |
183 | 207 | let cats = apply_selectors cats selectors in |
184 | - (cats,(bracket,quant,syntax),(semantics,weight)) :: rules | |
208 | + {e with cats=cats; selectors=[]} :: rules | |
185 | 209 | with Not_found -> rules) |
186 | 210 | |
187 | 211 | let assign_valence valence rules = |
188 | - Xlist.fold rules [] (fun l (cats,(bracket,quant,syntax),semantics) -> | |
212 | + Xlist.fold rules [] (fun l e -> | |
189 | 213 | (* Printf.printf "%s %s |valence|=%d\n" cats.lemma cats.pos (Xlist.size valence); *) |
190 | - if ENIAM_LCGrenderer.count_avar "schema" syntax > 0 then | |
191 | - Xlist.fold valence l (fun l (selectors,schema) -> | |
214 | + if ENIAM_LCGrenderer.count_avar "schema" e.syntax > 0 || | |
215 | + ENIAM_LCGrenderer.count_avar "local-schema" e.syntax > 0 || | |
216 | + ENIAM_LCGrenderer.count_avar "distant-schema" e.syntax > 0 then | |
217 | + Xlist.fold valence l (fun l (selectors,local_schema,schema,distant_schema) -> | |
192 | 218 | try |
193 | 219 | (* Printf.printf "selectors: %s\n" (string_of_selectors selectors); *) |
194 | 220 | (* Printf.printf "cats: %s\n%!" (string_of_cats cats); *) |
195 | - let cats = apply_selectors cats selectors in | |
221 | + (* if local_schema = schema then print_endline "identical" else print_endline "different"; *) | |
222 | + let cats = apply_selectors e.cats selectors in | |
196 | 223 | (* print_endline "passed"; *) |
197 | - (cats,(bracket,quant,ENIAM_LCGrenderer.substitute_schema "schema" schema syntax),semantics) :: l | |
224 | + (* Printf.printf "assign_valence 1: syntax=%s\n" (ENIAM_LCGstringOf.grammar_symbol 0 syntax); *) | |
225 | + let syntax = ENIAM_LCGrenderer.substitute_schema "schema" schema e.syntax in | |
226 | + (* Printf.printf "assign_valence 2: syntax=%s\n" (ENIAM_LCGstringOf.grammar_symbol 0 syntax); *) | |
227 | + let syntax = ENIAM_LCGrenderer.substitute_schema "local-schema" local_schema syntax in | |
228 | + let syntax = ENIAM_LCGrenderer.substitute_schema "distant-schema" distant_schema syntax in | |
229 | + (* Printf.printf "assign_valence 3: syntax=%s\n" (ENIAM_LCGstringOf.grammar_symbol 0 syntax); *) | |
230 | + {e with cats=cats; syntax=syntax} :: l | |
198 | 231 | with Not_found -> ((*print_endline "rejected";*) l)) |
199 | - else (cats,(bracket,quant,syntax),semantics) :: l) | |
232 | + else e :: l) | |
200 | 233 | |
201 | 234 | type labels = { |
202 | 235 | number: string; |
... | ... | @@ -222,14 +255,17 @@ let get_labels () = { |
222 | 255 | aspect=ENIAM_LCGreductions.get_variant_label (); |
223 | 256 | } |
224 | 257 | |
225 | -let make_quantification e rules = | |
226 | - Xlist.map rules (fun (cats,(bracket,quant,syntax),semantics) -> | |
227 | - let syntax = Xlist.fold (List.rev quant) syntax (fun syntax (cat,t) -> | |
228 | - let t = if t = Top then ENIAM_LCGrenderer.make_quant_restriction (match_selector cats cat) else t in | |
258 | +let make_quantification e2 rules = | |
259 | + Xlist.map rules (fun e -> | |
260 | + let syntax = Xlist.fold (List.rev e.quant) e.syntax (fun syntax (cat,t) -> | |
261 | + let t = if t = Top then ENIAM_LCGrenderer.make_quant_restriction (match_selector e.cats cat) else t in | |
229 | 262 | let category = string_of_selector cat in |
230 | - WithVar(category,t,get_label e cat,syntax)) in | |
231 | - let syntax = if bracket then ENIAM_LCGtypes.Bracket(true,true,syntax) else ENIAM_LCGtypes.Bracket(false,false,syntax) in | |
232 | - cats,syntax,semantics) | |
263 | + WithVar(category,t,get_label e2 cat,syntax)) in | |
264 | + let syntax = | |
265 | + if e.coord = Coord then ENIAM_LCGtypes.Conj syntax else | |
266 | + if e.coord = PreCoord then ENIAM_LCGtypes.Preconj else syntax in | |
267 | + let syntax = if e.bracket then ENIAM_LCGtypes.Bracket(true,true,syntax) else ENIAM_LCGtypes.Bracket(false,false,syntax) in | |
268 | + {e with syntax=syntax}) | |
233 | 269 | |
234 | 270 | let make_node id orth lemma pos syntax weight cat_list is_raised = |
235 | 271 | let attrs = Xlist.fold cat_list [] (fun attrs -> function |
... | ... | @@ -241,6 +277,7 @@ let make_node id orth lemma pos syntax weight cat_list is_raised = |
241 | 277 | | Coerced -> ("COERCED",SubstVar "coerced") :: attrs |
242 | 278 | | Role -> ("ROLE",SubstVar "role") :: attrs |
243 | 279 | | SNode -> ("NODE",SubstVar "node") :: attrs |
280 | + | Phrase -> ("PHRASE",SubstVar "phrase") :: attrs | |
244 | 281 | | Number -> ("NUM",SubstVar "number") :: attrs |
245 | 282 | | Case -> ("CASE",SubstVar "case") :: attrs |
246 | 283 | | Gender -> ("GEND",SubstVar "gender") :: attrs |
... | ... | @@ -256,7 +293,9 @@ let make_node id orth lemma pos syntax weight cat_list is_raised = |
256 | 293 | | Nsem -> ("NSEM", SubstVar "nsem") :: attrs |
257 | 294 | | Ctype -> ("CTYPE", SubstVar "ctype") :: attrs |
258 | 295 | | Mode -> ("MODE", SubstVar "mode") :: attrs |
259 | - | Psem -> ("PSEM", SubstVar "psem") :: attrs | |
296 | + (* | Psem -> ("PSEM", SubstVar "psem") :: attrs *) | |
297 | + | Pt -> ("PT", SubstVar "pt") :: attrs | |
298 | + | Col -> ("COL", SubstVar "col") :: attrs | |
260 | 299 | | Icat -> attrs |
261 | 300 | | Inumber -> attrs |
262 | 301 | | Igender -> attrs |
... | ... | @@ -264,6 +303,7 @@ let make_node id orth lemma pos syntax weight cat_list is_raised = |
264 | 303 | | Nperson -> attrs |
265 | 304 | | Ncat -> attrs |
266 | 305 | | Plemma -> attrs |
306 | + | Pcat -> attrs | |
267 | 307 | | Unumber -> attrs |
268 | 308 | | Ucase -> attrs |
269 | 309 | | Ugender -> attrs |
... | ... | @@ -296,37 +336,38 @@ let or_frame node = |
296 | 336 | Cut(SetAttr("ARG_SYMBOL",Tuple[Val "TODO"],App(Var "y",Var "x")))]})))) |
297 | 337 | |
298 | 338 | let make_term id orth rules = |
299 | - Xlist.map rules (fun (cats,syntax,(semantics,weight)) -> | |
339 | + Xlist.map rules (fun e -> | |
300 | 340 | ENIAM_LCGrenderer.reset_variable_names (); |
301 | 341 | ENIAM_LCGrenderer.add_variable_numbers (); |
302 | - (* print_endline ("make_term 0: " ^ ENIAM_LCGstringOf.grammar_symbol 0 syntax); *) | |
303 | - match semantics with | |
342 | + (* print_endline ("make_term 0: " ^ ENIAM_LCGstringOf.grammar_symbol 0 e.syntax); *) | |
343 | + match e.semantics with | |
304 | 344 | BasicSem cat_list -> |
305 | - let node = make_node id orth cats.lemma cats.pos syntax weight(*+.token.ENIAMtokenizerTypes.weight*) cat_list false in | |
306 | - (* print_endline ("make_term 1: " ^ ENIAM_LCGstringOf.grammar_symbol 0 syntax); *) | |
307 | - let semantics = ENIAM_LCGrenderer.make_term node syntax in | |
308 | - ENIAM_LCGrenderer.simplify (syntax,semantics) | |
345 | + let node = make_node id orth e.cats.lemma e.cats.pos e.syntax e.weight(*+.token.ENIAMtokenizerTypes.weight*) cat_list false in | |
346 | + (* print_endline ("make_term 1: " ^ ENIAM_LCGstringOf.grammar_symbol 0 e.syntax); *) | |
347 | + let semantics = ENIAM_LCGrenderer.make_term node e.syntax in | |
348 | + ENIAM_LCGrenderer.simplify (e.syntax,semantics), e.cost | |
309 | 349 | | RaisedSem(cat_list,outer_cat_list) -> |
310 | 350 | (* FIXME: jakie atrybuty powinien mieć outer node (w szczególności jaką wagę?) *) |
311 | - let node = make_node id orth cats.lemma cats.pos syntax weight(*+.token.ENIAMtokenizerTypes.weight*) cat_list true in | |
312 | - let outer_node = make_node id orth cats.lemma cats.pos syntax weight(*+.token.ENIAMtokenizerTypes.weight*) outer_cat_list false in | |
313 | - (* print_endline ("make_term 2: " ^ ENIAM_LCGstringOf.grammar_symbol 0 syntax); *) | |
314 | - let semantics = ENIAM_LCGrenderer.make_raised_term node outer_node syntax in | |
315 | - ENIAM_LCGrenderer.simplify (syntax,semantics) | |
351 | + let node = make_node id orth e.cats.lemma e.cats.pos e.syntax e.weight(*+.token.ENIAMtokenizerTypes.weight*) cat_list true in | |
352 | + let outer_node = make_node id orth e.cats.lemma e.cats.pos e.syntax e.weight(*+.token.ENIAMtokenizerTypes.weight*) outer_cat_list false in | |
353 | + (* print_endline ("make_term 2: " ^ ENIAM_LCGstringOf.grammar_symbol 0 e.syntax); *) | |
354 | + let semantics = ENIAM_LCGrenderer.make_raised_term node outer_node e.syntax in | |
355 | + ENIAM_LCGrenderer.simplify (e.syntax,semantics), e.cost | |
316 | 356 | | TermSem(cat_list,"λxλyλz.NODE(yx,z)") -> |
317 | - let node = make_node id orth cats.lemma cats.pos syntax weight(*+.token.ENIAMtokenizerTypes.weight*) cat_list false in | |
318 | - (* print_endline ("make_term 3: " ^ ENIAM_LCGstringOf.grammar_symbol 0 syntax); *) | |
357 | + let node = make_node id orth e.cats.lemma e.cats.pos e.syntax e.weight(*+.token.ENIAMtokenizerTypes.weight*) cat_list false in | |
358 | + (* print_endline ("make_term 3: " ^ ENIAM_LCGstringOf.grammar_symbol 0 e.syntax); *) | |
319 | 359 | let semantics = or_frame node in |
320 | - ENIAM_LCGrenderer.simplify (syntax,semantics) | |
360 | + ENIAM_LCGrenderer.simplify (e.syntax,semantics), e.cost | |
321 | 361 | | _ -> failwith "make_term: ni") |
322 | 362 | |
323 | 363 | let create_entries rules id orth cats valence lex_entries = |
364 | + (* Printf.printf "create_entries 1: orth=%s |cats|=%d |valence|=%d\n" orth (Xlist.size cats) (Xlist.size valence); *) | |
324 | 365 | Xlist.fold cats [] (fun l cats -> |
325 | - (* Printf.printf "create_entries: orth=%s lemma=%s pos=%s\n" orth cats.lemma cats.pos; *) | |
366 | + (* Printf.printf "create_entries 2: orth=%s lemma=%s cat=%s pos=%s pos2=%s\n" orth cats.lemma cats.cat cats.pos cats.pos2; *) | |
326 | 367 | (* variable_name_ref := []; *) |
327 | - if cats.pos="interp" && cats.lemma="<clause>" then (BracketSet(Forward),Dot) :: l else | |
328 | - if cats.pos="interp" && cats.lemma="</clause>" then (BracketSet(Backward),Dot) :: l else | |
329 | - if (cats.pos2="noun" || cats.pos2="verb" || cats.pos2="adj" || cats.pos2="adv") && cats.cat="X" && not !default_category_flag && cats.pos <> "aglt" then l else | |
368 | + if cats.pos="interp" && cats.lemma="<clause>" then ((BracketSet(Forward),Dot),0) :: l else | |
369 | + if cats.pos="interp" && cats.lemma="</clause>" then ((BracketSet(Backward),Dot),0) :: l else | |
370 | + if (cats.pos2="noun" || cats.pos2="verb" || cats.pos2="adj" || cats.pos2="adv" || cats.pos2="hour" || cats.pos2="day" || cats.pos2="year") && cats.cat="X" && not !default_category_flag && cats.pos <> "aglt" then l else | |
330 | 371 | let e = get_labels () in |
331 | 372 | (* print_endline "create_entries 1"; *) |
332 | 373 | let rules = find_rules rules cats in |
... | ... |
LCGlexicon/ENIAM_LCGlexiconParser.ml
... | ... | @@ -155,6 +155,8 @@ let find_internal_grammar_symbols atoms = function |
155 | 155 | | i,"T" -> i,B Top |
156 | 156 | | i,"1" -> i,C One |
157 | 157 | | i,"schema" -> i,D(Both,Tensor[AVar "schema"]) |
158 | + | i,"local-schema" -> i,D(Both,Tensor[AVar "local-schema"]) | |
159 | + | i,"distant-schema" -> i,D(Both,Tensor[AVar "distant-schema"]) | |
158 | 160 | | i,"adjuncts" -> i,D(Both,Tensor[AVar "adjuncts"]) |
159 | 161 | | i,s -> if StringSet.mem selector_names s then i,B (AVar s) else |
160 | 162 | if StringSet.mem atoms s then i,B (Atom s) else |
... | ... | @@ -319,6 +321,10 @@ let parse_raised i0 tokens = |
319 | 321 | |
320 | 322 | let rec find_syntax_end rev = function |
321 | 323 | ((_,"BRACKET") :: _) as tokens -> List.rev rev, tokens |
324 | + | ((_,"COORD") :: _) as tokens -> List.rev rev, tokens | |
325 | + | ((_,"PRECOORD") :: _) as tokens -> List.rev rev, tokens | |
326 | + | ((_,"SINGLE-COST") :: _) as tokens -> List.rev rev, tokens | |
327 | + | ((_,"DOUBLE-COST") :: _) as tokens -> List.rev rev, tokens | |
322 | 328 | | ((_,"QUANT") :: (_,"[") :: _) as tokens -> List.rev rev, tokens |
323 | 329 | | ((_,"RAISED") :: (_,"[") :: _) as tokens -> List.rev rev, tokens |
324 | 330 | | ((_,"SEM") :: (_,"[") :: _) as tokens -> List.rev rev, tokens |
... | ... | @@ -332,6 +338,10 @@ let rec parse_rule atoms = function |
332 | 338 | | (_,"QUANT") :: (i,"[") :: tokens -> |
333 | 339 | let quant,tokens = find_right_bracket i [] tokens in |
334 | 340 | Quant(parse_quantifiers i quant) :: parse_rule atoms tokens |
341 | + | (_,"COORD") :: tokens -> Coord :: parse_rule atoms tokens | |
342 | + | (_,"PRECOORD") :: tokens -> PreCoord :: parse_rule atoms tokens | |
343 | + | (_,"SINGLE-COST") :: tokens -> Cost 1 :: parse_rule atoms tokens | |
344 | + | (_,"DOUBLE-COST") :: tokens -> Cost 2 :: parse_rule atoms tokens | |
335 | 345 | | (_,"RAISED") :: (i,"[") :: tokens -> |
336 | 346 | let raised,tokens = find_right_bracket i [] tokens in |
337 | 347 | Raised(parse_raised i raised) :: parse_rule atoms tokens |
... | ... | @@ -356,7 +366,7 @@ let parse_entry i0 atoms weights tokens = |
356 | 366 | | _ -> raise (ParseError("parse_entry", "invalid number of ':' in entry " ^ String.concat " " (Xlist.map tokens snd), i0)) in |
357 | 367 | let selectors = parse_selectors i0 (prefix @ selectors) in |
358 | 368 | let rule = parse_rule atoms rule in |
359 | - selectors, rule, weight | |
369 | + {empty_entry with selectors=selectors; rule=rule; weight=weight} | |
360 | 370 | |
361 | 371 | let string_of_parse_error proc s i line = |
362 | 372 | Printf.sprintf "LCG lexicon error in line %d: %s\n%s: %s" i line proc s |
... | ... |
LCGlexicon/ENIAM_LCGlexiconTypes.ml
... | ... | @@ -17,20 +17,22 @@ |
17 | 17 | * along with this program. If not, see <http://www.gnu.org/licenses/>. |
18 | 18 | *) |
19 | 19 | |
20 | -type categories = {lemma: string; pos: string; pos2: string; cat: string; coerced: string list; roles: string list; snode: string list; | |
20 | +type categories = {lemma: string; pos: string; pos2: string; | |
21 | + cat: string; coerced: string list; roles: string list; snode: string list; phrase: string list; | |
21 | 22 | numbers: string list; cases: string list; genders: string list; persons: string list; |
22 | 23 | grads: string list; praeps: string list; acms: string list; |
23 | 24 | aspects: string list; negations: string list; moods: string list; tenses: string list; |
24 | - nsyn: string list; nsem: string list; modes: string list; psem: string list; | |
25 | + nsyn: string list; nsem: string list; modes: string list; (*psem: string list;*) | |
26 | + pt: string; col: string list; | |
25 | 27 | } |
26 | 28 | |
27 | 29 | type selector = |
28 | - Lemma | IncludeLemmata | (*NewLemma |*) Pos | Pos2 | Cat | Coerced | Role | SNode | | |
30 | + Lemma | IncludeLemmata | (*NewLemma |*) Pos | Pos2 | Cat | Coerced | Role | SNode | Phrase | | |
29 | 31 | Number | Case | Gender | Person | Grad | Praep | |
30 | - Acm | Aspect | Negation | Mood | Tense | Nsyn | Nsem | Ctype | Mode | Psem | | |
32 | + Acm | Aspect | Negation | Mood | Tense | Nsyn | Nsem | Ctype | Mode | (*Psem |*) Pt | Col | | |
31 | 33 | Icat | Inumber | Igender | Iperson | Nperson | Ncat | Plemma | |
32 | 34 | Unumber | Ucase | Ugender | Uperson | Amode | |
33 | - Irole | Prole | Nrole | Inode | Pnode | Nnode | |
35 | + Irole | Prole | Nrole | Inode | Pnode | Nnode | Pcat | |
34 | 36 | |
35 | 37 | module OrderedSelector = struct |
36 | 38 | type t = selector |
... | ... | @@ -43,6 +45,10 @@ module SelectorSet=Xset.Make(OrderedSelector) |
43 | 45 | type rule = |
44 | 46 | Bracket |
45 | 47 | | Quant of (selector * ENIAM_LCGtypes.internal_grammar_symbol) list |
48 | + | Coord | |
49 | + | PreCoord | |
50 | + | NoCoord | |
51 | + | Cost of int | |
46 | 52 | | Raised of selector list |
47 | 53 | | Syntax of ENIAM_LCGtypes.grammar_symbol |
48 | 54 | | Sem of string |
... | ... | @@ -75,12 +81,24 @@ type selector_relation = Eq | Neq (*| StrictEq*) |
75 | 81 | |
76 | 82 | *) |
77 | 83 | |
78 | -let empty_cats = {lemma=""; pos=""; pos2=""; cat="X"; coerced=[]; roles=[]; snode=[]; | |
84 | +let empty_cats = {lemma=""; pos=""; pos2=""; cat="C"; coerced=[]; roles=[]; snode=[]; phrase=[]; | |
79 | 85 | numbers=[]; cases=[]; genders=[]; persons=[]; |
80 | 86 | grads=[]; praeps=[]; acms=[]; aspects=[]; negations=[]; moods=[]; tenses=[]; |
81 | - nsyn=[]; nsem=[]; modes=[]; psem=[]; | |
87 | + nsyn=[]; nsem=[]; modes=[]; (*psem=[];*) pt=""; col=[]; | |
82 | 88 | } |
83 | 89 | |
90 | +type entry = { | |
91 | + selectors: (selector * selector_relation * string list) list; | |
92 | + rule: rule list; syntax: ENIAM_LCGtypes.grammar_symbol; | |
93 | + semantics: rule_sem; cats: categories; weight: float; | |
94 | + bracket: bool; coord: rule; | |
95 | + quant: (selector * ENIAM_LCGtypes.internal_grammar_symbol) list; | |
96 | + cost: int} | |
97 | + | |
98 | +let empty_entry = {selectors=[]; rule=[]; syntax=ENIAM_LCGtypes.One; | |
99 | + semantics=BasicSem []; cats=empty_cats; weight=0.; | |
100 | + bracket=false; coord=NoCoord; quant=[]; cost=0} | |
101 | + | |
84 | 102 | let default_category_flag = ref true |
85 | 103 | |
86 | 104 | let resource_path = |
... | ... |
LCGlexicon/ENIAMcategoriesPL.ml
... | ... | @@ -27,18 +27,24 @@ let all_genders = ["m1";"m2";"m3";"f";"n"] |
27 | 27 | let all_persons = ["pri";"sec";"ter"] |
28 | 28 | (* FIXME: zamiast wszystkich możliwych wartości można używać Zero gdy nie ma uzgodnienia *) |
29 | 29 | |
30 | +let all_phrases = [ | |
31 | + "np";"adjp";"advp";"infp";"ip"; | |
32 | + "prepnp";"cp";"ncp";"prepncp";"padvp";"colonp";"mp";"intp"; | |
33 | + "adja";"prepadjp";"comparp";"xp";"xpnom";"xpgen";"symbol";"fixed"; | |
34 | + "s";"<root>";"<sentence>";"<paragraph>";(*"";"";"";"";"";"";"";"";*)] | |
35 | + | |
30 | 36 | let selector_values = Xlist.fold [ |
31 | 37 | Lemma, []; |
32 | 38 | IncludeLemmata, []; |
33 | - Pos, ["subst";"depr";"ppron12";"ppron3";"siebie";"prep";"fixed";"num";"numcomp";"intnum"; | |
39 | + Pos, ["subst";"depr";"ppron12";"ppron3";"siebie";"prep";"fixed";"initial";"num";"numcomp";"intnum"; | |
34 | 40 | "realnum";"intnum-interval";"realnum-interval";"symbol";"ordnum"; |
35 | 41 | "date";"date-interval";"hour-minute";"hour";"hour-minute-interval"; |
36 | 42 | "hour-interval";"year";"year-interval";"day";"day-interval";"day-month"; |
37 | 43 | "day-month-interval";"month-interval";"roman";"roman-interval";"roman-ordnum"; |
38 | 44 | "match-result";"url";"email";"phone-number";"postal-code";"obj-id";"building-number";"list-item";"adj";"adjc";"adjp";"adja"; |
39 | 45 | "adv";"ger";"pact";"ppas";"fin";"bedzie";"praet";"winien";"impt"; |
40 | - "imps";"pred";"aglt";"inf";"pcon";"pant";"qub";"part";"comp";"conj";"interj"; | |
41 | - "sinterj";"burk";"interp";"xxx";"unk";"html-tag";"apron";"compar"]; | |
46 | + "imps";"pred";"aglt";"inf";"pcon";"pant";"pacta";"qub";"part";"comp";"conj";"interj"; | |
47 | + "sinterj";"burk";"interp";"xxx";"unk";"html-tag";"apron";"compar";"x";"other"]; | |
42 | 48 | Pos2, []; |
43 | 49 | Cat, []; |
44 | 50 | Coerced, []; |
... | ... | @@ -50,6 +56,7 @@ let selector_values = Xlist.fold [ |
50 | 56 | Inode, ["concept";"sit";"dot";"relations"]; |
51 | 57 | Pnode, ["concept";"sit";"dot";"relations"]; |
52 | 58 | Nnode, ["concept";"sit";"dot";"relations"]; |
59 | + Phrase, all_phrases; | |
53 | 60 | Number, all_numbers; |
54 | 61 | Case, "postp" :: "pred" :: all_cases; |
55 | 62 | Gender, all_genders; |
... | ... | @@ -64,8 +71,10 @@ let selector_values = Xlist.fold [ |
64 | 71 | Mood, ["indicative";"imperative";"conditional"]; |
65 | 72 | Tense, ["past";"pres";"fut"]; |
66 | 73 | Nsyn, ["proper";"pronoun";"common"]; |
67 | - Nsem, ["count";"time";"mass";"measure"]; | |
68 | - Psem, ["sem";"nosem"]; | |
74 | + Nsem, ["count";"mass";"measure"]; | |
75 | + (* Psem, ["sem";"nosem"]; *) | |
76 | + Pt, ["pt";"npt"]; | |
77 | + Col, ["col";"ncol"]; | |
69 | 78 | Ucase, all_cases; |
70 | 79 | ] SelectorMap.empty (fun map (selector,vals) -> SelectorMap.add map selector vals) |
71 | 80 | |
... | ... | @@ -82,6 +91,12 @@ let expand_cases cases = |
82 | 91 | let expand_akcs akcs = |
83 | 92 | if Xlist.mem akcs "_" then ["akc";"nakc"] else akcs |
84 | 93 | |
94 | +let expand_col = function | |
95 | + ["pt"] -> "pt",["col";"ncol"] | |
96 | + | ["col"] -> "npt",["col"] | |
97 | + | ["ncol"] -> "npt",["ncol"] | |
98 | + | _ -> failwith "expand_col" | |
99 | + | |
85 | 100 | let split_voc cases = |
86 | 101 | Xlist.fold cases ([],[]) (fun (cases,voc) -> function |
87 | 102 | "voc" -> cases, "voc" :: voc |
... | ... | @@ -92,9 +107,9 @@ let load_subst_data filename _ = |
92 | 107 | |
93 | 108 | let subst_uncountable_lexemes = ref StringSet.empty |
94 | 109 | let subst_uncountable_lexemes2 = ref StringSet.empty |
95 | -let subst_container_lexemes = ref StringSet.empty | |
110 | +(* let subst_container_lexemes = ref StringSet.empty *) | |
96 | 111 | let subst_numeral_lexemes = ref StringSet.empty |
97 | -let subst_time_lexemes = ref StringSet.empty | |
112 | +(* let subst_time_lexemes = ref StringSet.empty *) | |
98 | 113 | |
99 | 114 | let subst_pronoun_lexemes = StringSet.of_list ["co"; "kto"; "cokolwiek"; "ktokolwiek"; "nic"; "nikt"; "coś"; "ktoś"; "to"] |
100 | 115 | let adj_pronoun_lexemes = StringSet.of_list ["czyj"; "jaki"; "który"; "jakiś"; "ten"; "taki"] |
... | ... | @@ -120,9 +135,9 @@ let num_nsems = ref (StringMap.empty : string list StringMap.t) |
120 | 135 | let initialize () = |
121 | 136 | subst_uncountable_lexemes := File.catch_no_file (load_subst_data subst_uncountable_lexemes_filename) StringSet.empty; |
122 | 137 | subst_uncountable_lexemes2 := File.catch_no_file (load_subst_data subst_uncountable_lexemes_filename2) StringSet.empty; |
123 | - subst_container_lexemes := File.catch_no_file (load_subst_data subst_container_lexemes_filename) StringSet.empty; | |
138 | + (* subst_container_lexemes := File.catch_no_file (load_subst_data subst_container_lexemes_filename) StringSet.empty; *) | |
124 | 139 | subst_numeral_lexemes := File.catch_no_file (load_subst_data subst_numeral_lexemes_filename) StringSet.empty; |
125 | - subst_time_lexemes := File.catch_no_file (load_subst_data subst_time_lexemes_filename) StringSet.empty; | |
140 | + (* subst_time_lexemes := File.catch_no_file (load_subst_data subst_time_lexemes_filename) StringSet.empty; *) | |
126 | 141 | adv_modes := File.catch_no_file (load_adv_modes adv_modes_filename) StringMap.empty; |
127 | 142 | num_nsems := File.catch_no_file (load_num_nsems num_nsems_filename) StringMap.empty; |
128 | 143 | () |
... | ... | @@ -133,15 +148,15 @@ let noun_type proper lemma pos = |
133 | 148 | if pos = "ppron12" || pos = "ppron3" || pos = "siebie" then "pronoun" else |
134 | 149 | if pos = "symbol" || pos = "date" || pos = "date-interval" || pos = "hour" || pos = "hour-minute" || pos = "hour-interval" || pos = "hour-minute-interval" || |
135 | 150 | pos = "year" || pos = "year-interval" || pos = "day" || pos = "day-interval" || pos = "day-month" || pos = "day-month-interval" || |
136 | - pos = "match-result" || pos = "month-interval" || pos = "roman" || pos = "roman-interval" || pos = "url" || pos = "email" || pos = "phone-number" || pos = "postal-code" || pos = "obj-id" || pos = "building-number" || pos = "date" then "proper" else | |
151 | + pos = "match-result" || pos = "month-interval" || pos = "initial" || pos = "roman" || pos = "roman-interval" || pos = "url" || pos = "email" || pos = "phone-number" || pos = "postal-code" || pos = "obj-id" || pos = "building-number" || pos = "date" then "proper" else | |
137 | 152 | if StringSet.mem subst_pronoun_lexemes lemma then "pronoun" else |
138 | 153 | "common" in |
139 | 154 | let nsem = |
140 | 155 | if pos = "ppron12" || pos = "ppron3" || pos = "siebie" then ["count"] else |
141 | - if StringSet.mem !subst_time_lexemes lemma then ["time"] else | |
156 | + (* if StringSet.mem !subst_time_lexemes lemma then ["time"] else *) | |
142 | 157 | let l = ["count"] in |
143 | 158 | let l = if StringSet.mem !subst_uncountable_lexemes lemma || StringSet.mem !subst_uncountable_lexemes2 lemma then "mass" :: l else l in |
144 | - if StringSet.mem !subst_container_lexemes lemma then "measure" :: l else l in | |
159 | + (*if StringSet.mem !subst_container_lexemes lemma then "measure" :: l else*) l in | |
145 | 160 | [nsyn],nsem |
146 | 161 | |
147 | 162 | let adv_mode lemma = |
... | ... | @@ -161,27 +176,104 @@ let part_set = StringSet.of_list ["się"; "nie"; "by"; "niech"; "niechaj"; "niec |
161 | 176 | |
162 | 177 | let snode = SelectorMap.find selector_values SNode |
163 | 178 | |
164 | -let clarify_categories proper cat coerced (*snode*) = function | |
179 | +let simplify_pos = function | |
180 | + "subst" -> "noun" | |
181 | + | "depr" -> "noun" | |
182 | + | "symbol" -> "noun" | |
183 | + | "unk" -> "noun" | |
184 | + | "xxx" -> "noun" | |
185 | + (* | "psubst" -> "noun" | |
186 | + | "pdepr" -> "noun" *) | |
187 | + | "adj" -> "adj" | |
188 | + | "adjc" -> "adj" | |
189 | + | "adjp" -> "adj" | |
190 | + | "adja" -> "adj" | |
191 | + | "ordnum" -> "ordnum" | |
192 | + | "ger" -> "verb" | |
193 | + | "pact" -> "verb" | |
194 | + | "ppas" -> "verb" | |
195 | + | "fin" -> "verb" | |
196 | + | "bedzie" -> "verb" | |
197 | + | "praet" -> "verb" | |
198 | + | "winien" -> "verb" | |
199 | + | "impt" -> "verb" | |
200 | + | "imps" -> "verb" | |
201 | + | "inf" -> "verb" | |
202 | + | "pcon" -> "verb" | |
203 | + | "pant" -> "verb" | |
204 | + | "pacta" -> "verb" | |
205 | + | "pred" -> "verb" | |
206 | + | "ppron12" -> "pron" | |
207 | + | "ppron3" -> "pron" | |
208 | + | "siebie" -> "pron" | |
209 | + | "fixed" -> "fixed" | |
210 | + | "num" -> "num" | |
211 | + | "realnum" -> "num" | |
212 | + | "intnum" -> "num" | |
213 | + | "intnum-interval" -> "num" | |
214 | + | "realnum-interval" -> "num" | |
215 | + | "date" -> "date" | |
216 | + | "date-interval" -> "date" | |
217 | + | "hour-minute" -> "hour" | |
218 | + | "hour" -> "hour" | |
219 | + | "hour-minute-interval" -> "hour" | |
220 | + | "hour-interval" -> "hour" | |
221 | + | "year" -> "year" | |
222 | + | "year-interval" -> "year" | |
223 | + | "day" -> "day" | |
224 | + | "day-interval" -> "day" | |
225 | + | "day-month" -> "day-month" | |
226 | + | "day-month-interval" -> "day-month" | |
227 | + | "month-interval" -> "month" | |
228 | + | "initial" -> "initial" | |
229 | + | "roman" -> "symbol" | |
230 | + | "roman-interval" -> "symbol" | |
231 | + | "match-result" -> "symbol" | |
232 | + | "url" -> "symbol" | |
233 | + | "email" -> "symbol" | |
234 | + | "phone-number" -> "symbol" | |
235 | + | "postal-code" -> "symbol" | |
236 | + | "obj-id" -> "symbol" | |
237 | + | "building-number" -> "symbol" | |
238 | + | "x" -> "prep" | |
239 | + | s -> s | |
240 | + | |
241 | +let check_genders genders = | |
242 | + let genders,pt,col = Xlist.fold genders ([],"npt",[]) (fun (genders,pt,col) -> function | |
243 | + "n:col" -> "n" :: genders,pt,"col" :: col | |
244 | + | "n:ncol" -> "n" :: genders,pt,"ncol" :: col | |
245 | + | "n:pt" -> "n" :: genders,"pt",col | |
246 | + | "m1:pt" -> "m1" :: genders,"pt",col | |
247 | + | s -> s :: genders,pt,col) in | |
248 | + genders,pt,if col = [] then ["col";"ncol"] else col | |
249 | + | |
250 | + | |
251 | +let clarify_categories proper cat coerced (lemma,pos,interp) = | |
252 | + let cats = {empty_cats with lemma=lemma; pos=pos; pos2=simplify_pos pos; cat=cat; coerced=coerced; snode=snode; phrase=all_phrases} in | |
253 | + match lemma,pos,interp with | |
165 | 254 | lemma,"subst",[numbers;cases;genders] -> |
166 | 255 | let numbers = expand_numbers numbers in |
167 | 256 | let cases = expand_cases cases in |
168 | 257 | let genders = expand_genders genders in |
258 | + let genders,pt,col = check_genders genders in | |
169 | 259 | let cases,voc = split_voc cases in |
170 | 260 | let nsyn,nsem = noun_type proper lemma "subst" in |
171 | 261 | (if cases = [] then [] else |
172 | - [{empty_cats with lemma=lemma; pos="subst"; pos2="noun"; cat=cat; coerced=coerced; snode=snode; numbers=numbers; cases=cases; genders=genders; persons=["ter"]; nsyn=nsyn; nsem=nsem}]) @ | |
262 | + [{cats with numbers=numbers; cases=cases; genders=genders; persons=["ter"]; nsyn=nsyn; nsem=nsem; pt=pt; col=col}]) @ | |
173 | 263 | (if voc = [] then [] else |
174 | - [{empty_cats with lemma=lemma; pos="subst"; pos2="noun"; cat=cat; coerced=coerced; snode=snode; numbers=numbers; cases=voc; genders=genders; persons=["sec"]; nsyn=nsyn; nsem=nsem}]) | |
175 | - | lemma,"subst",[numbers;cases;genders;_] -> | |
264 | + [{cats with numbers=numbers; cases=voc; genders=genders; persons=["sec"]; nsyn=nsyn; nsem=nsem; pt=pt; col=col}]) | |
265 | + | lemma,"subst",[numbers;cases;genders;col] -> | |
176 | 266 | let numbers = expand_numbers numbers in |
177 | 267 | let cases = expand_cases cases in |
178 | 268 | let genders = expand_genders genders in |
269 | + let genders,_,_ = check_genders genders in | |
179 | 270 | let cases,voc = split_voc cases in |
180 | 271 | let nsyn,nsem = noun_type proper lemma "subst" in |
272 | + let pt,col = expand_col col in | |
181 | 273 | (if cases = [] then [] else |
182 | - [{empty_cats with lemma=lemma; pos="subst"; pos2="noun"; cat=cat; coerced=coerced; snode=snode; numbers=numbers; cases=cases; genders=genders; persons=["ter"]; nsyn=nsyn; nsem=nsem}]) @ | |
274 | + [{cats with numbers=numbers; cases=cases; genders=genders; persons=["ter"]; nsyn=nsyn; nsem=nsem; pt=pt; col=col}]) @ | |
183 | 275 | (if voc = [] then [] else |
184 | - [{empty_cats with lemma=lemma; pos="subst"; pos2="noun"; cat=cat; coerced=coerced; snode=snode; numbers=numbers; cases=voc; genders=genders; persons=["sec"]; nsyn=nsyn; nsem=nsem}]) | |
276 | + [{cats with numbers=numbers; cases=voc; genders=genders; persons=["sec"]; nsyn=nsyn; nsem=nsem; pt=pt; col=col}]) | |
185 | 277 | | lemma,"depr",[numbers;cases;genders] -> |
186 | 278 | let numbers = expand_numbers numbers in |
187 | 279 | let cases = expand_cases cases in |
... | ... | @@ -189,29 +281,29 @@ let clarify_categories proper cat coerced (*snode*) = function |
189 | 281 | let cases,voc = split_voc cases in |
190 | 282 | let nsyn,nsem = noun_type proper lemma "depr" in |
191 | 283 | (if cases = [] then [] else |
192 | - [{empty_cats with lemma=lemma; pos="subst"; pos2="noun"; cat=cat; coerced=coerced; snode=snode; numbers=numbers; cases=cases; genders=genders; persons=["ter"]; nsyn=nsyn; nsem=nsem}]) @ | |
284 | + [{cats with pos="depr"; numbers=numbers; cases=cases; genders=genders; persons=["ter"]; nsyn=nsyn; nsem=nsem; pt="npt"; col=["col";"ncol"]}]) @ | |
193 | 285 | (if voc = [] then [] else |
194 | - [{empty_cats with lemma=lemma; pos="subst"; pos2="noun"; cat=cat; coerced=coerced; snode=snode; numbers=numbers; cases=voc; genders=genders; persons=["sec"]; nsyn=nsyn; nsem=nsem}]) | |
286 | + [{cats with pos="depr"; numbers=numbers; cases=voc; genders=genders; persons=["sec"]; nsyn=nsyn; nsem=nsem; pt="npt"; col=["col";"ncol"]}]) | |
195 | 287 | | lemma,"ppron12",[numbers;cases;genders;persons] -> |
196 | 288 | let numbers = expand_numbers numbers in |
197 | 289 | let cases = expand_cases cases in |
198 | 290 | let genders = expand_genders genders in |
199 | - [{empty_cats with lemma=lemma; pos="ppron12"; pos2="pron"; snode=snode; numbers=numbers; cases=cases; genders=genders; persons=persons}] | |
291 | + [{cats with numbers=numbers; cases=cases; genders=genders; persons=persons}] | |
200 | 292 | | lemma,"ppron12",[numbers;cases;genders;persons;akcs] -> |
201 | 293 | let numbers = expand_numbers numbers in |
202 | 294 | let cases = expand_cases cases in |
203 | 295 | let genders = expand_genders genders in |
204 | - [{empty_cats with lemma=lemma; pos="ppron12"; pos2="pron"; snode=snode; numbers=numbers; cases=cases; genders=genders; persons=persons}] | |
296 | + [{cats with numbers=numbers; cases=cases; genders=genders; persons=persons}] | |
205 | 297 | | lemma,"ppron3",[numbers;cases;genders;persons] -> |
206 | 298 | let numbers = expand_numbers numbers in |
207 | 299 | let cases = expand_cases cases in |
208 | 300 | let genders = expand_genders genders in |
209 | - [{empty_cats with lemma=lemma; pos="ppron3"; pos2="pron"; snode=snode; numbers=numbers; cases=cases; genders=genders; persons=persons; praeps=["praep-npraep"]}] | |
301 | + [{cats with numbers=numbers; cases=cases; genders=genders; persons=persons; praeps=["praep-npraep"]}] | |
210 | 302 | | lemma,"ppron3",[numbers;cases;genders;persons;akcs] -> |
211 | 303 | let numbers = expand_numbers numbers in |
212 | 304 | let cases = expand_cases cases in |
213 | 305 | let genders = expand_genders genders in |
214 | - [{empty_cats with lemma=lemma; pos="ppron3"; pos2="pron"; snode=snode; numbers=numbers; cases=cases; genders=genders; persons=persons; praeps=["praep-npraep"]}] | |
306 | + [{cats with numbers=numbers; cases=cases; genders=genders; persons=persons; praeps=["praep-npraep"]}] | |
215 | 307 | | lemma,"ppron3",[numbers;cases;genders;persons;akcs;praep] -> |
216 | 308 | let numbers = expand_numbers numbers in |
217 | 309 | let cases = expand_cases cases in |
... | ... | @@ -220,215 +312,220 @@ let clarify_categories proper cat coerced (*snode*) = function |
220 | 312 | ["praep";"npraep"] -> ["praep-npraep"] |
221 | 313 | | ["npraep";"praep"] -> ["praep-npraep"] |
222 | 314 | | _ -> praep in |
223 | - [{empty_cats with lemma=lemma; pos="ppron3"; pos2="pron"; snode=snode; numbers=numbers; cases=cases; genders=genders; persons=persons; praeps=praep}] | |
315 | + [{cats with numbers=numbers; cases=cases; genders=genders; persons=persons; praeps=praep}] | |
224 | 316 | | lemma,"siebie",[cases] -> (* FIXME: czy tu określać numbers genders persons? *) |
225 | 317 | let cases = expand_cases cases in |
226 | - [{empty_cats with lemma=lemma; pos="siebie"; pos2="pron"; snode=snode; numbers=all_numbers; cases=cases; genders=all_genders; persons=["ter"]}] | |
318 | + [{cats with numbers=all_numbers; cases=cases; genders=all_genders; persons=["ter"]}] | |
227 | 319 | | lemma,"prep",[cases;woks] -> |
228 | 320 | if StringSet.mem compar_lexemes lemma then |
229 | - [{empty_cats with lemma=lemma; pos="compar"; pos2="prep"}] else | |
321 | + [{cats with pos="x"};{cats with pos="compar"; (*psem=["sem";"nosem"];*) cases=["nom";"gen";"dat";"acc";"inst"]}] else | |
230 | 322 | let cases = expand_cases cases in |
231 | - [{empty_cats with lemma=lemma; pos="prep"; pos2="prep"; snode=snode; cases=cases; psem=["sem";"nosem"]}] | |
323 | + [{cats with pos="x"};{cats with cases=cases; (*psem=["sem";"nosem"]*)}] | |
232 | 324 | | lemma,"prep",[cases] -> |
233 | 325 | if StringSet.mem compar_lexemes lemma then |
234 | - [{empty_cats with lemma=lemma; pos="compar"; pos2="prep"}] else | |
326 | + [{cats with pos="x"};{cats with pos="compar"; (*psem=["sem";"nosem"];*) cases=["nom";"gen";"dat";"acc";"inst"]}] else | |
235 | 327 | let cases = expand_cases cases in |
236 | - [{empty_cats with lemma=lemma; pos="prep"; pos2="prep"; snode=snode; cases=cases; psem=["sem";"nosem"]}] | |
328 | + [{cats with pos="x"};{cats with cases=cases; (*psem=["sem";"nosem"]*)}] | |
329 | + | lemma,"x",[] -> [{cats with pos="x"}] | |
237 | 330 | | lemma,"num",[numbers;cases;genders;acms] -> |
238 | 331 | let numbers = expand_numbers numbers in |
239 | 332 | let cases = expand_cases cases in |
240 | 333 | let genders = expand_genders genders in |
241 | 334 | let nsem = num_nsem lemma in |
242 | - [{empty_cats with lemma=lemma; pos="num"; pos2="num"; snode=snode; numbers=numbers; cases=cases; genders=genders; persons=["ter"]; acms=acms; nsem=nsem}] | |
335 | + [{cats with numbers=numbers; cases=cases; genders=genders; persons=["ter"]; acms=acms; nsem=nsem}] | |
243 | 336 | | lemma,"num",[numbers;cases;genders;acms;_] -> |
244 | 337 | let numbers = expand_numbers numbers in |
245 | 338 | let cases = expand_cases cases in |
246 | 339 | let genders = expand_genders genders in |
247 | 340 | let nsem = num_nsem lemma in |
248 | - [{empty_cats with lemma=lemma; pos="num"; pos2="num"; snode=snode; numbers=numbers; cases=cases; genders=genders; persons=["ter"]; acms=acms; nsem=nsem}] | |
249 | - | lemma,"numcomp",[] -> [{empty_cats with lemma=lemma; pos="numcomp"; pos2="numcomp"; snode=snode}] | |
341 | + [{cats with numbers=numbers; cases=cases; genders=genders; persons=["ter"]; acms=acms; nsem=nsem}] | |
342 | + | lemma,"numcomp",[] -> [cats] | |
250 | 343 | | lemma,"intnum",[] -> |
251 | 344 | let numbers,acms = |
252 | 345 | if lemma = "1" || lemma = "-1" then ["sg"],["congr"] else |
253 | 346 | let s = String.get lemma (String.length lemma - 1) in |
254 | 347 | ["pl"],if s = '2' || s = '3' || s = '4' then ["rec";"congr"] else ["rec"] in |
255 | - [{empty_cats with lemma=lemma; pos="intnum"; pos2="num"; snode=snode; numbers=numbers; cases=all_cases; genders=all_genders; persons=["ter"]; acms=acms; nsem=["count"]}] | |
348 | + [{cats with numbers=numbers; cases=all_cases; genders=all_genders; persons=["ter"]; acms=acms; nsem=["count"]}] | |
256 | 349 | | lemma,"realnum",[] -> |
257 | - [{empty_cats with lemma=lemma; pos="realnum"; pos2="num"; snode=snode; numbers=["sg"]; cases=all_cases; genders=all_genders; persons=["ter"]; acms=["rec"]; nsem=["count"]}] | |
350 | + [{cats with numbers=["sg"]; cases=all_cases; genders=all_genders; persons=["ter"]; acms=["rec"]; nsem=["count"]}] | |
258 | 351 | | lemma,"intnum-interval",[] -> |
259 | - [{empty_cats with lemma=lemma; pos="intnum-interval"; pos2="num"; snode=snode; numbers=["pl"]; cases=all_cases; genders=all_genders; persons=["ter"]; acms=["rec";"congr"]; nsem=["count"]}] | |
352 | + [{cats with numbers=["pl"]; cases=all_cases; genders=all_genders; persons=["ter"]; acms=["rec";"congr"]; nsem=["count"]}] | |
260 | 353 | | lemma,"realnum-interval",[] -> |
261 | - [{empty_cats with lemma=lemma; pos="realnum-interval"; pos2="num"; snode=snode; numbers=["sg"]; cases=all_cases; genders=all_genders; persons=["ter"]; acms=["rec"]; nsem=["count"]}] | |
354 | + [{cats with numbers=["sg"]; cases=all_cases; genders=all_genders; persons=["ter"]; acms=["rec"]; nsem=["count"]}] | |
262 | 355 | | lemma,"symbol",[] -> |
263 | - [{empty_cats with lemma=lemma; pos="symbol"; pos2="noun"; snode=snode; numbers=["sg"]; cases=all_cases; genders=all_genders; persons=["ter"]}] | |
356 | + [{cats with numbers=["sg"]; cases=all_cases; genders=all_genders; persons=["ter"]}] | |
264 | 357 | | lemma,"ordnum",[] -> |
265 | - [{empty_cats with lemma=lemma; pos="ordnum"; pos2="adj"; snode=snode; numbers=all_numbers; cases=all_cases; genders=all_genders; grads=["pos"]}] (* FIXME: czy dać możliwość więcej niż jednego stopnia *) | |
358 | + [{cats with numbers=all_numbers; cases=all_cases; genders=all_genders; grads=["pos"]}] (* FIXME: czy dać możliwość więcej niż jednego stopnia *) | |
266 | 359 | | lemma,"date",[] -> |
267 | 360 | let nsyn,nsem = noun_type proper lemma "date" in |
268 | - [{empty_cats with lemma=lemma; pos="date"; pos2="symbol"; snode=snode; nsyn=nsyn; nsem=nsem}] | |
361 | + [{cats with nsyn=nsyn; nsem=nsem}] | |
269 | 362 | | lemma,"date-interval",[] -> |
270 | 363 | let nsyn,nsem = noun_type proper lemma "date-interval" in |
271 | - [{empty_cats with lemma=lemma; pos="date-interval"; pos2="symbol"; snode=snode; nsyn=nsyn; nsem=nsem}] | |
364 | + [{cats with nsyn=nsyn; nsem=nsem}] | |
272 | 365 | | lemma,"hour-minute",[] -> |
273 | 366 | let nsyn,nsem = noun_type proper lemma "hour-minute" in |
274 | - [{empty_cats with lemma=lemma; pos="hour-minute"; pos2="symbol"; snode=snode; nsyn=nsyn; nsem=nsem}] | |
367 | + [{cats with nsyn=nsyn; nsem=nsem}] | |
275 | 368 | | lemma,"hour",[] -> |
276 | 369 | let nsyn,nsem = noun_type proper lemma "hour" in |
277 | - [{empty_cats with lemma=lemma; pos="hour"; pos2="symbol"; snode=snode; nsyn=nsyn; nsem=nsem}] | |
370 | + [{cats with nsyn=nsyn; nsem=nsem}] | |
278 | 371 | | lemma,"hour-minute-interval",[] -> |
279 | 372 | let nsyn,nsem = noun_type proper lemma "hour-minute-interval" in |
280 | - [{empty_cats with lemma=lemma; pos="hour-minute-interval"; pos2="symbol"; snode=snode; nsyn=nsyn; nsem=nsem}] | |
373 | + [{cats with nsyn=nsyn; nsem=nsem}] | |
281 | 374 | | lemma,"hour-interval",[] -> |
282 | 375 | let nsyn,nsem = noun_type proper lemma "hour-interval" in |
283 | - [{empty_cats with lemma=lemma; pos="hour-interval"; pos2="symbol"; snode=snode; nsyn=nsyn; nsem=nsem}] | |
376 | + [{cats with nsyn=nsyn; nsem=nsem}] | |
284 | 377 | | lemma,"year",[] -> |
285 | 378 | let nsyn,nsem = noun_type proper lemma "year" in |
286 | - [{empty_cats with lemma=lemma; pos="year"; pos2="symbol"; snode=snode; nsyn=nsyn; nsem=nsem}] | |
379 | + [{cats with nsyn=nsyn; nsem=nsem}] | |
287 | 380 | | lemma,"year-interval",[] -> |
288 | 381 | let nsyn,nsem = noun_type proper lemma "year-interval" in |
289 | - [{empty_cats with lemma=lemma; pos="year-interval"; pos2="symbol"; snode=snode; nsyn=nsyn; nsem=nsem}] | |
382 | + [{cats with nsyn=nsyn; nsem=nsem}] | |
290 | 383 | | lemma,"day",[] -> |
291 | 384 | let nsyn,nsem = noun_type proper lemma "day" in |
292 | - [{empty_cats with lemma=lemma; pos="day"; pos2="symbol"; snode=snode; nsyn=nsyn; nsem=nsem}] | |
385 | + [{cats with nsyn=nsyn; nsem=nsem}] | |
293 | 386 | | lemma,"day-interval",[] -> |
294 | 387 | let nsyn,nsem = noun_type proper lemma "day-interval" in |
295 | - [{empty_cats with lemma=lemma; pos="day-interval"; pos2="symbol"; snode=snode; nsyn=nsyn; nsem=nsem}] | |
388 | + [{cats with nsyn=nsyn; nsem=nsem}] | |
296 | 389 | | lemma,"day-month",[] -> |
297 | 390 | let nsyn,nsem = noun_type proper lemma "day-month" in |
298 | - [{empty_cats with lemma=lemma; pos="day-month"; pos2="symbol"; snode=snode; nsyn=nsyn; nsem=nsem}] | |
391 | + [{cats with nsyn=nsyn; nsem=nsem}] | |
299 | 392 | | lemma,"day-month-interval",[] -> |
300 | 393 | let nsyn,nsem = noun_type proper lemma "day-month-interval" in |
301 | - [{empty_cats with lemma=lemma; pos="day-month-interval"; pos2="symbol"; snode=snode; nsyn=nsyn; nsem=nsem}] | |
394 | + [{cats with nsyn=nsyn; nsem=nsem}] | |
302 | 395 | | lemma,"month-interval",[] -> |
303 | 396 | let nsyn,nsem = noun_type proper lemma "month-interval" in |
304 | - [{empty_cats with lemma=lemma; pos="month-interval"; pos2="symbol"; snode=snode; nsyn=nsyn; nsem=nsem}] | |
397 | + [{cats with nsyn=nsyn; nsem=nsem}] | |
398 | + | lemma,"initial",[] -> | |
399 | + let nsyn,nsem = noun_type proper lemma "initial" in | |
400 | + [{cats with nsyn=nsyn; nsem=nsem}] | |
305 | 401 | | lemma,"roman",[] -> |
306 | 402 | let nsyn,nsem = noun_type proper lemma "roman" in |
307 | - [{empty_cats with lemma=lemma; pos="roman-ordnum"; pos2="adj"; snode=snode; numbers=all_numbers; cases=all_cases; genders=all_genders; grads=["pos"]}; | |
308 | - {empty_cats with lemma=lemma; pos="roman"; pos2="symbol"; snode=snode; nsyn=nsyn; nsem=nsem}] | |
403 | + [{cats with pos="roman-ordnum"; numbers=all_numbers; cases=all_cases; genders=all_genders; grads=["pos"]}; | |
404 | + {cats with nsyn=nsyn; nsem=nsem}] | |
309 | 405 | | lemma,"roman-interval",[] -> |
310 | 406 | let nsyn,nsem = noun_type proper lemma "roman-interval" in |
311 | - [{empty_cats with lemma=lemma; pos="roman-interval"; pos2="symbol"; snode=snode; nsyn=nsyn; nsem=nsem}] | |
407 | + [{cats with nsyn=nsyn; nsem=nsem}] | |
312 | 408 | | lemma,"match-result",[] -> |
313 | 409 | let nsyn,nsem = noun_type proper lemma "match-result" in |
314 | - [{empty_cats with lemma=lemma; pos="match-result"; pos2="symbol"; snode=snode; nsyn=nsyn; nsem=nsem}] | |
410 | + [{cats with nsyn=nsyn; nsem=nsem}] | |
315 | 411 | | lemma,"url",[] -> |
316 | 412 | let nsyn,nsem = noun_type proper lemma "url" in |
317 | - [{empty_cats with lemma=lemma; pos="url"; pos2="symbol"; snode=snode; nsyn=nsyn; nsem=nsem}] | |
413 | + [{cats with nsyn=nsyn; nsem=nsem}] | |
318 | 414 | | lemma,"email",[] -> |
319 | 415 | let nsyn,nsem = noun_type proper lemma "email" in |
320 | - [{empty_cats with lemma=lemma; pos="email"; pos2="symbol"; snode=snode; nsyn=nsyn; nsem=nsem}] | |
416 | + [{cats with nsyn=nsyn; nsem=nsem}] | |
321 | 417 | | lemma,"phone-number",[] -> |
322 | 418 | let nsyn,nsem = noun_type proper lemma "phone-number" in |
323 | - [{empty_cats with lemma=lemma; pos="phone-number"; pos2="symbol"; snode=snode; nsyn=nsyn; nsem=nsem}] | |
419 | + [{cats with nsyn=nsyn; nsem=nsem}] | |
324 | 420 | | lemma,"postal-code",[] -> |
325 | 421 | let nsyn,nsem = noun_type proper lemma "postal-code" in |
326 | - [{empty_cats with lemma=lemma; pos="postal-code"; pos2="symbol"; snode=snode; nsyn=nsyn; nsem=nsem}] | |
422 | + [{cats with nsyn=nsyn; nsem=nsem}] | |
327 | 423 | | lemma,"obj-id",[] -> |
328 | 424 | let nsyn,nsem = noun_type proper lemma "obj-id" in |
329 | - [{empty_cats with lemma=lemma; pos="obj-id"; pos2="symbol"; snode=snode; nsyn=nsyn; nsem=nsem}] | |
425 | + [{cats with nsyn=nsyn; nsem=nsem}] | |
330 | 426 | | lemma,"building-number",[] -> |
331 | 427 | let nsyn,nsem = noun_type proper lemma "building-number" in |
332 | - [{empty_cats with lemma=lemma; pos="building-number"; pos2="symbol"; snode=snode; nsyn=nsyn; nsem=nsem}] | |
333 | - | lemma,"fixed",[] -> [{empty_cats with lemma=lemma; pos="fixed"; pos2="fixed"; snode=snode}] | |
428 | + [{cats with nsyn=nsyn; nsem=nsem}] | |
429 | + | lemma,"fixed",[] -> [cats] | |
334 | 430 | | lemma,"adj",[numbers;cases;genders;grads] -> (* FIXME: adjsyn *) |
335 | 431 | let numbers = expand_numbers numbers in |
336 | 432 | let cases = expand_cases cases in |
337 | 433 | let cases = if Xlist.mem cases "nom" then "pred" :: cases else cases in |
338 | 434 | let genders = expand_genders genders in |
339 | - let pos,pos2 = if StringSet.mem adj_pronoun_lexemes lemma then "apron","pron" else "adj","adj" in | |
340 | - [{empty_cats with lemma=lemma; pos=pos; pos2=pos2; cat=cat; coerced=coerced; snode=snode; numbers=numbers; cases=cases; genders=genders; grads=grads}] (* FIXME: czy dać możliwość więcej niż jednego stopnia *) | |
435 | + let pos,pos2 = (*if StringSet.mem adj_pronoun_lexemes lemma then "apron","adj" else*) "adj","adj" in | |
436 | + [{cats with pos=pos; pos2=pos2; numbers=numbers; cases=cases; genders=genders; grads=grads}] (* FIXME: czy dać możliwość więcej niż jednego stopnia *) | |
341 | 437 | | lemma,"adjc",[] -> |
342 | - [{empty_cats with lemma=lemma; pos="adjc"; pos2="adj"; cat=cat; coerced=coerced; snode=snode; numbers=["sg"]; cases=["pred"]; genders=["m1";"m2";"m3"]; grads=["pos"]}] | |
438 | + [{cats with numbers=["sg"]; cases=["pred"]; genders=["m1";"m2";"m3"]; grads=["pos"]}] | |
343 | 439 | | lemma,"adjp",[] -> |
344 | - [{empty_cats with lemma=lemma; pos="adjp"; pos2="adj"; cat=cat; coerced=coerced; snode=snode; numbers=all_numbers; cases=["postp"]; genders=all_genders; grads=["pos"]}] | |
345 | - | lemma,"adja",[] -> [{empty_cats with lemma=lemma; cat=cat; coerced=coerced; snode=snode; pos="adja"; pos2="adja"}] | |
346 | - | lemma,"adv",[grads] -> [{empty_cats with lemma=lemma; cat=cat; coerced=coerced; snode=snode; pos="adv"; pos2="adv"; grads=grads; modes=adv_mode lemma}] | |
347 | - | lemma,"adv",[] -> [{empty_cats with lemma=lemma; cat=cat; coerced=coerced; snode=snode; pos="adv"; pos2="adv"; grads=["pos"]; modes=adv_mode lemma}] | |
440 | + [{cats with numbers=all_numbers; cases=["postp"]; genders=all_genders; grads=["pos"]}] | |
441 | + | lemma,"adja",[] -> [cats] | |
442 | + | lemma,"adv",[grads] -> [{cats with grads=grads; modes=adv_mode lemma}] | |
443 | + | lemma,"adv",[] -> [{cats with grads=["pos"]; modes=adv_mode lemma}] | |
348 | 444 | | lemma,"ger",[numbers;cases;genders;aspects;negations] -> |
349 | 445 | let numbers = expand_numbers numbers in |
350 | 446 | let cases = expand_cases cases in |
351 | 447 | let genders = expand_genders genders in |
352 | - [{empty_cats with lemma=lemma; pos="ger"; pos2="verb"; cat=cat; coerced=coerced; snode=snode; numbers=numbers; cases=cases; genders=genders; persons=["ter"]; aspects=aspects; negations=negations}] (* FIXME: kwestia osoby przy voc *) | |
448 | + [{cats with numbers=numbers; cases=cases; genders=genders; persons=["ter"]; aspects=aspects; negations=negations}] (* FIXME: kwestia osoby przy voc *) | |
353 | 449 | | lemma,"pact",[numbers;cases;genders;aspects;negations] -> |
354 | 450 | let numbers = expand_numbers numbers in |
355 | 451 | let cases = expand_cases cases in |
356 | 452 | let cases = if Xlist.mem cases "nom" then "pred" :: cases else cases in |
357 | 453 | let genders = expand_genders genders in |
358 | - [{empty_cats with lemma=lemma; pos="pact"; pos2="verb"; cat=cat; coerced=coerced; snode=snode; numbers=numbers; cases=cases; genders=genders; aspects=aspects; negations=negations}] | |
454 | + [{cats with numbers=numbers; cases=cases; genders=genders; aspects=aspects; negations=negations}] | |
359 | 455 | | lemma,"ppas",[numbers;cases;genders;aspects;negations] -> |
360 | 456 | let numbers = expand_numbers numbers in |
361 | 457 | let cases = expand_cases cases in |
362 | 458 | let cases = if Xlist.mem cases "nom" then "pred" :: cases else cases in |
363 | 459 | let genders = expand_genders genders in |
364 | - [{empty_cats with lemma=lemma; pos="ppas"; pos2="verb"; cat=cat; coerced=coerced; snode=snode; numbers=numbers; cases=cases; genders=genders; aspects=aspects; negations=negations}] | |
460 | + [{cats with numbers=numbers; cases=cases; genders=genders; aspects=aspects; negations=negations}] | |
365 | 461 | | lemma,"fin",[numbers;persons;aspects] -> (* FIXME: genders bez przymnogich *) |
366 | 462 | let numbers = expand_numbers numbers in |
367 | 463 | let persons2 = Xlist.fold persons [] (fun l -> function "sec" -> l | s -> s :: l) in |
368 | - let cats = {empty_cats with lemma=lemma; pos="fin"; pos2="verb"; cat=cat; coerced=coerced; snode=snode; numbers=numbers; genders=all_genders; persons=persons; negations=["aff"; "neg"]; moods=["indicative"]} in | |
464 | + let cats2 = {cats with numbers=numbers; genders=all_genders; persons=persons; negations=["aff"; "neg"]; moods=["indicative"]} in | |
369 | 465 | (Xlist.map aspects (function |
370 | - "imperf" -> {cats with aspects=["imperf"]; tenses=["pres"]} | |
371 | - | "perf" -> {cats with aspects=["perf"]; tenses=["fut"]} | |
466 | + "imperf" -> {cats2 with aspects=["imperf"]; tenses=["pres"]} | |
467 | + | "perf" -> {cats2 with aspects=["perf"]; tenses=["fut"]} | |
372 | 468 | | _ -> failwith "clarify_categories")) @ |
373 | 469 | (if persons2 = [] then [] else |
374 | - [{empty_cats with lemma=lemma; pos="fin"; pos2="verb"; cat=cat; coerced=coerced; snode=snode; numbers=numbers; genders=all_genders; persons=persons; aspects=aspects; negations=["aff"; "neg"]; moods=["imperative"]; tenses=["fut"]}]) | |
470 | + [{cats with numbers=numbers; genders=all_genders; persons=persons; aspects=aspects; negations=["aff"; "neg"]; moods=["imperative"]; tenses=["fut"]}]) | |
375 | 471 | | lemma,"bedzie",[numbers;persons;aspects] -> |
376 | 472 | let numbers = expand_numbers numbers in |
377 | 473 | let persons2 = Xlist.fold persons [] (fun l -> function "sec" -> l | s -> s :: l) in |
378 | - [{empty_cats with lemma=lemma; pos="bedzie"; pos2="verb"; cat=cat; coerced=coerced; snode=snode; numbers=numbers; genders=all_genders; persons=persons; aspects=aspects; negations=["aff"; "neg"]; moods=["indicative"]; tenses=["fut"]}] @ | |
474 | + [{cats with numbers=numbers; genders=all_genders; persons=persons; aspects=aspects; negations=["aff"; "neg"]; moods=["indicative"]; tenses=["fut"]}] @ | |
379 | 475 | (if persons2 = [] then [] else |
380 | - [{empty_cats with lemma=lemma; pos="bedzie"; pos2="verb"; cat=cat; coerced=coerced; snode=snode; numbers=numbers; genders=all_genders; persons=persons; aspects=aspects; negations=["aff"; "neg"]; moods=["imperative"]; tenses=["fut"]}]) | |
476 | + [{cats with numbers=numbers; genders=all_genders; persons=persons; aspects=aspects; negations=["aff"; "neg"]; moods=["imperative"]; tenses=["fut"]}]) | |
381 | 477 | | lemma,"praet",[numbers;genders;aspects;nagl] -> |
382 | 478 | let numbers = expand_numbers numbers in |
383 | 479 | let genders = expand_genders genders in |
384 | - [{empty_cats with lemma=lemma; pos="praet"; pos2="verb"; cat=cat; coerced=coerced; snode=snode; numbers=numbers; genders=genders; persons=all_persons; aspects=aspects; negations=["aff"; "neg"]; moods=["indicative";"conditional"]; tenses=["past"]}] @ | |
480 | + [{cats with numbers=numbers; genders=genders; persons=all_persons; aspects=aspects; negations=["aff"; "neg"]; moods=["indicative";"conditional"]; tenses=["past"]}] @ | |
385 | 481 | (if Xlist.mem aspects "imperf" then |
386 | - [{empty_cats with lemma=lemma; pos="praet"; pos2="verb"; cat=cat; coerced=coerced; snode=snode; numbers=numbers; genders=genders; persons=all_persons; aspects=["imperf"]; negations=["aff"; "neg"]; moods=["indicative"]; tenses=["fut"]}] | |
482 | + [{cats with numbers=numbers; genders=genders; persons=all_persons; aspects=["imperf"]; negations=["aff"; "neg"]; moods=["indicative"]; tenses=["fut"]}] | |
387 | 483 | else []) |
388 | 484 | | lemma,"praet",[numbers;genders;aspects] -> |
389 | 485 | let numbers = expand_numbers numbers in |
390 | 486 | let genders = expand_genders genders in |
391 | - [{empty_cats with lemma=lemma; pos="praet"; pos2="verb"; cat=cat; coerced=coerced; snode=snode; numbers=numbers; genders=genders; persons=all_persons; aspects=aspects; negations=["aff"; "neg"]; moods=["indicative";"conditional"]; tenses=["past"]}] @ | |
487 | + [{cats with numbers=numbers; genders=genders; persons=all_persons; aspects=aspects; negations=["aff"; "neg"]; moods=["indicative";"conditional"]; tenses=["past"]}] @ | |
392 | 488 | (if Xlist.mem aspects "imperf" then |
393 | - [{empty_cats with lemma=lemma; pos="praet"; pos2="verb"; cat=cat; coerced=coerced; snode=snode; numbers=numbers; genders=genders; persons=all_persons; aspects=["imperf"]; negations=["aff"; "neg"]; moods=["indicative"]; tenses=["fut"]}] | |
489 | + [{cats with numbers=numbers; genders=genders; persons=all_persons; aspects=["imperf"]; negations=["aff"; "neg"]; moods=["indicative"]; tenses=["fut"]}] | |
394 | 490 | else []) |
395 | 491 | | lemma,"winien",[numbers;genders;aspects] -> |
396 | 492 | let numbers = expand_numbers numbers in |
397 | 493 | let genders = expand_genders genders in |
398 | - [{empty_cats with lemma=lemma; pos="winien"; pos2="verb"; cat=cat; coerced=coerced; snode=snode; numbers=numbers; genders=genders; persons=all_persons; aspects=aspects; negations=["aff"; "neg"]; moods=["indicative";"conditional"]; tenses=["pres"]}; | |
399 | - {empty_cats with lemma=lemma; pos="winien"; pos2="verb"; cat=cat; coerced=coerced; snode=snode; numbers=numbers; genders=genders; persons=all_persons; aspects=aspects; negations=["aff"; "neg"]; moods=["indicative"]; tenses=["past"]}] @ | |
494 | + [{cats with numbers=numbers; genders=genders; persons=all_persons; aspects=aspects; negations=["aff"; "neg"]; moods=["indicative";"conditional"]; tenses=["pres"]}; | |
495 | + {cats with numbers=numbers; genders=genders; persons=all_persons; aspects=aspects; negations=["aff"; "neg"]; moods=["indicative"]; tenses=["past"]}] @ | |
400 | 496 | (if Xlist.mem aspects "imperf" then |
401 | - [{empty_cats with lemma=lemma; pos="winien"; pos2="verb"; cat=cat; coerced=coerced; snode=snode; numbers=numbers; genders=genders; persons=all_persons; aspects=["imperf"]; negations=["aff"; "neg"]; moods=["indicative"]; tenses=["fut"]}] | |
497 | + [{cats with numbers=numbers; genders=genders; persons=all_persons; aspects=["imperf"]; negations=["aff"; "neg"]; moods=["indicative"]; tenses=["fut"]}] | |
402 | 498 | else []) |
403 | 499 | | lemma,"impt",[numbers;persons;aspects] -> |
404 | 500 | let numbers = expand_numbers numbers in |
405 | - [{empty_cats with lemma=lemma; pos="impt"; pos2="verb"; cat=cat; coerced=coerced; snode=snode; numbers=numbers; genders=all_genders; persons=persons; aspects=aspects; negations=["aff"; "neg"]; moods=["imperative"]; tenses=["fut"]}] | |
501 | + [{cats with numbers=numbers; genders=all_genders; persons=persons; aspects=aspects; negations=["aff"; "neg"]; moods=["imperative"]; tenses=["fut"]}] | |
406 | 502 | | lemma,"imps",[aspects] -> |
407 | - [{empty_cats with lemma=lemma; pos="imps"; pos2="verb"; cat=cat; coerced=coerced; snode=snode; numbers=all_numbers; genders=all_genders; persons=all_persons; aspects=aspects; negations=["aff"; "neg"]; moods=["indicative"]; tenses=["past"]}] | |
503 | + [{cats with numbers=all_numbers; genders=all_genders; persons=all_persons; aspects=aspects; negations=["aff"; "neg"]; moods=["indicative"]; tenses=["past"]}] | |
408 | 504 | | lemma,"pred",[] -> (* FIXME: czy predykatyw zawsze jest niedokonany? *) |
409 | - [{empty_cats with lemma=lemma; pos="pred"; pos2="verb"; cat=cat; coerced=coerced; snode=snode; numbers=["sg"]; genders=[(*"n2"*)"n"]; persons=["ter"]; aspects=["imperf"]; negations=["aff"; "neg"]; moods=["indicative"]; tenses=["pres";"past";"fut"]}] | |
505 | + [{cats with numbers=["sg"]; genders=[(*"n2"*)"n"]; persons=["ter"]; aspects=["imperf"]; negations=["aff"; "neg"]; moods=["indicative"]; tenses=["pres";"past";"fut"]}] | |
410 | 506 | | lemma,"aglt",[numbers;persons;aspects;wok] -> |
411 | 507 | let numbers = expand_numbers numbers in |
412 | - [{empty_cats with lemma=lemma; pos="aglt"; pos2="verb"; snode=snode; numbers=numbers; persons=persons; aspects=aspects}] | |
413 | - | lemma,"inf",[aspects] -> [{empty_cats with lemma=lemma; pos="inf"; pos2="verb"; cat=cat; coerced=coerced; snode=snode; aspects=aspects; negations=["aff"; "neg"]}] | |
414 | - | lemma,"pcon",[aspects] -> [{empty_cats with lemma=lemma; pos="pcon"; pos2="verb"; cat=cat; coerced=coerced; snode=snode; aspects=aspects; negations=["aff"; "neg"]}] | |
415 | - | lemma,"pant",[aspects] -> [{empty_cats with lemma=lemma; pos="pant"; pos2="verb"; cat=cat; coerced=coerced; snode=snode; aspects=aspects; negations=["aff"; "neg"]}] | |
508 | + [{cats with numbers=numbers; persons=persons; aspects=aspects}] | |
509 | + | lemma,"inf",[aspects] -> [{cats with aspects=aspects; negations=["aff"; "neg"]}] | |
510 | + | lemma,"pcon",[aspects] -> [{cats with aspects=aspects; negations=["aff"; "neg"]}] | |
511 | + | lemma,"pant",[aspects] -> [{cats with aspects=aspects; negations=["aff"; "neg"]}] | |
512 | + | lemma,"pacta",[] -> [cats] | |
416 | 513 | | lemma,"qub",[] -> |
417 | - if StringSet.mem part_set lemma then [{empty_cats with lemma=lemma; pos="part"; pos2="qub"; snode=snode}] | |
418 | - else [{empty_cats with lemma=lemma; pos="qub"; pos2="qub"; cat=cat; snode=snode}] | |
419 | - | lemma,"comp",[] -> [{empty_cats with lemma=lemma; pos="comp"; pos2="comp"; snode=snode}] | |
420 | - | lemma,"conj",[] -> [{empty_cats with lemma=lemma; pos="conj"; pos2="conj"; snode=snode}] | |
421 | - | lemma,"interj",[] -> [{empty_cats with lemma=lemma; pos="interj"; pos2="interj"; cat=cat; coerced=coerced; snode=snode}] | |
422 | - | lemma,"sinterj",[] -> [{empty_cats with lemma=lemma; pos="sinterj"; pos2="sinterj"; (*cat=cat; coerced=coerced;*) snode=snode}] | |
423 | - | lemma,"burk",[] -> [{empty_cats with lemma=lemma; pos="burk"; pos2="burk"; snode=snode}] | |
424 | - | ",","interp",[] -> [{empty_cats with lemma=","; pos="conj"; pos2="conj"; snode=snode}] | |
425 | - | lemma,"interp",[] -> [{empty_cats with lemma=lemma; pos="interp"; pos2="interp"; snode=snode}] | |
514 | + if StringSet.mem part_set lemma then [{cats with pos="part"}] | |
515 | + else [cats] | |
516 | + | lemma,"comp",[] -> [cats] | |
517 | + | lemma,"conj",[] -> [cats] | |
518 | + | lemma,"interj",[] -> [cats] | |
519 | + | lemma,"sinterj",[] -> [cats] | |
520 | + | lemma,"burk",[] -> [cats] | |
521 | + | ",","interp",[] -> [{cats with pos="conj"}] | |
522 | + | lemma,"interp",[] -> [cats] | |
426 | 523 | | lemma,"unk",[] -> |
427 | - [{empty_cats with lemma=lemma; pos="unk"; pos2="noun"; snode=snode; numbers=all_numbers; cases=all_cases; genders=all_genders; persons=["ter"]}] | |
524 | + [{cats with numbers=all_numbers; cases=all_cases; genders=all_genders; persons=["ter"]}] | |
428 | 525 | | lemma,"xxx",[] -> |
429 | - [{empty_cats with lemma=lemma; pos="xxx"; pos2="noun"; snode=snode; numbers=all_numbers; cases=all_cases; genders=all_genders; persons=["ter"]}] | |
430 | - | lemma,"html-tag",[] -> [{empty_cats with lemma=lemma; pos="html-tag"; pos2="html-tag"; snode=snode}] | |
431 | - | lemma,"list-item",[] -> [{empty_cats with lemma=lemma; pos="list-item"; pos2="list-item"; snode=snode}] | |
526 | + [{cats with numbers=all_numbers; cases=all_cases; genders=all_genders; persons=["ter"]}] | |
527 | + | lemma,"html-tag",[] -> [cats] | |
528 | + | lemma,"list-item",[] -> [cats] | |
432 | 529 | | lemma,c,l -> failwith ("clarify_categories: " ^ lemma ^ ":" ^ c ^ ":" ^ (String.concat ":" (Xlist.map l (String.concat ".")))) |
433 | 530 | |
434 | 531 | (* FIXME: przenieść gdzieś indziej *) |
... | ... | @@ -440,9 +537,9 @@ let clarify_categories proper cat coerced (*snode*) = function |
440 | 537 | | _ -> [] *) |
441 | 538 | |
442 | 539 | let selector_names = StringSet.of_list [ |
443 | - "lemma";"pos";"pos2";"cat";"coerced";"role";"irole";"prole";"nrole";"node";"inode";"pnode";"nnode";"number";"case";"gender";"person";"grad"; | |
444 | - "praep";"acm";"aspect";"negation";"mood";"tense";"nsyn";"nsem";"ctype";"mode";"psem"; | |
445 | - "icat";"inumber";"igender";"iperson";"nperson";"ncat";"plemma"; | |
540 | + "lemma";"pos";"pos2";"cat";"coerced";"role";"irole";"prole";"nrole";"node";"inode";"pnode";"nnode";"phrase";"number";"case";"gender";"person";"grad"; | |
541 | + "praep";"acm";"aspect";"negation";"mood";"tense";"nsyn";"nsem";"ctype";"mode";(*"psem";*)"pt";"col"; | |
542 | + "icat";"inumber";"igender";"iperson";"nperson";"ncat";"plemma";"pcat"; | |
446 | 543 | "unumber";"ucase";"ugender";"uperson";"amode"] |
447 | 544 | |
448 | 545 | |
... | ... | @@ -462,6 +559,7 @@ let string_of_selector = function |
462 | 559 | | Inode -> "inode" |
463 | 560 | | Pnode -> "pnode" |
464 | 561 | | Nnode -> "nnode" |
562 | + | Phrase -> "phrase" | |
465 | 563 | | Number -> "number" |
466 | 564 | | Case -> "case" |
467 | 565 | | Gender -> "gender" |
... | ... | @@ -475,9 +573,11 @@ let string_of_selector = function |
475 | 573 | | Tense -> "tense" |
476 | 574 | | Nsyn -> "nsyn" |
477 | 575 | | Nsem -> "nsem" |
576 | + | Pt -> "pt" | |
577 | + | Col -> "col" | |
478 | 578 | | Ctype -> "ctype" |
479 | 579 | | Mode -> "mode" |
480 | - | Psem -> "psem" | |
580 | + (* | Psem -> "psem" *) | |
481 | 581 | | Icat -> "icat" |
482 | 582 | | Inumber -> "inumber" |
483 | 583 | | Igender -> "igender" |
... | ... | @@ -485,6 +585,7 @@ let string_of_selector = function |
485 | 585 | | Nperson -> "nperson" |
486 | 586 | | Ncat -> "ncat" |
487 | 587 | | Plemma -> "plemma" |
588 | + | Pcat -> "pcat" | |
488 | 589 | | Unumber -> "unumber" |
489 | 590 | | Ucase -> "ucase" |
490 | 591 | | Ugender -> "ugender" |
... | ... | @@ -512,6 +613,7 @@ let selector_of_string = function |
512 | 613 | | "inode" -> Inode |
513 | 614 | | "pnode" -> Pnode |
514 | 615 | | "nnode" -> Nnode |
616 | + | "phrase" -> Phrase | |
515 | 617 | | "number" -> Number |
516 | 618 | | "case" -> Case |
517 | 619 | | "gender" -> Gender |
... | ... | @@ -525,9 +627,11 @@ let selector_of_string = function |
525 | 627 | | "tense" -> Tense |
526 | 628 | | "nsyn" -> Nsyn |
527 | 629 | | "nsem" -> Nsem |
630 | + | "pt" -> Pt | |
631 | + | "col" -> Col | |
528 | 632 | | "ctype" -> Ctype |
529 | 633 | | "mode" -> Mode |
530 | - | "psem" -> Psem | |
634 | + (* | "psem" -> Psem *) | |
531 | 635 | | "icat" -> Icat |
532 | 636 | | "inumber" -> Inumber |
533 | 637 | | "igender" -> Igender |
... | ... | @@ -535,6 +639,7 @@ let selector_of_string = function |
535 | 639 | | "nperson" -> Nperson |
536 | 640 | | "ncat" -> Ncat |
537 | 641 | | "plemma" -> Plemma |
642 | + | "pcat" -> Pcat | |
538 | 643 | | "unumber" -> Unumber |
539 | 644 | | "ucase" -> Ucase |
540 | 645 | | "ugender" -> Ugender |
... | ... | @@ -550,6 +655,7 @@ let match_selector cats = function |
550 | 655 | | Coerced -> cats.coerced |
551 | 656 | | Role -> cats.roles |
552 | 657 | | SNode -> cats.snode |
658 | + | Phrase -> cats.phrase | |
553 | 659 | | Number -> cats.numbers |
554 | 660 | | Case -> cats.cases |
555 | 661 | | Gender -> cats.genders |
... | ... | @@ -564,7 +670,9 @@ let match_selector cats = function |
564 | 670 | | Nsyn -> cats.nsyn |
565 | 671 | | Nsem -> cats.nsem |
566 | 672 | | Mode -> cats.modes |
567 | - | Psem -> cats.psem | |
673 | + (* | Psem -> cats.psem *) | |
674 | + | Pt -> [cats.pt] | |
675 | + | Col -> cats.col | |
568 | 676 | | c -> failwith ("match_selector: " ^ string_of_selector c) |
569 | 677 | |
570 | 678 | let set_selector cats vals = function |
... | ... | @@ -582,13 +690,16 @@ let set_selector cats vals = function |
582 | 690 | | Nsyn -> {cats with nsyn=vals} |
583 | 691 | | Nsem -> {cats with nsem=vals} |
584 | 692 | | Mode -> {cats with modes=vals} |
585 | - | Psem -> {cats with psem=vals} | |
693 | + (* | Psem -> {cats with psem=vals} *) | |
694 | + | Pt -> (match vals with [v] -> {cats with pt=v} | _ -> failwith "set_selector: Pt") | |
695 | + | Col -> {cats with col=vals} | |
586 | 696 | | Lemma -> (match vals with [v] -> {cats with lemma=v} | _ -> failwith "set_selector: Lemma") |
587 | 697 | | Pos -> (match vals with [v] -> {cats with pos=v} | _ -> failwith "set_selector: Pos") |
588 | 698 | | Cat -> (match vals with [v] -> {cats with cat=v} | _ -> failwith "set_selector: Cat") |
589 | 699 | | Coerced -> {cats with coerced=vals} |
590 | 700 | | Role -> {cats with roles=vals} |
591 | 701 | | SNode -> {cats with snode=vals} |
702 | + | Phrase -> {cats with phrase=vals} | |
592 | 703 | | c -> failwith ("set_selector: " ^ string_of_selector c) |
593 | 704 | |
594 | 705 | let rec apply_selectors cats = function |
... | ... | @@ -603,77 +714,80 @@ let rec apply_selectors cats = function |
603 | 714 | apply_selectors (set_selector cats (StringSet.to_list vals) sel) l |
604 | 715 | |
605 | 716 | let pos_categories = Xlist.fold [ |
606 | - "subst",[Lemma;Cat;Coerced;Role;SNode;Number;Case;Gender;Person;Nsyn;Nsem;]; | |
607 | - "depr",[Lemma;Cat;Coerced;Role;SNode;Number;Case;Gender;Person;Nsyn;Nsem;]; | |
608 | - "ppron12",[Lemma;SNode;Number;Case;Gender;Person;]; | |
609 | - "ppron3",[Lemma;SNode;Number;Case;Gender;Person;Praep;]; | |
610 | - "siebie",[Lemma;SNode;Number;Case;Gender;Person;]; | |
611 | - "prep",[Lemma;Cat;Coerced;Role;SNode;Psem;Case;]; | |
612 | - "compar",[Lemma;Cat;Coerced;Role;SNode;Case;]; | |
613 | - "num",[Lemma;SNode;Number;Case;Gender;Person;Acm;Nsem;]; | |
614 | - "numcomp",[Lemma;SNode]; | |
615 | - "intnum",[Lemma;SNode;Number;Case;Gender;Person;Acm;Nsem;]; | |
616 | - "realnum",[Lemma;SNode;Number;Case;Gender;Person;Acm;Nsem;]; | |
617 | - "intnum-interval",[Lemma;SNode;Number;Case;Gender;Person;Acm;Nsem;]; | |
618 | - "realnum-interval",[Lemma;SNode;Number;Case;Gender;Person;Acm;Nsem;]; | |
619 | - "symbol",[Lemma;SNode;Number;Case;Gender;Person;]; | |
620 | - "ordnum",[Lemma;SNode;Number;Case;Gender;Grad;]; | |
621 | - "date",[Lemma;SNode;Nsyn;Nsem;]; | |
622 | - "date-interval",[Lemma;SNode;Nsyn;Nsem;]; | |
623 | - "hour-minute",[Lemma;SNode;Nsyn;Nsem;]; | |
624 | - "hour",[Lemma;SNode;Nsyn;Nsem;]; | |
625 | - "hour-minute-interval",[Lemma;SNode;Nsyn;Nsem;]; | |
626 | - "hour-interval",[Lemma;SNode;Nsyn;Nsem;]; | |
627 | - "year",[Lemma;SNode;Nsyn;Nsem;]; | |
628 | - "year-interval",[Lemma;SNode;Nsyn;Nsem;]; | |
629 | - "day",[Lemma;SNode;Nsyn;Nsem;]; | |
630 | - "day-interval",[Lemma;SNode;Nsyn;Nsem;]; | |
631 | - "day-month",[Lemma;SNode;Nsyn;Nsem;]; | |
632 | - "day-month-interval",[Lemma;SNode;Nsyn;Nsem;]; | |
633 | - "month-interval",[Lemma;SNode;Nsyn;Nsem;]; | |
634 | - "roman-ordnum",[Lemma;SNode;Number;Case;Gender;Grad;]; | |
635 | - "roman",[Lemma;SNode;Nsyn;Nsem;]; | |
636 | - "roman-interval",[Lemma;SNode;Nsyn;Nsem;]; | |
637 | - "match-result",[Lemma;SNode;Nsyn;Nsem;]; | |
638 | - "url",[Lemma;SNode;Nsyn;Nsem;]; | |
639 | - "email",[Lemma;SNode;Nsyn;Nsem;]; | |
640 | - "phone-number",[Lemma;SNode;Nsyn;Nsem;]; | |
641 | - "postal-code",[Lemma;SNode;Nsyn;Nsem;]; | |
642 | - "obj-id",[Lemma;SNode;Nsyn;Nsem;]; | |
643 | - "building-number",[Lemma;SNode;Nsyn;Nsem;]; | |
644 | - "fixed",[Lemma;SNode;]; | |
645 | - "adj",[Lemma;Cat;Coerced;Role;SNode;Number;Case;Gender;Grad;]; | |
646 | - "adjc",[Lemma;Cat;Coerced;Role;SNode;Number;Case;Gender;Grad;]; | |
647 | - "adjp",[Lemma;Cat;Coerced;Role;SNode;Number;Case;Gender;Grad;]; | |
648 | - "apron",[Lemma;Cat;Role;SNode;Number;Case;Gender;Grad;]; | |
649 | - "adja",[Lemma;Cat;Coerced;Role;SNode;]; | |
650 | - "adv",[Lemma;Cat;Coerced;Role;SNode;Grad;Mode];(* ctype *) | |
651 | - "ger",[Lemma;(*NewLemma;*)Cat;Coerced;Role;SNode;Number;Case;Gender;Person;Aspect;Negation;]; | |
652 | - "pact",[Lemma;(*NewLemma;*)Cat;Coerced;Role;SNode;Number;Case;Gender;Aspect;Negation;]; | |
653 | - "ppas",[Lemma;(*NewLemma;*)Cat;Coerced;Role;SNode;Number;Case;Gender;Aspect;Negation;]; | |
654 | - "fin",[Lemma;(*NewLemma;*)Cat;Coerced;Role;SNode;Number;Gender;Person;Aspect;Negation;Mood;Tense;]; | |
655 | - "bedzie",[Lemma;(*NewLemma;*)Cat;Coerced;Role;SNode;Number;Gender;Person;Aspect;Negation;Mood;Tense;]; | |
656 | - "praet",[Lemma;(*NewLemma;*)Cat;Coerced;Role;SNode;Number;Gender;Person;Aspect;Negation;Mood;Tense;]; | |
657 | - "winien",[Lemma;(*NewLemma;*)Cat;Coerced;Role;SNode;Number;Gender;Person;Aspect;Negation;Mood;Tense;]; | |
658 | - "impt",[Lemma;(*NewLemma;*)Cat;Coerced;Role;SNode;Number;Gender;Person;Aspect;Negation;Mood;Tense;]; | |
659 | - "imps",[Lemma;(*NewLemma;*)Cat;Coerced;Role;SNode;Number;Gender;Person;Aspect;Negation;Mood;Tense;]; | |
660 | - "pred",[Lemma;(*NewLemma;*)Cat;Coerced;Role;SNode;Number;Gender;Person;Aspect;Negation;Mood;Tense;]; | |
661 | - "aglt",[Lemma;SNode;Number;Person;Aspect;]; | |
662 | - "inf",[Lemma;(*NewLemma;*)Cat;Coerced;Role;SNode;Aspect;Negation;]; | |
663 | - "pcon",[Lemma;(*NewLemma;*)Cat;Coerced;Role;SNode;Aspect;Negation;]; | |
664 | - "pant",[Lemma;(*NewLemma;*)Cat;Coerced;Role;SNode;Aspect;Negation;]; | |
665 | - "qub",[Lemma;Cat;Role;SNode;]; | |
666 | - "part",[Lemma;SNode]; | |
667 | - "comp",[Lemma;SNode;];(* ctype *) | |
668 | - "conj",[Lemma;SNode;];(* ctype *) | |
669 | - "interj",[Lemma;Cat;Coerced;Role;SNode;]; | |
670 | - "sinterj",[Lemma;Cat;Coerced;Role;SNode;]; | |
671 | - "burk",[Lemma;SNode;]; | |
672 | - "interp",[Lemma;SNode;]; | |
673 | - "unk",[Lemma;SNode;Number;Case;Gender;Person;]; | |
674 | - "xxx",[Lemma;SNode;Number;Case;Gender;Person;]; | |
675 | - "html-tag",[Lemma;SNode;]; | |
676 | - "list-item",[Lemma;SNode;]; | |
717 | + "subst", [Lemma;Cat;Coerced;Role;SNode;Phrase;Number;Case;Gender;Person;Nsyn;Nsem;Pt;Col;]; | |
718 | + "depr", [Lemma;Cat;Coerced;Role;SNode;Phrase;Number;Case;Gender;Person;Nsyn;Nsem;Pt;Col;]; | |
719 | + "ppron12", [Lemma;Cat;Role;SNode;Phrase;Number;Case;Gender;Person;]; | |
720 | + "ppron3", [Lemma;Cat;Role;SNode;Phrase;Number;Case;Gender;Person;Praep;]; | |
721 | + "siebie", [Lemma;Cat;Role;SNode;Phrase;Number;Case;Gender;Person;]; | |
722 | + "prep", [Lemma;Cat;Coerced;Role;SNode;Phrase;(*Psem;*)Case;]; | |
723 | + "compar", [Lemma;Cat;Coerced;Role;SNode;Phrase;(*Psem;*)Case;]; | |
724 | + "x", [Lemma;Cat;Coerced;Role;SNode;Phrase;]; | |
725 | + "num", [Lemma;Cat;Role;SNode;Phrase;Number;Case;Gender;Person;Acm;Nsem;]; | |
726 | + "numcomp", [Lemma;Cat;Role;SNode;Phrase]; | |
727 | + "intnum", [Lemma;Cat;Role;SNode;Phrase;Number;Case;Gender;Person;Acm;Nsem;]; | |
728 | + "realnum", [Lemma;Cat;Role;SNode;Phrase;Number;Case;Gender;Person;Acm;Nsem;]; | |
729 | + "intnum-interval", [Lemma;Cat;Role;SNode;Phrase;Number;Case;Gender;Person;Acm;Nsem;]; | |
730 | + "realnum-interval", [Lemma;Cat;Role;SNode;Phrase;Number;Case;Gender;Person;Acm;Nsem;]; | |
731 | + "symbol", [Lemma;Cat;Coerced;Role;SNode;Phrase;Number;Case;Gender;Person;]; | |
732 | + "ordnum", [Lemma;Cat;Coerced;Role;SNode;Phrase;Number;Case;Gender;Grad;]; | |
733 | + "date", [Lemma;Cat;Coerced;Role;SNode;Phrase;Nsyn;Nsem;]; | |
734 | + "date-interval", [Lemma;Cat;Coerced;Role;SNode;Phrase;Nsyn;Nsem;]; | |
735 | + "hour-minute", [Lemma;Cat;Coerced;Role;SNode;Phrase;Nsyn;Nsem;]; | |
736 | + "hour", [Lemma;Cat;Coerced;Role;SNode;Phrase;Nsyn;Nsem;]; | |
737 | + "hour-minute-interval",[Lemma;Cat;Coerced;Role;SNode;Phrase;Nsyn;Nsem;]; | |
738 | + "hour-interval", [Lemma;Cat;Coerced;Role;SNode;Phrase;Nsyn;Nsem;]; | |
739 | + "year", [Lemma;Cat;Coerced;Role;SNode;Phrase;Nsyn;Nsem;]; | |
740 | + "year-interval", [Lemma;Cat;Coerced;Role;SNode;Phrase;Nsyn;Nsem;]; | |
741 | + "day", [Lemma;Cat;Coerced;Role;SNode;Phrase;Nsyn;Nsem;]; | |
742 | + "day-interval", [Lemma;Cat;Coerced;Role;SNode;Phrase;Nsyn;Nsem;]; | |
743 | + "day-month", [Lemma;Cat;Coerced;Role;SNode;Phrase;Nsyn;Nsem;]; | |
744 | + "day-month-interval",[Lemma;Cat;Coerced;Role;SNode;Phrase;Nsyn;Nsem;]; | |
745 | + "month-interval", [Lemma;Cat;Coerced;Role;SNode;Phrase;Nsyn;Nsem;]; | |
746 | + "initial", [Lemma;Cat;Coerced;Role;SNode;Phrase;Nsyn;Nsem;]; | |
747 | + "roman-ordnum", [Lemma;Cat;Role;SNode;Phrase;Number;Case;Gender;Grad;]; | |
748 | + "roman", [Lemma;Cat;Role;SNode;Phrase;Nsyn;Nsem;]; | |
749 | + "roman-interval", [Lemma;Cat;Role;SNode;Phrase;Nsyn;Nsem;]; | |
750 | + "match-result", [Lemma;Cat;Coerced;Role;SNode;Phrase;Nsyn;Nsem;]; | |
751 | + "url", [Lemma;Cat;Coerced;Role;SNode;Phrase;Nsyn;Nsem;]; | |
752 | + "email", [Lemma;Cat;Coerced;Role;SNode;Phrase;Nsyn;Nsem;]; | |
753 | + "phone-number", [Lemma;Cat;Coerced;Role;SNode;Phrase;Nsyn;Nsem;]; | |
754 | + "postal-code", [Lemma;Cat;Coerced;Role;SNode;Phrase;Nsyn;Nsem;]; | |
755 | + "obj-id", [Lemma;Cat;Coerced;Role;SNode;Phrase;Nsyn;Nsem;]; | |
756 | + "building-number", [Lemma;Cat;Coerced;Role;SNode;Phrase;Nsyn;Nsem;]; | |
757 | + "fixed", [Lemma;Cat;Coerced;Role;SNode;Phrase;]; | |
758 | + "adj", [Lemma;Cat;Coerced;Role;SNode;Phrase;Number;Case;Gender;Grad;]; | |
759 | + "adjc", [Lemma;Cat;Coerced;Role;SNode;Phrase;Number;Case;Gender;Grad;]; | |
760 | + "adjp", [Lemma;Cat;Coerced;Role;SNode;Phrase;Number;Case;Gender;Grad;]; | |
761 | + "apron", [Lemma;Cat;Role;SNode;Phrase;Number;Case;Gender;Grad;]; | |
762 | + "adja", [Lemma;Cat;Coerced;Role;SNode;Phrase;]; | |
763 | + "adv", [Lemma;Cat;Coerced;Role;SNode;Phrase;Grad;Mode];(* ctype *) | |
764 | + "ger", [Lemma;(*NewLemma;*)Cat;Coerced;Role;SNode;Phrase;Number;Case;Gender;Person;Aspect;Negation;]; | |
765 | + "pact", [Lemma;(*NewLemma;*)Cat;Coerced;Role;SNode;Phrase;Number;Case;Gender;Aspect;Negation;]; | |
766 | + "ppas", [Lemma;(*NewLemma;*)Cat;Coerced;Role;SNode;Phrase;Number;Case;Gender;Aspect;Negation;]; | |
767 | + "fin", [Lemma;(*NewLemma;*)Cat;Coerced;Role;SNode;Phrase;Number;Gender;Person;Aspect;Negation;Mood;Tense;]; | |
768 | + "bedzie", [Lemma;(*NewLemma;*)Cat;Coerced;Role;SNode;Phrase;Number;Gender;Person;Aspect;Negation;Mood;Tense;]; | |
769 | + "praet", [Lemma;(*NewLemma;*)Cat;Coerced;Role;SNode;Phrase;Number;Gender;Person;Aspect;Negation;Mood;Tense;]; | |
770 | + "winien", [Lemma;(*NewLemma;*)Cat;Coerced;Role;SNode;Phrase;Number;Gender;Person;Aspect;Negation;Mood;Tense;]; | |
771 | + "impt", [Lemma;(*NewLemma;*)Cat;Coerced;Role;SNode;Phrase;Number;Gender;Person;Aspect;Negation;Mood;Tense;]; | |
772 | + "imps", [Lemma;(*NewLemma;*)Cat;Coerced;Role;SNode;Phrase;Number;Gender;Person;Aspect;Negation;Mood;Tense;]; | |
773 | + "pred", [Lemma;(*NewLemma;*)Cat;Coerced;Role;SNode;Phrase;Number;Gender;Person;Aspect;Negation;Mood;Tense;]; | |
774 | + "inf", [Lemma;(*NewLemma;*)Cat;Coerced;Role;SNode;Phrase;Aspect;Negation;]; | |
775 | + "pcon", [Lemma;(*NewLemma;*)Cat;Coerced;Role;SNode;Phrase;Aspect;Negation;]; | |
776 | + "pant", [Lemma;(*NewLemma;*)Cat;Coerced;Role;SNode;Phrase;Aspect;Negation;]; | |
777 | + "pacta", [Lemma;(*NewLemma;*)Cat;Coerced;Role;SNode;Phrase;]; | |
778 | + "aglt", [Lemma;SNode;Phrase;Number;Person;Aspect;]; | |
779 | + "qub", [Lemma;Cat;Role;SNode;Phrase;]; | |
780 | + "part", [Lemma;Cat;Role;SNode;Phrase]; | |
781 | + "comp", [Lemma;Cat;Role;SNode;Phrase;];(* ctype *) | |
782 | + "conj", [Lemma;SNode;Phrase;];(* ctype *) | |
783 | + "interj", [Lemma;Cat;Coerced;Role;SNode;Phrase;]; | |
784 | + "sinterj",[Lemma;Cat;Coerced;Role;SNode;Phrase;]; | |
785 | + "burk", [Lemma;SNode;Phrase;]; | |
786 | + "interp", [Lemma;SNode;Phrase;]; | |
787 | + "unk", [Lemma;Cat;Role;SNode;Phrase;Number;Case;Gender;Person;]; | |
788 | + "xxx", [Lemma;Cat;Role;SNode;Phrase;Number;Case;Gender;Person;]; | |
789 | + "html-tag",[Lemma;SNode;Phrase;]; | |
790 | + "list-item",[Lemma;SNode;Phrase;]; | |
677 | 791 | ] StringMap.empty (fun map (k,l) -> StringMap.add map k l) |
678 | 792 | |
679 | 793 | let string_of_cats cats = |
... | ... |
LCGlexicon/resources/lexicon-pl.dic
1 | 1 | @PHRASE_NAMES |
2 | - lex infp np prepnp adjp ip cp ncp advp padvp | |
3 | - adja prepadjp comprepnp comparp measure num aglt aux-fut | |
4 | - aux-past aux-imp qub interj hyphen int | |
2 | + infp np prepnp adjp ip cp ncp prepncp advp padvp colonp mp intp conj-np npa adja2 | |
3 | + adja prepadjp compar measure num aglt aux-fut | |
4 | + aux-past aux-imp qub interj sinterj hyphen | |
5 | 5 | rparen rparen2 rquot rquot2 rquot3 inclusion |
6 | 6 | day-interval day-lex day-month-interval date-interval |
7 | - month-lex year-lex month-interval year-interval roman roman-interval | |
7 | + month-lex month-interval year-interval roman roman-interval | |
8 | 8 | hour-minute-interval hour-interval obj-id match-result |
9 | - url email day-month day year date hour hour-minute | |
10 | - się nie by s <root> <conll_root> or or2 <colon> <speaker> <speaker-end> <squery> | |
11 | - | |
12 | - <subst> <depr> <ppron12> <ppron3> <siebie> <prep> <num> <intnum> | |
9 | + url email day-month day year date hour hour-minute lex | |
10 | + się nie roku to by s <root> <conll_root> or or2 <colon> <speaker> <speaker-end> <squery> <sentence> <paragraph> | |
11 | + <subst> <depr> <ppron12> <ppron3> <siebie> <prep> <num> <numcomp> <intnum> | |
13 | 12 | <realnum> <intnum-interval> <realnum-interval> <symbol> <ordnum> |
14 | 13 | <date> <date-interval> <hour-minute> <hour> <hour-minute-interval> |
15 | 14 | <hour-interval> <year> <year-interval> <day> <day-interval> <day-month> |
16 | 15 | <day-month-interval> <month-interval> <roman> <roman-interval> <roman-ordnum> |
17 | - <match-result> <url> <email> <obj-id> <adj> <apron> <adjc> <adjp> <adja> | |
18 | - <adv> <ger> <pact> <ppas> <fin> <bedzie> <praet> <winien> <impt> | |
19 | - <imps> <pred> <aglt> <inf> <pcon> <pant> <qub> <comp> <compar> <conj> <interj> | |
20 | - <sinterj> <burk> <interp> <part> <unk> <building-number> | |
16 | + <match-result> <url> <email> <phone-number> <postal-code> <obj-id> <list-item> <fixed> <adj> <apron> <adjc> <adjp> <adja> | |
17 | + <adv> <ger> <pact> <ppas> <fin> <bedzie> <praet> <winien> <impt> <initial> | |
18 | + <imps> <pred> <aglt> <inf> <pcon> <pant> <qub> <comp> <compar> <conj> <interj> <html-tag> | |
19 | + <sinterj> <burk> <interp> <part> <unk> <building-number> jak czy za do od o w na z u dla przeciwko location time link miesiąc pod niż w_celu | |
20 | + title title-end token inclusion inclusion-end comparp jako quot-end | |
21 | + Time GenericDescription | |
22 | + Location Street StreetName Town TownName | |
23 | + Payment Person Profession ProfessionParam | |
24 | + Division OrganizationName OrganizationType OrganizationTypeParam | |
25 | + Service ServiceParam SericeEffect | |
26 | + Instance Issue Quarter Price Name Confirmation Email Telephone PostalCode | |
27 | + HouseNumber Geolocus Measure Rating OpAdNum Y Animal State Interrogative | |
28 | + Action Attitude PriceDescription RateDescription ServiceParamDescription | |
29 | + null Apoz PHas CORE Has Attr Compar PApoz Merge Count Thme Manr Lemma Arg Time | |
30 | + Mod | |
31 | + | |
21 | 32 | |
22 | 33 | @WEIGHTS |
23 | 34 | symbol_weight=1 |
24 | -measure_weight=0.5 | |
35 | +measure_weight=1 | |
25 | 36 | |
26 | 37 | @LEXICON |
27 | 38 | |
28 | -# symbole występujące w tekście - daty itp. i słowa określające ich typy | |
29 | -lemma=dzień,pos=subst,number=sg,case=gen: day-lex/(date+day+day-month): symbol_weight; | |
30 | -lemma=dzień,pos=subst,number=sg: np*number*case*gender*person/(date+day+day-month): symbol_weight; | |
31 | -lemma=dzień,pos=subst,number=pl: np*number*case*gender*person/(date-interval+day-interval+day-month-interval): symbol_weight; | |
32 | -#pos=date: date{schema}: symbol_weight; | |
33 | -pos=date: date/(1+year-lex): symbol_weight; | |
34 | -pos=date-interval: date-interval: symbol_weight; | |
35 | -pos=day: day/month-lex: symbol_weight; | |
36 | -pos=day-interval: day-interval/month-lex: symbol_weight; | |
37 | -#pos=day-month: day-month{schema}: symbol_weight; | |
38 | -pos=day-month: day-month/(1+year-lex): symbol_weight; | |
39 | -pos=day-month-interval: day-month-interval: symbol_weight; | |
40 | - | |
41 | -lemma=rok,pos=subst,number=sg,case=gen: year-lex|(1+adjp*number*case*gender); | |
42 | -lemma=styczeń|luty|marzec|kwiecień|maj|czerwiec|lipiec|sierpień|wrzesień|październik|listopad|grudzień,pos=subst,number=sg,case=gen: | |
43 | - month-lex/(1+year+np*T*gen*T*T): symbol_weight; | |
44 | -lemma=styczeń|luty|marzec|kwiecień|maj|czerwiec|lipiec|sierpień|wrzesień|październik|listopad|grudzień,pos=subst,number=sg: | |
45 | - np*number*case*gender*person/year: symbol_weight; | |
46 | -pos=month-interval: month-interval: symbol_weight; | |
47 | - | |
48 | -lemma=rok,pos=subst,number=sg: np*number*case*gender*person|year: symbol_weight; | |
49 | -lemma=rok,pos=subst,number=pl: np*number*case*gender*person/year-interval: symbol_weight; | |
50 | -pos=year: year: symbol_weight; | |
51 | -pos=year-interval: year-interval: symbol_weight; | |
52 | - | |
53 | -lemma=wiek,pos=subst,number=sg: np*number*case*gender*person|roman: symbol_weight; | |
54 | -lemma=wiek,pos=subst,number=pl: np*number*case*gender*person/roman-interval: symbol_weight; | |
55 | -pos=roman: roman: symbol_weight; | |
56 | -pos=roman-interval: roman-interval: symbol_weight; | |
57 | - | |
58 | -lemma=godzina,pos=subst,number=sg: np*number*case*gender*person/(hour+hour-minute): symbol_weight; | |
59 | -lemma=godzina,pos=subst,number=pl: np*number*case*gender*person/(hour-interval+hour-minute-interval): symbol_weight; | |
60 | -#pos=hour-minute: hour-minute{schema}: symbol_weight; | |
61 | -#pos=hour: hour{schema}: symbol_weight; | |
62 | -pos=hour-minute: hour-minute: symbol_weight; | |
63 | -pos=hour: hour: symbol_weight; | |
64 | -pos=hour-minute-interval: hour-minute-interval: symbol_weight; | |
65 | -pos=hour-interval: hour-interval: symbol_weight; | |
66 | - | |
67 | -lemma=rysunek,pos=subst,number=sg: np*number*case*gender*person/obj-id: symbol_weight; # objids | |
68 | -pos=obj-id: obj-id: symbol_weight; | |
69 | - | |
70 | -pos=match-result: match-result: symbol_weight; | |
71 | -pos=url: url: symbol_weight; | |
72 | -pos=email: email: symbol_weight; | |
73 | - | |
74 | -pos=symbol: np*number*case*gender*person{\(1+qub),/(1+inclusion)}; | |
75 | - | |
76 | -# FIXME: uslalić kiedy schema jest pusta i wyciąć ją w takich przypadkach | |
39 | +pos=ordnum,phrase=adjp: | |
40 | + adjp*number*case*gender*grad*coerced*role*node; | |
41 | + | |
42 | +#oznaczenia godzin i minut | |
43 | +pos=hour-minute|hour,phrase=np: | |
44 | + QUANT[number=sg,case=nom&gen&dat&acc&inst&loc,gender=f,person=ter,role=0] | |
45 | + np*number*case*gender*person*coerced*role*node{distant-schema}{schema}{local-schema}; | |
46 | +pos=hour-minute-interval|hour-interval,phrase=np: | |
47 | + QUANT[number=sg&pl,case=nom&gen&dat&acc&inst&loc,gender=f,person=ter,role=0] | |
48 | + np*number*case*gender*person*coerced*role*node{distant-schema}{schema}{local-schema}; | |
49 | +pos=hour-minute|hour,phrase=adjp: | |
50 | + QUANT[number=sg,case=nom&gen&dat&acc&inst&loc,gender=f,grad=pos,role=0] | |
51 | + adjp*number*case*gender*grad*coerced*role*node; | |
52 | +pos=hour-minute-interval|hour-interval,phrase=adjp: | |
53 | + QUANT[number=sg&pl,case=nom&gen&dat&acc&inst&loc,gender=f,grad=pos,role=0] | |
54 | + adjp*number*case*gender*grad*coerced*role*node; | |
55 | + | |
56 | +lemma=rok,pos=subst,number=sg,case=gen: QUANT[role=Lemma] roku*role; | |
57 | + | |
58 | +#oznaczenia dat | |
59 | +pos=date,phrase=np: | |
60 | + QUANT[number=sg,case=nom&gen&dat&acc&inst&loc,gender=m3,person=ter,role=0] | |
61 | + np*number*case*gender*person*coerced*role*node | |
62 | + {distant-schema}{schema,/1+roku*Lemma}{local-schema}; | |
63 | +pos=date-interval,phrase=np: | |
64 | + QUANT[number=pl,case=nom&gen&dat&acc&inst&loc,gender=m3,person=ter,role=0] | |
65 | + np*number*case*gender*person*coerced*role*node | |
66 | + {distant-schema}{schema}{local-schema}; | |
67 | +pos=day-month,phrase=np: | |
68 | + QUANT[number=sg,case=nom&gen&dat&acc&inst&loc,gender=m3,person=ter,role=0] | |
69 | + np*number*case*gender*person*coerced*role*node | |
70 | + {distant-schema}{schema}{local-schema}; | |
71 | +pos=day-month-interval,phrase=np: | |
72 | + QUANT[number=pl,case=nom&gen&dat&acc&inst&loc,gender=m3,person=ter,role=0] | |
73 | + np*number*case*gender*person*coerced*role*node | |
74 | + {distant-schema}{schema}{local-schema}; | |
75 | +pos=day,phrase=np: | |
76 | + QUANT[number=sg,case=nom&gen&dat&acc&inst&loc,gender=m3,person=ter,role=0] | |
77 | + np*number*case*gender*person*coerced*role*node | |
78 | + {distant-schema}{schema}{local-schema}; | |
79 | +pos=day-interval,phrase=np: | |
80 | + QUANT[number=pl,case=nom&gen&dat&acc&inst&loc,gender=m3,person=ter,role=0] | |
81 | + np*number*case*gender*person*coerced*role*node | |
82 | + {distant-schema}{schema}{local-schema}; | |
83 | +pos=date,phrase=adjp: | |
84 | + QUANT[number=sg,case=nom&gen&dat&acc&inst&loc,role=0,gender=m3,grad=pos] | |
85 | + adjp*number*case*gender*grad*coerced*role*node{distant-schema}{schema,/1+roku*Lemma}{local-schema}; | |
86 | +pos=date-interval,phrase=adjp: | |
87 | + QUANT[number=pl,case=nom&gen&dat&acc&inst&loc,role=0,gender=m3,grad=pos] | |
88 | + adjp*number*case*gender*grad*coerced*role*node{distant-schema}{schema}{local-schema}; | |
89 | +pos=day-month,phrase=adjp: | |
90 | + QUANT[number=sg,case=nom&gen&dat&acc&inst&loc,role=0,gender=m3,grad=pos] | |
91 | + adjp*number*case*gender*grad*coerced*role*node{distant-schema}{schema}{local-schema}; | |
92 | +pos=day-month-interval,phrase=adjp: | |
93 | + QUANT[number=pl,case=nom&gen&dat&acc&inst&loc,role=0,gender=m3,grad=pos] | |
94 | + adjp*number*case*gender*grad*coerced*role*node{distant-schema}{schema}{local-schema}; | |
95 | +pos=day,phrase=adjp: | |
96 | + QUANT[number=sg,case=nom&gen&dat&acc&inst&loc,role=0,gender=m3,grad=pos] | |
97 | + adjp*number*case*gender*grad*coerced*role*node{distant-schema}{schema}{local-schema}; | |
98 | +pos=day-interval,phrase=adjp: | |
99 | + QUANT[number=pl,case=nom&gen&dat&acc&inst&loc,role=0,gender=m3,grad=pos] | |
100 | + adjp*number*case*gender*grad*coerced*role*node{distant-schema}{schema}{local-schema}; | |
101 | +pos=year,phrase=np: | |
102 | + QUANT[number=sg,case=nom&gen&dat&acc&inst&loc,gender=m3,person=ter,role=0] | |
103 | + np*number*case*gender*person*coerced*role*node | |
104 | + {distant-schema}{schema}{local-schema}; | |
105 | +pos=year-interval,phrase=np: | |
106 | + QUANT[number=pl,case=nom&gen&dat&acc&inst&loc,gender=m3,person=ter,role=0] | |
107 | + np*number*case*gender*person*coerced*role*node | |
108 | + {distant-schema}{schema}{local-schema}; | |
109 | +pos=year,phrase=adjp: | |
110 | + QUANT[number=sg,case=nom&gen&dat&acc&inst&loc,role=0,gender=m3,grad=pos] | |
111 | + adjp*number*case*gender*grad*coerced*role*node; | |
112 | +pos=year-interval,phrase=adjp: | |
113 | + QUANT[number=pl,case=nom&gen&dat&acc&inst&loc,role=0,gender=m3,grad=pos] | |
114 | + adjp*number*case*gender*grad*coerced*role*node; | |
115 | + | |
116 | +pos=match-result,phrase=symbol: | |
117 | + symbol*coerced*role*node; | |
118 | +pos=url,phrase=symbol: | |
119 | + symbol*coerced*role*node; | |
120 | +pos=email,phrase=symbol: | |
121 | + symbol*coerced*role*node; | |
122 | +pos=phone-number,phrase=symbol: | |
123 | + symbol*coerced*role*node; | |
124 | +pos=postal-code,phrase=symbol: | |
125 | + symbol*coerced*role*node; | |
126 | +pos=obj-id,phrase=symbol: | |
127 | + symbol*coerced*role*node; | |
128 | +pos=building-number,phrase=symbol: | |
129 | + symbol*coerced*role*node; | |
130 | + | |
131 | +pos=fixed,phrase=fixed: | |
132 | + fixed*T*coerced*role*node | |
133 | + {distant-schema}{schema}{local-schema}; | |
134 | + | |
135 | +pos=ppron12: | |
136 | + np*number*case*gender*person*cat*role*node{distant-schema}{schema}{local-schema}; | |
137 | +pos=ppron3,praep=npraep|praep-npraep: | |
138 | + np*number*case*gender*person*cat*role*node{distant-schema}{schema}{local-schema}; | |
139 | +pos=ppron3,praep=praep: | |
140 | + QUANT[plemma=0,pcat=0,prole=0,pnode=0] | |
141 | + prepnp*plemma*case*pcat*prole*pnode\(prepnp*plemma*case*pcat*prole*pnode/np*number*case*gender*person*cat*role*node){distant-schema}{schema}{local-schema}; | |
142 | +pos=ppron3,praep=praep: | |
143 | + QUANT[pcat=0,prole=0,pnode=0] | |
144 | + xp*pcat*prole*pnode\(xp*pcat*prole*pnode/np*number*case*gender*person*cat*role*node){distant-schema}{schema}{local-schema}; | |
145 | +pos=siebie: | |
146 | + np*number*case*gender*person*cat*role*node{distant-schema}{schema}{local-schema}; | |
147 | + | |
148 | +#FIXME: imię i nazwisko są tłumaczone na FirstName i LastName - jak to wpływa na działanie poniższych reguł? | |
77 | 149 | # frazy rzeczownikowe |
78 | -pos=subst|depr,nsyn!=pronoun,nsem!=measure: | |
79 | - np*number*case*gender*person{\(1+num*number*case*gender*person*congr*nsem)}{schema}{\(1+qub),/(1+inclusion)}; | |
80 | -pos=subst,case=gen,nsyn!=pronoun,nsem!=measure: | |
150 | +pos=subst|depr,nsem=count,nsyn!=pronoun,cat!=Measure|imię|nazwisko,phrase=np: | |
151 | + np*number*case*gender*person*coerced*role*node | |
152 | + {distant-schema}{\(1+num*number*case*gender*person*congr*count*Count*concept)} | |
153 | + {schema}{local-schema}; | |
154 | +pos=subst,case=gen,nsem=count,nsyn!=pronoun,cat!=Measure|imię|nazwisko,phrase=np: | |
81 | 155 | QUANT[number=T,case=all_cases,gender=T,person=T] |
82 | - np*sg*case*n*person{\num*number*case*gender*person*rec*nsem}{schema}{\(1+qub),/(1+inclusion)}; # UWAGA: number "sg" i gender "n", żeby uzgadniać z podmiotem czasownika | |
83 | -#FIXME: w poniższych nie powinno być zmiany przypadka | |
84 | -pos=subst,case=gen,nsyn!=pronoun,nsem!=measure: | |
85 | - QUANT[unumber=all_numbers,ucase=gen,ugender=all_genders, uperson=all_persons,case=gen] | |
86 | - np*unumber*ucase*ugender*uperson{\measure*unumber*ucase*ugender*uperson}{schema}{\(1+qub),/(1+inclusion)}; | |
87 | -pos=subst,case=gen,nsyn!=pronoun,nsem!=measure: | |
88 | - QUANT[unumber=all_numbers,ucase=dat,ugender=all_genders, uperson=all_persons,case=dat] | |
89 | - np*unumber*ucase*ugender*uperson{\measure*unumber*ucase*ugender*uperson}{schema}{\(1+qub),/(1+inclusion)}; | |
90 | -pos=subst,case=gen,nsyn!=pronoun,nsem!=measure: | |
91 | - QUANT[unumber=all_numbers,ucase=acc,ugender=all_genders, uperson=all_persons,case=acc] | |
92 | - np*unumber*ucase*ugender*uperson{\measure*unumber*ucase*ugender*uperson}{schema}{\(1+qub),/(1+inclusion)}; | |
93 | -pos=subst,case=gen,nsyn!=pronoun,nsem!=measure: | |
94 | - QUANT[unumber=all_numbers,ucase=inst,ugender=all_genders, uperson=all_persons,case=inst] | |
95 | - np*unumber*ucase*ugender*uperson{\measure*unumber*ucase*ugender*uperson}{schema}{\(1+qub),/(1+inclusion)}; | |
96 | -pos=subst,case=gen,nsyn!=pronoun,nsem!=measure: | |
97 | - QUANT[unumber=all_numbers,ucase=loc,ugender=all_genders, uperson=all_persons,case=loc] | |
98 | - np*unumber*ucase*ugender*uperson{\measure*unumber*ucase*ugender*uperson}{schema}{\(1+qub),/(1+inclusion)}; | |
99 | -pos=subst|depr,nsyn=pronoun,nsem!=measure: | |
100 | - np*number*case*gender*person{\(1+num*number*case*gender*person*congr*nsem)}{\(1+qub),/(1+inclusion)}; | |
101 | -pos=subst,case=gen,nsyn=pronoun,nsem!=measure: | |
156 | + np*sg*case*n*person*coerced*role*node | |
157 | + {distant-schema}{\num*number*case*gender*person*rec*count*Count*concept} | |
158 | + {schema}{local-schema}; # UWAGA: number "sg" i gender "n", żeby uzgadniać z podmiotem czasownika | |
159 | +pos=subst,case=gen,nsem=count,nsyn!=pronoun,cat!=Measure|imię|nazwisko,phrase=np: | |
160 | + QUANT[unumber=all_numbers,ucase=all_cases,ugender=all_genders, uperson=all_persons] | |
161 | + np*unumber*ucase*ugender*uperson*coerced*role*node | |
162 | + {distant-schema}{\np*unumber*ucase*ugender*uperson*Measure*Measure*concept} | |
163 | + {schema}{local-schema}; | |
164 | +#pos=subst,case=gen,nsyn!=pronoun,cat!=Measure|imię|nazwisko: | |
165 | +# QUANT[unumber=all_numbers,ucase=nom,ugender=all_genders, uperson=all_persons] | |
166 | +# np*unumber*ucase*ugender*uperson*coerced*role*node | |
167 | +# {\np*unumber*ucase*ugender*uperson*Measure*Measure*concept} | |
168 | +# {distant-schema}{schema}{local-schema}; | |
169 | +#pos=subst,case=gen,nsyn!=pronoun,cat!=Measure|imię|nazwisko: | |
170 | +# QUANT[unumber=all_numbers,ucase=gen,ugender=all_genders, uperson=all_persons] | |
171 | +# np*unumber*ucase*ugender*uperson*coerced*role*node | |
172 | +# {\np*unumber*ucase*ugender*uperson*Measure*Measure*concept} | |
173 | +# {distant-schema}{schema}{local-schema}; | |
174 | +#pos=subst,case=gen,nsyn!=pronoun,cat!=Measure|imię|nazwisko: | |
175 | +# QUANT[unumber=all_numbers,ucase=dat,ugender=all_genders, uperson=all_persons] | |
176 | +# np*unumber*ucase*ugender*uperson*coerced*role*node | |
177 | +# {\np*unumber*ucase*ugender*uperson*Measure*Measure*concept} | |
178 | +# {distant-schema}{schema}{local-schema}; | |
179 | +#pos=subst,case=gen,nsyn!=pronoun,cat!=Measure|imię|nazwisko: | |
180 | +# QUANT[unumber=all_numbers,ucase=acc,ugender=all_genders, uperson=all_persons] | |
181 | +# np*unumber*ucase*ugender*uperson*coerced*role*node | |
182 | +# {\np*unumber*ucase*ugender*uperson*Measure*Measure*concept} | |
183 | +# {distant-schema}{schema}{local-schema}; | |
184 | +#pos=subst,case=gen,nsyn!=pronoun,cat!=Measure|imię|nazwisko: | |
185 | +# QUANT[unumber=all_numbers,ucase=inst,ugender=all_genders, uperson=all_persons] | |
186 | +# np*unumber*ucase*ugender*uperson*coerced*role*node | |
187 | +# {\np*unumber*ucase*ugender*uperson*Measure*Measure*concept} | |
188 | +# {distant-schema}{schema}{local-schema}; | |
189 | +#pos=subst,case=gen,nsyn!=pronoun,cat!=Measure|imię|nazwisko: | |
190 | +# QUANT[unumber=all_numbers,ucase=loc,ugender=all_genders, uperson=all_persons] | |
191 | +# np*unumber*ucase*ugender*uperson*coerced*role*node | |
192 | +# {\np*unumber*ucase*ugender*uperson*Measure*Measure*concept} | |
193 | +# {distant-schema}{schema}{local-schema}; | |
194 | +pos=subst|depr,nsem=count,nsyn=pronoun,cat!=Measure|imię|nazwisko,phrase=np: | |
195 | + np*number*case*gender*person*coerced*role*node | |
196 | + {distant-schema}{\(1+num*number*case*gender*person*congr*count*Count*concept), | |
197 | + schema}; | |
198 | +pos=subst,case=gen,nsem=count,nsyn=pronoun,cat!=Measure,phrase=np: | |
102 | 199 | QUANT[number=T,case=all_cases,gender=T,person=T] |
103 | - np*sg*case*n*person{\num*number*case*gender*person*rec*nsem}{\(1+qub),/(1+inclusion)}; # UWAGA: number "sg" i gender "n", żeby uzgadniać z podmiotem czasownika | |
104 | -pos=subst,case=gen,nsyn=pronoun,nsem!=measure: | |
200 | + np*sg*case*n*person*coerced*role*node | |
201 | + {distant-schema}{\num*number*case*gender*person*rec*count*Count*concept, | |
202 | + schema}; # UWAGA: number "sg" i gender "n", żeby uzgadniać z podmiotem czasownika | |
203 | +pos=subst,case=gen,nsyn=pronoun,cat!=Measure|imię|nazwisko,phrase=np: | |
105 | 204 | QUANT[unumber=all_numbers,ucase=all_cases,ugender=all_genders, uperson=all_persons,number=T,case=all_cases,gender=T,person=ter] |
106 | - np*unumber*ucase*ugender*uperson{\measure*unumber*ucase*ugender*uperson}{\(1+qub),/(1+inclusion)}; | |
107 | -pos=ppron12: | |
108 | - np*number*case*gender*person{\(1+qub),/(1+inclusion)}; | |
109 | -pos=ppron3,praep=npraep|praep-npraep: | |
110 | - np*number*case*gender*person{\(1+qub),/(1+inclusion)}; | |
111 | -pos=siebie: | |
112 | - np*number*case*gender*person{\(1+qub),/(1+inclusion)}; | |
113 | -lemma=jakiś|ten|taki,pos=apron: | |
114 | - QUANT[number=T,case=T,gender=T,person=ter] | |
115 | - np*number*case*gender*person{\(1+qub),/(1+inclusion)}; | |
205 | + np*unumber*case*ugender*uperson*coerced*role*node | |
206 | + {distant-schema}{\np*unumber*case*ugender*uperson*Measure*Measure*concept, | |
207 | + schema}; | |
116 | 208 | |
117 | 209 | # liczebniki |
118 | -# FIXME: liczba po rzeczowniku # FIXME: zbadać jak liczebniki współdziałąją z jako COMPAR | |
119 | -# dwie reguły są potrzebne po to, żeby w ENIAMsemValence.match_value nie pojawiał się variant | |
120 | -pos=num|intnum|realnum|intnum-interval|realnum-interval,nsem=count: | |
121 | - num*number*case*gender*person*acm*nsem{\(1+qub),/(1+inclusion)}; # FIXME: jak usunięcie Phrase ProNG wpływa na pokrycie? | |
122 | -pos=num|intnum|realnum|intnum-interval|realnum-interval,nsem=mass: | |
123 | - num*number*case*gender*person*acm*nsem{\(1+qub),/(1+inclusion)}; # FIXME: jak usunięcie Phrase ProNG wpływa na pokrycie? | |
210 | +#pos=num|intnum|realnum|intnum-interval|realnum-interval,nsem=count: | |
211 | +# QUANT[role=0] | |
212 | +# num*number*case*gender*person*acm*nsem*role*node; # FIXME: jak usunięcie Phrase ProNG wpływa na pokrycie? | |
213 | +#pos=num|intnum|realnum|intnum-interval|realnum-interval,nsem=mass: | |
214 | +# QUANT[role=0] | |
215 | +# num*number*case*gender*person*acm*nsem*role*node; # FIXME: jak usunięcie Phrase ProNG wpływa na pokrycie? | |
216 | +pos=num|intnum|realnum|intnum-interval|realnum-interval,nsem=count,phrase=np: | |
217 | + QUANT[cat=Number,role=Count] | |
218 | + num*number*case*gender*person*acm*nsem*role*node|(1+fixed*T*OpAdNum*Mod*concept); | |
219 | +pos=num|intnum|realnum|intnum-interval|realnum-interval,nsem=mass,phrase=np: | |
220 | + QUANT[cat=Amount,role=Amount] | |
221 | + num*number*case*gender*person*acm*nsem*role*node|(1+fixed*T*OpAdNum*Mod*concept); | |
222 | + | |
223 | +lemma=jeden,pos=adj,grad=pos,phrase=np: | |
224 | + QUANT[person=all_persons,acm=congr,nsem=count,role=Count] | |
225 | + num*number*case*gender*person*acm*nsem*role*node; | |
124 | 226 | |
125 | 227 | # pojemniki |
126 | -pos=subst,nsem=measure: | |
127 | - measure*number*case*gender*person{\(1+num*number*case*gender*person*congr*count)}{schema}{\(1+qub),/(1+inclusion)}: measure_weight; | |
128 | -pos=subst,case=gen,nsem=measure: | |
228 | +pos=subst,cat=Measure: | |
229 | + np*number*case*gender*person*cat*role*node | |
230 | + {distant-schema}{\(1+num*number*case*gender*person*congr*count*T*concept)} | |
231 | + {schema}{local-schema}: measure_weight; | |
232 | +pos=subst,case=gen,cat=Measure: | |
129 | 233 | QUANT[number=T,case=all_cases,gender=T,person=ter] |
130 | - measure*sg*case*n*person{\num*number*case*gender*person*rec*count}{schema}{\(1+qub),/(1+inclusion)}: measure_weight; # UWAGA: number "sg" i gender "n", żeby uzgadniać z podmiotem czasownika | |
131 | - | |
132 | -# frazy przyimkowe | |
133 | -#lemma!=temu,pos=prep: prepnp*lemma*case{\(1+advp*T),/np*T*case*T*T}{\(1+qub),/(1+inclusion)}; | |
134 | -#lemma!=temu,pos=prep: prepadjp*lemma*case{\(1+advp*T),/adjp*T*case*T}{\(1+qub),/(1+inclusion)}; | |
135 | -pos=prep: prepnp*lemma*case{\(1+advp*T),/np*T*case*T*T}{\(1+qub),/(1+inclusion)}; | |
136 | -pos=prep: prepadjp*lemma*case{\(1+advp*T),/adjp*T*case*T}{\(1+qub),/(1+inclusion)}; | |
137 | -lemma=po,pos=prep: QUANT[case=postp] prepadjp*lemma*case{\(1+advp*T),/(adjp*sg*dat*m1+adjp*T*postp*T)}{\(1+qub),/(1+inclusion)}; # po polsku, po kreciemu | |
138 | -lemma=z,pos=prep: QUANT[case=postp] prepadjp*lemma*case{\(1+advp*T),/adjp*sg*nom*f}{\(1+qub),/(1+inclusion)}; # z bliska | |
139 | -lemma=na,pos=prep: QUANT[case=postp] prepadjp*lemma*case{\(1+advp*T),/advp*T}{\(1+qub),/(1+inclusion)}; # na lewo | |
140 | -lemma=temu,pos=prep: prepnp*lemma*case\np*T*case*T*T; # chwilę temu | |
141 | - | |
142 | -# przimkowe określenia czasu | |
143 | -lemma=z,pos=prep,case=gen: prepnp*lemma*case{\(1+advp*T),/(day-month+day+year+date+hour+hour-minute)}{\(1+qub),/(1+inclusion)}; | |
144 | -lemma=do,pos=prep,case=gen: prepnp*lemma*case{\(1+advp*T),/(day-month+day+year+date+hour+hour-minute)}{\(1+qub),/(1+inclusion)}; | |
145 | -lemma=koło,pos=prep,case=gen: prepnp*lemma*case{\(1+advp*T),/(day-month+day+year+date+hour+hour-minute)}{\(1+qub),/(1+inclusion)}; | |
146 | -lemma=na,pos=prep,case=acc: prepnp*lemma*case{\(1+advp*T),/(day-month+day+date+hour+hour-minute)}{\(1+qub),/(1+inclusion)}; | |
147 | -lemma=o,pos=prep,case=loc: prepnp*lemma*case{\(1+advp*T),/(hour+hour-minute)}{\(1+qub),/(1+inclusion)}; | |
148 | -lemma=od,pos=prep,case=gen: prepnp*lemma*case{\(1+advp*T),/(day-month+day+year+date+hour+hour-minute)}{\(1+qub),/(1+inclusion)}; | |
149 | -lemma=około,pos=prep,case=gen: prepnp*lemma*case{\(1+advp*T),/(day-month+day+year+date+hour+hour-minute)}{\(1+qub),/(1+inclusion)}; | |
150 | -lemma=po,pos=prep,case=loc: prepnp*lemma*case{\(1+advp*T),/(day-month+day+year+date+hour+hour-minute)}{\(1+qub),/(1+inclusion)}; | |
151 | -lemma=przed,pos=prep,case=inst: prepnp*lemma*case{\(1+advp*T),/(day-month+day+year+date+hour+hour-minute)}{\(1+qub),/(1+inclusion)}; | |
152 | -lemma=w,pos=prep,case=loc: prepnp*lemma*case{\(1+advp*T),/(day-month+day+year+date+hour+hour-minute)}{\(1+qub),/(1+inclusion)}; | |
153 | - | |
154 | -# komparatywy | |
155 | -# FIXME: trzeba poprawić comparnp i comparpp w walencji | |
156 | -pos=compar: QUANT[case=nom&gen&dat&acc&inst] comparp*lemma*case{\(1+advp*T),/(np*T*case*T*T+adjp*T*case*T)}{\(1+qub),/(1+inclusion)}; | |
157 | -pos=compar: QUANT[case=postp] comparp*lemma*case{\(1+advp*T),/(prepnp*T*T+prepadjp*T*T)}{\(1+qub),/(1+inclusion)}; | |
158 | - | |
159 | -# frazy przymiotnikowe | |
160 | -# FIXME: let grad = match grads with [grad] -> grad | _ -> failwith "make_adjp: grad" in | |
161 | -pos=adj|adjc|adjp: adjp*number*case*gender{schema}{\(1+qub),/(1+inclusion)}{\(1+adja)}; | |
162 | -lemma=jakiś|ten|taki,pos=apron: adjp*number*case*gender{\(1+qub),/(1+inclusion)}; | |
163 | -pos=ordnum|roman-ordnum: adjp*number*case*gender{\(1+qub),/(1+inclusion)}{\(1+adja)}; | |
164 | - | |
165 | -pos=adja|intnum|realnum|intnum-interval|realnum-interval|roman|roman-interval: adja/hyphen; | |
166 | - | |
167 | -# przysłówki | |
168 | -# FIXME let grad = match grads with [grad] -> grad | _ -> failwith "make_advp: grad" in | |
169 | -pos=adv: advp*mode{schema}{\(1+qub),/(1+inclusion)}{\(1+adja)}; | |
170 | - | |
171 | -# relatory | |
172 | -# FIXME: dwa znaczenia jak: pytanie o cechę lub spójnik | |
173 | -lemma=jak,pos=adv: #CHECK | |
174 | - QUANT[amode=0,ctype=int] RAISED[ctype] | |
175 | - cp*ctype*lemma{/(ip*T*T*T/advp*amode)}{/(advp*amode\advp*mode)}; | |
176 | -lemma=skąd|dokąd|gdzie|którędy|kiedy|jak,pos=adv: | |
177 | - QUANT[ctype=int&rel] RAISED[ctype] | |
178 | - cp*ctype*lemma{/(ip*T*T*T/advp*mode)}; | |
179 | -lemma=odkąd|dlaczego|czemu,pos=adv: | |
180 | - QUANT[ctype=int] RAISED[ctype] | |
181 | - cp*ctype*lemma{/(ip*T*T*T/advp*mode)}; | |
182 | -lemma=gdy,pos=adv: | |
183 | - QUANT[ctype=sub] RAISED[ctype] | |
184 | - cp*ctype*lemma{/(ip*T*T*T/advp*mode)}; | |
234 | + np*sg*case*n*person*cat*role*node | |
235 | + {distant-schema}{\num*number*case*gender*person*rec*count*T*concept} | |
236 | + {schema}{local-schema}: measure_weight; # UWAGA: number "sg" i gender "n", żeby uzgadniać z podmiotem czasownika | |
237 | + | |
238 | + | |
239 | +#frazy przymiotnikowe | |
240 | +pos=adj|adjc|adjp,phrase=adjp: | |
241 | + adjp*number*case*gender*grad*coerced*role*node | |
242 | + {distant-schema}{schema}{local-schema}; | |
243 | + | |
244 | +pos=adj,phrase=np: | |
245 | + QUANT[person=ter] | |
246 | + np*number*case*gender*person*coerced*role*node | |
247 | + {distant-schema}{schema}{local-schema}; | |
248 | + | |
249 | +pos=adv,phrase=advp: | |
250 | + advp*grad*coerced*role*node | |
251 | + {distant-schema}{schema}{local-schema}; | |
252 | + | |
253 | +pos=adja,phrase=np: adja2*coerced*role*node; | |
254 | + | |
255 | +pos=adv,phrase=xp: | |
256 | + xp*coerced*role*node | |
257 | + {distant-schema}{schema}{local-schema}; | |
258 | +pos=x,phrase=xp: | |
259 | + xp*coerced*role*node | |
260 | + {distant-schema}{schema}{local-schema}; | |
261 | + | |
262 | +pos=prep,phrase=prepnp: | |
263 | + QUANT[cat=0] | |
264 | + prepnp*lemma*case*cat*role*node | |
265 | + {/np*T*case*T*T*cat*CORE*node}; | |
266 | + | |
267 | +lemma=na,pos=prep,phrase=prepnp: | |
268 | + QUANT[cat=0,case=postp] | |
269 | + prepnp*lemma*case*cat*CORE*node | |
270 | + {/xp*cat*CORE*node}; | |
271 | + | |
272 | +pos=prep,phrase=prepadjp: | |
273 | + QUANT[cat=0] | |
274 | + prepadjp*lemma*case*cat*role*node | |
275 | + {/adjp*T*case*T*T*cat*CORE*node}; | |
276 | + | |
277 | +lemma=po,pos=prep,phrase=prepadjp: | |
278 | + QUANT[cat=0,case=postp] | |
279 | + prepadjp*lemma*case*cat*role*node | |
280 | + {/adjp*T*case*T*T*cat*CORE*node+adjp*sg*dat*m1*T*cat*CORE*node}; | |
281 | + | |
282 | + | |
283 | + | |
284 | +pos=compar: | |
285 | + QUANT[cat=0] | |
286 | + comparp*lemma*case*cat*role*node | |
287 | + /(np*T*case*T*T*cat*CORE*concept+adjp*T*case*T*T*cat*CORE*node); | |
288 | + | |
289 | +pos=compar: | |
290 | + QUANT[case=postp,cat=0] | |
291 | + comparp*lemma*case*cat*role*node | |
292 | + /xp*cat*CORE*node; | |
293 | + | |
185 | 294 | |
186 | 295 | # czasowniki |
187 | -pos=ger: np*number*case*gender*person{schema}{\(1+qub),/(1+inclusion)}; | |
188 | - | |
189 | -pos=pact: adjp*number*case*gender{schema}{\(1+qub),/(1+inclusion)}; | |
190 | -pos=ppas: adjp*number*case*gender{schema}{\(1+qub),/(1+inclusion)}; | |
191 | - | |
192 | -pos=fin|bedzie,negation=aff,mood=indicative: ip*number*gender*person{/(1+int),schema}{\(1+qub),/(1+inclusion)}; | |
193 | -pos=fin|bedzie,negation=neg,mood=indicative: ip*number*gender*person{/(1+int),schema}{\(1+qub),/(1+inclusion)}{\nie}; | |
194 | -pos=fin|bedzie,negation=aff,mood=imperative: ip*number*gender*person{/(1+int),schema,|aux-imp}{\(1+qub),/(1+inclusion)}; | |
195 | -pos=fin|bedzie,negation=neg,mood=imperative: ip*number*gender*person{/(1+int),schema,|aux-imp}{\(1+qub),/(1+inclusion)}{\nie}; | |
196 | -pos=impt|imps,negation=aff: ip*number*gender*person{/(1+int),schema}{\(1+qub),/(1+inclusion)}; | |
197 | -pos=impt|imps,negation=neg: ip*number*gender*person{/(1+int),schema}{\(1+qub),/(1+inclusion)}{\nie}; | |
198 | - | |
199 | -pos=pred,negation=aff,tense=pres: ip*number*gender*person{/(1+int),schema}{\(1+qub),/(1+inclusion)}; | |
200 | -pos=pred,negation=neg,tense=pres: ip*number*gender*person{/(1+int),schema}{\(1+qub),/(1+inclusion)}{\nie}; | |
201 | -pos=pred,negation=aff,tense=fut: ip*number*gender*person{/(1+int),schema,|aux-fut*number*gender*person}{\(1+qub),/(1+inclusion)}; | |
202 | -pos=pred,negation=neg,tense=fut: ip*number*gender*person{/(1+int),schema,|aux-fut*number*gender*person}{\(1+qub),/(1+inclusion)}{\nie}; | |
203 | -pos=pred,negation=aff,tense=past: ip*number*gender*person{/(1+int),schema,|aux-past*number*gender*person}{\(1+qub),/(1+inclusion)}; | |
204 | -pos=pred,negation=neg,tense=past: ip*number*gender*person{/(1+int),schema,|aux-past*number*gender*person}{\(1+qub),/(1+inclusion)}{\nie}; | |
205 | - | |
206 | -pos=praet,person=ter,negation=aff,mood=indicative,tense=past: ip*number*gender*person{/(1+int),schema}{\(1+qub),/(1+inclusion)}; | |
207 | -pos=praet,person=ter,negation=neg,mood=indicative,tense=past: ip*number*gender*person{/(1+int),schema}{\(1+qub),/(1+inclusion)}{\nie}; | |
208 | -pos=praet,person!=ter,negation=aff,mood=indicative,tense=past: ip*number*gender*person{/(1+int),schema,|aglt*number*person}{\(1+qub),/(1+inclusion)}; | |
209 | -pos=praet,person!=ter,negation=neg,mood=indicative,tense=past: ip*number*gender*person{/(1+int),schema,|aglt*number*person}{\(1+qub),/(1+inclusion)}{\nie}; | |
210 | - | |
211 | -pos=winien,person=ter,negation=aff,mood=indicative,tense=pres: ip*number*gender*person{/(1+int),schema}{\(1+qub),/(1+inclusion)}; | |
212 | -pos=winien,person=ter,negation=neg,mood=indicative,tense=pres: ip*number*gender*person{/(1+int),schema}{\(1+qub),/(1+inclusion)}{\nie}; | |
213 | -pos=winien,person!=ter,negation=aff,mood=indicative,tense=pres: ip*number*gender*person{/(1+int),schema,|aglt*number*person}{\(1+qub),/(1+inclusion)}; | |
214 | -pos=winien,person!=ter,negation=neg,mood=indicative,tense=pres: ip*number*gender*person{/(1+int),schema,|aglt*number*person}{\(1+qub),/(1+inclusion)}{\nie}; | |
215 | - | |
216 | -pos=praet|winien,person=ter,negation=aff,mood=conditional,tense!=fut: ip*number*gender*person{/(1+int),schema,|by}{\(1+qub),/(1+inclusion)}; | |
217 | -pos=praet|winien,person=ter,negation=neg,mood=conditional,tense!=fut: ip*number*gender*person{/(1+int),schema,|by}{\(1+qub),/(1+inclusion)}{\nie}; | |
218 | -pos=praet|winien,person!=ter,negation=aff,mood=conditional,tense!=fut: ip*number*gender*person{/(1+int),schema,|aglt*number*person,|by}{\(1+qub),/(1+inclusion)}; | |
219 | -pos=praet|winien,person!=ter,negation=neg,mood=conditional,tense!=fut: ip*number*gender*person{/(1+int),schema,|aglt*number*person,|by}{\(1+qub),/(1+inclusion)}{\nie}; | |
220 | - | |
221 | -pos=praet|winien,negation=aff,tense=fut: ip*number*gender*person{/(1+int),schema,|aux-fut*number*gender*person}{\(1+qub),/(1+inclusion)}; | |
222 | - | |
223 | -pos=winien,person=ter,negation=aff,tense=past: ip*number*gender*person{/(1+int),schema,|aux-past*number*gender*person}{\(1+qub),/(1+inclusion)}; | |
224 | -pos=winien,person=ter,negation=neg,tense=past: ip*number*gender*person{/(1+int),schema,|aux-past*number*gender*person}{\(1+qub),/(1+inclusion)}{\nie}; | |
225 | -pos=winien,person!=ter,negation=aff,tense=past: ip*number*gender*person{/(1+int),schema,|aglt*number*person,|aux-past*number*gender*person}{\(1+qub),/(1+inclusion)}; | |
226 | -pos=winien,person!=ter,negation=neg,tense=past: ip*number*gender*person{/(1+int),schema,|aglt*number*person,|aux-past*number*gender*person}{\(1+qub),/(1+inclusion)}{\nie}; | |
227 | - | |
228 | -pos=bedzie,negation=aff,mood=indicative: aux-fut*number*gender*person; | |
229 | -lemma=być,pos=praet,negation=aff,mood=indicative,tense=past: aux-past*number*gender*person; | |
230 | -pos=aglt: aglt*number*person; | |
231 | - | |
232 | -pos=inf,negation=aff: infp*aspect{schema}{\(1+qub),/(1+inclusion)}; | |
233 | -pos=inf,negation=neg: infp*aspect{schema}{\(1+qub),/(1+inclusion)}{\nie}; | |
234 | -pos=pcon,negation=aff: padvp{schema}{\(1+qub),/(1+inclusion)}; | |
235 | -pos=pcon,negation=neg: padvp{schema}{\(1+qub),/(1+inclusion)}{\nie}; | |
236 | -pos=pant,negation=aff: padvp{schema}{\(1+qub),/(1+inclusion)}; | |
237 | -pos=pant,negation=neg: padvp{schema}{\(1+qub),/(1+inclusion)}{\nie}; | |
238 | - | |
239 | -pos=comp: QUANT[ctype=sub] cp*ctype*lemma/ip*T*T*T; | |
240 | -pos=conj: QUANT[ctype=coord] cp*ctype*lemma/ip*T*T*T; | |
241 | -lemma=i|oraz|lub|czy|bądź,pos=conj: | |
242 | - QUANT[number=all_numbers,gender=all_genders,person=all_persons] | |
243 | - (ip*number*gender*person/ip*T*T*T)\ip*T*T*T; | |
244 | -lemma=,|i|oraz|lub|czy|bądź,pos=conj: (advp*mod/prepnp*T*T)\prepnp*T*T; | |
245 | -lemma=,|i|oraz|lub|czy|bądź,pos=conj: QUANT[mode=0] (advp*mode/advp*mode)\prepnp*T*T; | |
246 | -lemma=,|i|oraz|lub|czy|bądź,pos=conj: QUANT[mode=0] (advp*mode/prepnp*T*T)\advp*mode; | |
247 | -lemma=,|i|oraz|lub|czy|bądź,pos=conj: (advp*mod/advp*T)\advp*T; #FIXME: przydałaby się wersja zachowująca mode | |
248 | -lemma=,|i|oraz|lub|czy|bądź,pos=conj: | |
249 | - QUANT[plemma=0,case=all_cases] | |
250 | - (prepnp*plemma*case/prepnp*plemma*case)\prepnp*plemma*case; | |
251 | -lemma=,|i|oraz|lub|czy|bądź,pos=conj: | |
252 | - QUANT[number=all_numbers,case=all_cases,gender=all_genders,person=all_persons] | |
253 | - (np*number*case*gender*person/np*T*case*T*T)\np*T*case*T*T; | |
254 | -lemma=,|i|oraz|lub|czy|bądź,pos=conj: | |
255 | - QUANT[number=all_numbers,case=all_cases,gender=all_genders] | |
256 | - (adjp*number*case*gender/adjp*number*case*gender)\adjp*number*case*gender; | |
257 | - | |
258 | -lemma=co|kto,pos=subst: | |
259 | - QUANT[ctype=int&rel] RAISED[ctype] | |
260 | - cp*ctype*lemma/(ip*T*T*T/np*number*case*gender*person); | |
261 | -lemma=co|kto,pos=subst: | |
262 | - QUANT[plemma=0,ctype=int&rel] RAISED[ctype] | |
263 | - cp*ctype*lemma{/(ip*T*T*T/prepnp*plemma*case)}{\(prepnp*plemma*case/np*number*case*gender*person)}; | |
264 | -#lemma=co|kto,pos=subst: | |
265 | -# QUANT[plemma=0,ctype=int&rel] RAISED[ctype] | |
266 | -# cp*ctype*lemma{/(ip*T*T*T/comprepnp*plemma)}{\(comprepnp*plemma/np*number*case*gender*person)}; | |
267 | -lemma=to,pos=subst: | |
268 | - QUANT[ctype=0,plemma=0] | |
269 | - ncp*number*case*gender*person*ctype*plemma{\(1+qub),/(1+inclusion)}{/cp*ctype*plemma}; | |
270 | -pos=ppron3,praep=praep: | |
271 | - QUANT[plemma=0] | |
272 | - prepnp*plemma*case\(prepnp*plemma*case/np*number*case*gender*person); #inclusion | |
273 | -lemma=ile,pos=num,acm=congr: | |
274 | - QUANT[ctype=int] RAISED[ctype] | |
275 | - cp*ctype*lemma{/(ip*T*T*T/np*number*case*gender*person)}{/(np*number*case*gender*person\num*number*case*gender*person*congr*nsem)}; | |
276 | -lemma=ile,pos=num,acm=congr: | |
277 | - QUANT[plemma=0,ctype=int] RAISED[ctype] | |
278 | - cp*ctype*lemma{/(ip*T*T*T/prepnp*plemma*case)}{\(prepnp*plemma*case/np*number*case*gender*person)}{/(np*number*case*gender*person\num*number*case*gender*person*congr*nsem)}; | |
279 | -lemma=ile,pos=num,acm=rec: | |
280 | - QUANT[ctype=int] RAISED[ctype] | |
281 | - cp*ctype*lemma{/(ip*T*T*T/np*sg*case*n*person)}{/(np*sg*case*n*person\num*number*case*gender*person*rec*nsem)}; | |
282 | -lemma=ile,pos=num,acm=rec: | |
283 | - QUANT[plemma=0,ctype=int] RAISED[ctype] | |
284 | - cp*ctype*lemma{/(ip*T*T*T/prepnp*plemma*case)}{\(prepnp*plemma*case/np*sg*case*n*person)}{/(np*sg*case*n*person\num*number*case*gender*person*rec*nsem)}; | |
285 | -#lemma=ile,pos=num: # FIXME: iloma ma bezpośredni podrzędnik rzeczownikowy, a ile nie # FIXME: mwe "o ile, na ile" | |
286 | -# QUANT[ctype=int&rel] | |
287 | -# cp*ctype*lemma/ip*T*T*T; # FIXME: zaślepka, bo podrzędnik ile nie musi z nim sąciadować # FIXME: trzeba dodać przypadki, bezpośredniego podrzędnika rzeczownikowego i przyimka nad "ile" | |
288 | -lemma=czyj|jaki|który,pos=apron: | |
289 | - QUANT[nperson=0,ctype=int] RAISED[ctype] | |
290 | - cp*ctype*lemma{/(ip*T*T*T/np*number*case*gender*nperson)}{/(np*number*case*gender*nperson\adjp*number*case*gender)}; | |
291 | -lemma=czyj|jaki|który,pos=apron: | |
292 | - QUANT[nperson=0,plemma=0,ctype=int] RAISED[ctype] | |
293 | - cp*ctype*lemma{/(ip*T*T*T/prepnp*plemma*case)}{\(prepnp*plemma*case/np*number*case*gender*nperson)}{/(np*number*case*gender*nperson\adjp*number*case*gender)}; | |
294 | -lemma=jaki|który,pos=apron: | |
295 | - QUANT[ctype=rel,person=ter] RAISED[ctype] | |
296 | - cp*ctype*lemma/(ip*T*T*T/np*number*case*gender*person); | |
297 | -lemma=jaki|który,pos=apron: | |
298 | - QUANT[plemma=0,ctype=rel,person=ter] RAISED[ctype] | |
299 | - cp*ctype*lemma{/(ip*T*T*T/prepnp*plemma*case)}{\(prepnp*plemma*case/np*number*case*gender*person)}; | |
300 | - | |
301 | -lemma=się,pos=part: lex*się*qub; # FIXME: dodać make_np | |
302 | -lemma=nie,pos=part: nie; | |
303 | -lemma=by,pos=part: by; | |
304 | -lemma=niech,pos=part: aux-imp; | |
305 | -lemma=niechaj,pos=part: aux-imp; | |
306 | -lemma=niechże,pos=part: aux-imp; | |
307 | -lemma=niechajże,pos=part: aux-imp; | |
308 | -lemma=czy,pos=part: QUANT[ctype=int] cp*ctype*lemma/ip*T*T*T; | |
309 | -lemma=gdyby,pos=part: QUANT[ctype=rel] cp*ctype*lemma/ip*T*T*T; | |
310 | -pos=qub: qub; | |
311 | -pos=interj: interj; | |
312 | -lemma=-,pos=interp: hyphen; | |
313 | -lemma=?,pos=interp: int; | |
314 | -lemma=„,pos=interp: QUANT[number=0,case=0,gender=0,person=0] (np*number*case*gender*person/rquot)/np*number*case*gender*person; #SetAttr("QUOT",Val "+",Var "x" | |
315 | -lemma=«,pos=interp: QUANT[number=0,case=0,gender=0,person=0] (np*number*case*gender*person/rquot2)/np*number*case*gender*person; #SetAttr("QUOT",Val "+",Var "x" | |
316 | -lemma=»,pos=interp: QUANT[number=0,case=0,gender=0,person=0] (np*number*case*gender*person/rquot3)/np*number*case*gender*person; #SetAttr("QUOT",Val "+",Var "x" | |
317 | -lemma=”,pos=interp: rquot; | |
318 | -lemma=»,pos=interp: rquot2; | |
319 | -lemma=«,pos=interp: rquot3; | |
320 | -lemma=(,pos=interp: (inclusion/rparen)/(np*T*T*T*T+ip*T*T*T+adjp*T*T*T+prepnp*T*T); #SetAttr("INCLUSION",Val "+", | |
321 | -lemma=[,pos=interp: (inclusion/rparen2)/(np*T*T*T*T+ip*T*T*T+adjp*T*T*T+prepnp*T*T); #SetAttr("INCLUSION",Val "+", | |
322 | -lemma=),pos=interp: rparen; | |
323 | -lemma=],pos=interp: rparen2; | |
324 | -pos=unk: np*number*case*gender*person; | |
325 | -pos=xxx: np*number*case*gender*person; | |
326 | - | |
327 | -lemma=<conll_root>,pos=interp: <conll_root>/(ip*T*T*T+cp*int*T+np*sg*voc*T*T+interj); | |
328 | - | |
329 | -pos=sinterj: BRACKET interj; | |
330 | - | |
331 | -lemma=</sentence>,pos=interp: BRACKET s\?(ip*T*T*T+cp*int*T+np*sg*voc*T*T+interj); | |
332 | -lemma=<sentence>,pos=interp: BRACKET <root>/s; | |
333 | - | |
334 | -lemma=:,pos=interp: BRACKET or; | |
335 | -lemma=:s,pos=interp: BRACKET <colon>\<speaker>; | |
336 | -lemma=:s,pos=interp: BRACKET (<colon>\<speaker>)/<squery>; #FIXME <squery> nie jest nigdzie generowane | |
337 | -lemma=<or-sentence>,pos=interp: BRACKET <root>/s; | |
338 | -lemma=<or-sentence>,pos=interp: BRACKET ((<root>/<speaker-end>)/(ip*T*T*T/or))/or2 SEM[λxλyλz.NODE(yx,z)]; | |
339 | -lemma=</or-sentence>,pos=interp: BRACKET or2\?(ip*T*T*T+cp*int*T+np*sg*voc*T*T+interj); | |
340 | -lemma=<sentence>,pos=interp: BRACKET ((<root>/<speaker-end>)/or)/np*T*nom*T*T; | |
341 | -lemma=</sentence>,pos=interp: BRACKET <speaker-end>; | |
296 | +pos=ger,phrase=np: | |
297 | + np*number*case*gender*person*coerced*role*node | |
298 | + {distant-schema}{schema}{local-schema}; | |
299 | + | |
300 | +pos=pact,phrase=adjp: | |
301 | + QUANT[grad=pos] | |
302 | + adjp*number*case*gender*grad*coerced*role*node | |
303 | + {distant-schema}{schema}{local-schema}; | |
304 | +pos=ppas,phrase=adjp: | |
305 | + QUANT[grad=pos] | |
306 | + adjp*number*case*gender*grad*coerced*role*node | |
307 | + {distant-schema}{schema}{local-schema}; | |
308 | + | |
309 | +pos=fin|bedzie,negation=aff,mood=indicative,phrase=ip: | |
310 | + ip*number*gender*person*coerced*role*node | |
311 | + {distant-schema}{schema}{local-schema}; | |
312 | +pos=fin|bedzie,negation=neg,mood=indicative,phrase=ip: | |
313 | + ip*number*gender*person*coerced*role*node | |
314 | + {distant-schema}{schema}{local-schema} | |
315 | + {\lex*nie*qub*role*dot}; | |
316 | +pos=fin|bedzie,negation=aff,mood=imperative,phrase=ip: | |
317 | + ip*number*gender*person*coerced*role*node | |
318 | + {distant-schema}{schema, | |
319 | + |aux-imp*dot}; | |
320 | +pos=fin|bedzie,negation=neg,mood=imperative,phrase=ip: | |
321 | + ip*number*gender*person*coerced*role*node | |
322 | + {distant-schema}{schema, | |
323 | + |aux-imp*dot} | |
324 | + {\lex*nie*qub*role*dot}; | |
325 | +pos=impt|imps,negation=aff,phrase=ip: | |
326 | + ip*number*gender*person*coerced*role*node | |
327 | + {distant-schema}{schema}{local-schema}; | |
328 | +pos=impt|imps,negation=neg,phrase=ip: | |
329 | + ip*number*gender*person*coerced*role*node | |
330 | + {distant-schema}{schema}{local-schema} | |
331 | + {\lex*nie*qub*role*dot}; | |
332 | + | |
333 | +pos=pred,negation=aff,tense=pres,phrase=ip: | |
334 | + ip*number*gender*person*coerced*role*node | |
335 | + {distant-schema}{schema}{local-schema}; | |
336 | +pos=pred,negation=neg,tense=pres,phrase=ip: | |
337 | + ip*number*gender*person*coerced*role*node | |
338 | + {distant-schema}{schema}{local-schema} | |
339 | + {\lex*nie*qub*role*dot}; | |
340 | +pos=pred,negation=aff,tense=fut,phrase=ip: | |
341 | + ip*number*gender*person*coerced*role*node | |
342 | + {distant-schema}{schema, | |
343 | + |aux-fut*number*gender*person*dot}; | |
344 | +pos=pred,negation=neg,tense=fut,phrase=ip: | |
345 | + ip*number*gender*person*coerced*role*node | |
346 | + {distant-schema}{schema, | |
347 | + |aux-fut*number*gender*person*dot} | |
348 | + {\lex*nie*qub*role*dot}; | |
349 | +pos=pred,negation=aff,tense=past,phrase=ip: | |
350 | + ip*number*gender*person*coerced*role*node | |
351 | + {distant-schema}{schema, | |
352 | + |aux-past*number*gender*person*dot}; | |
353 | +pos=pred,negation=neg,tense=past,phrase=ip: | |
354 | + ip*number*gender*person*coerced*role*node | |
355 | + {distant-schema}{schema, | |
356 | + |aux-past*number*gender*person*dot} | |
357 | + {\lex*nie*qub*role*dot}; | |
358 | + | |
359 | +pos=praet,person=ter,negation=aff,mood=indicative,tense=past,phrase=ip: | |
360 | + ip*number*gender*person*coerced*role*node | |
361 | + {distant-schema}{schema}{local-schema}; | |
362 | +pos=praet,person=ter,negation=neg,mood=indicative,tense=past,phrase=ip: | |
363 | + ip*number*gender*person*coerced*role*node | |
364 | + {distant-schema}{schema}{local-schema} | |
365 | + {\lex*nie*qub*role*dot}; | |
366 | +pos=praet,person!=ter,negation=aff,mood=indicative,tense=past,phrase=ip: | |
367 | + ip*number*gender*person*coerced*role*node | |
368 | + {distant-schema}{schema, | |
369 | + |aglt*number*person*dot}; | |
370 | +pos=praet,person!=ter,negation=neg,mood=indicative,tense=past,phrase=ip: | |
371 | + ip*number*gender*person*coerced*role*node | |
372 | + {distant-schema}{schema, | |
373 | + |aglt*number*person*dot} | |
374 | + {\lex*nie*qub*role*dot}; | |
375 | + | |
376 | +pos=winien,person=ter,negation=aff,mood=indicative,tense=pres,phrase=ip: | |
377 | + ip*number*gender*person*coerced*role*node | |
378 | + {distant-schema}{schema}{local-schema}; | |
379 | +pos=winien,person=ter,negation=neg,mood=indicative,tense=pres,phrase=ip: | |
380 | + ip*number*gender*person*coerced*role*node | |
381 | + {distant-schema}{schema}{local-schema} | |
382 | + {\lex*nie*qub*role*dot}; | |
383 | +pos=winien,person!=ter,negation=aff,mood=indicative,tense=pres,phrase=ip: | |
384 | + ip*number*gender*person*coerced*role*node | |
385 | + {distant-schema}{schema, | |
386 | + |aglt*number*person*dot}; | |
387 | +pos=winien,person!=ter,negation=neg,mood=indicative,tense=pres,phrase=ip: | |
388 | + ip*number*gender*person*coerced*role*node | |
389 | + {distant-schema}{schema, | |
390 | + |aglt*number*person*dot} | |
391 | + {\lex*nie*qub*role*dot}; | |
392 | + | |
393 | +pos=praet|winien,person=ter,negation=aff,mood=conditional,tense!=fut,phrase=ip: | |
394 | + ip*number*gender*person*coerced*role*node | |
395 | + {distant-schema}{schema, | |
396 | + |by*dot}; | |
397 | +pos=praet|winien,person=ter,negation=neg,mood=conditional,tense!=fut,phrase=ip: | |
398 | + ip*number*gender*person*coerced*role*node | |
399 | + {distant-schema}{schema, | |
400 | + |by*dot} | |
401 | + {\lex*nie*qub*role*dot}; | |
402 | +pos=praet|winien,person!=ter,negation=aff,mood=conditional,tense!=fut,phrase=ip: | |
403 | + ip*number*gender*person*coerced*role*node | |
404 | + {distant-schema}{schema, | |
405 | + |aglt*number*person*dot, | |
406 | + |by*dot}; | |
407 | +pos=praet|winien,person!=ter,negation=neg,mood=conditional,tense!=fut,phrase=ip: | |
408 | + ip*number*gender*person*coerced*role*node | |
409 | + {distant-schema}{schema, | |
410 | + |aglt*number*person*dot, | |
411 | + |by*dot} | |
412 | + {\lex*nie*qub*role*dot}; | |
413 | + | |
414 | +pos=praet|winien,negation=aff,tense=fut,phrase=ip: | |
415 | + ip*number*gender*person*coerced*role*node | |
416 | + {distant-schema}{schema, | |
417 | + |aux-fut*number*gender*person*dot}; | |
418 | + | |
419 | +pos=winien,person=ter,negation=aff,tense=past,phrase=ip: | |
420 | + ip*number*gender*person*coerced*role*node | |
421 | + {distant-schema}{schema, | |
422 | + |aux-past*number*gender*person*dot}; | |
423 | +pos=winien,person=ter,negation=neg,tense=past,phrase=ip: | |
424 | + ip*number*gender*person*coerced*role*node | |
425 | + {distant-schema}{schema, | |
426 | + |aux-past*number*gender*person*dot} | |
427 | + {\lex*nie*qub*role*dot}; | |
428 | +pos=winien,person!=ter,negation=aff,tense=past,phrase=ip: | |
429 | + ip*number*gender*person*coerced*role*node | |
430 | + {distant-schema}{schema, | |
431 | + |aglt*number*person*dot, | |
432 | + |aux-past*number*gender*person*dot}; | |
433 | +pos=winien,person!=ter,negation=neg,tense=past,phrase=ip: | |
434 | + ip*number*gender*person*coerced*role*node | |
435 | + {distant-schema}{schema, | |
436 | + |aglt*number*person*dot, | |
437 | + |aux-past*number*gender*person*dot} | |
438 | + {\lex*nie*qub*role*dot}; | |
439 | + | |
440 | +pos=bedzie,negation=aff,mood=indicative: | |
441 | + QUANT[node=dot] aux-fut*number*gender*person*node; | |
442 | +lemma=być,pos=praet,negation=aff,mood=indicative,tense=past: | |
443 | + QUANT[node=dot] aux-past*number*gender*person*node; | |
444 | +pos=aglt: | |
445 | + QUANT[node=dot] aglt*number*person*node; | |
446 | + | |
447 | +pos=inf,negation=aff,phrase=infp: | |
448 | + infp*aspect*coerced*role*node | |
449 | + {distant-schema}{schema}{local-schema}; | |
450 | +pos=inf,negation=neg,phrase=infp: | |
451 | + infp*aspect*coerced*role*node | |
452 | + {distant-schema}{schema}{local-schema} | |
453 | + {\lex*nie*qub*role*dot}; | |
454 | +pos=pcon,negation=aff,phrase=padvp: | |
455 | + padvp*coerced*role*node | |
456 | + {distant-schema}{schema}{local-schema}; | |
457 | +pos=pcon,negation=neg,phrase=padvp: | |
458 | + padvp*coerced*role*node | |
459 | + {distant-schema}{schema}{local-schema} | |
460 | + {\lex*nie*qub*role*dot}; | |
461 | +pos=pant,negation=aff,phrase=padvp: | |
462 | + padvp*coerced*role*node | |
463 | + {distant-schema}{schema}{local-schema}; | |
464 | +pos=pant,negation=neg,phrase=padvp: | |
465 | + padvp*coerced*role*node | |
466 | + {distant-schema}{schema}{local-schema} | |
467 | + {\lex*nie*qub*role*dot}; | |
468 | + | |
469 | +#spójniki podrzędne | |
470 | +pos=comp,node=sit: | |
471 | + QUANT[cat=0,ctype=sub,role=0] | |
472 | + cp*ctype*lemma*cat*role*node | |
473 | + /ip*T*T*T*cat*CORE*sit; | |
474 | + | |
475 | +#zaimki względne i pytajne | |
476 | +lemma=czyj|jaki|który,pos=apron,node=sit: | |
477 | + QUANT[cat=Interrogative,ncat=0,nperson=0,ctype=int,aspect=0,role=0,icat=0,irole=0,inode=0,nrole=0,nnode=0] RAISED[ctype,cat] | |
478 | + cp*ctype*lemma*ncat*role*node | |
479 | + {/(infp*aspect*icat*irole*inode/np*number*case*gender*nperson*ncat*nrole*nnode)} | |
480 | + {/(ip*T*T*T*Y*CORE*sit/infp*aspect*icat*irole*inode)} | |
481 | + {/(np*number*case*gender*nperson*ncat*nrole*nnode\adjp*number*case*gender*grad*cat*role*node)}; | |
482 | +lemma=czyj|jaki|który,pos=apron,node=sit: | |
483 | + QUANT[cat=Interrogative,ncat=0,nperson=0,ctype=int,aspect=0,role=0,nrole=0,nnode=0] RAISED[ctype,cat] | |
484 | + cp*ctype*lemma*ncat*role*node | |
485 | + {/(ip*T*T*T*State*CORE*sit/np*number*case*gender*nperson*ncat*nrole*nnode)} | |
486 | + {/(np*number*case*gender*nperson*ncat*nrole*nnode\adjp*number*case*gender*grad*cat*role*node)}; | |
487 | +lemma=czyj|jaki|który,pos=apron,node=sit: | |
488 | + QUANT[cat=Interrogative,ncat=0,nperson=0,ctype=int,aspect=0,role=0] RAISED[ctype,cat] #FIXME: problem z cat/ncat, problem z role/Attr, problem z node/concept | |
489 | + cp*ctype*lemma*ncat*role*node | |
490 | + {/(ip*number*gender*T*State*CORE*sit|adjp*number*case*gender*grad*cat*role*node)}; | |
491 | +lemma=czyj|jaki|który,pos=apron,node=sit: | |
492 | + QUANT[cat=Interrogative,icat=0,ncat=0,nperson=0,ctype=int,aspect=0,plemma=0,role=0,irole=0,inode=0,nrole=0,nnode=0,prole=0,pnode=0] RAISED[ctype,cat] | |
493 | + cp*ctype*lemma*ncat*role*node | |
494 | + {/(infp*aspect*icat*irole*inode/prepnp*plemma*case*ncat*prole*pnode), | |
495 | + /(ip*T*T*T*Attitude*CORE*sit/infp*aspect*icat*irole*inode)} | |
496 | + {\(prepnp*plemma*case*ncat*prole*pnode/np*number*case*gender*nperson*ncat*nrole*nnode)} | |
497 | + {/(np*number*case*gender*nperson*ncat*nrole*nnode\adjp*number*case*gender*grad*cat*role*node)}; | |
498 | +lemma=czyj|jaki|który,pos=apron,node=sit: QUANT[cat=Interrogative,ncat=0,nperson=0,ctype=int,aspect=0,role=0,nrole=0,nnode=0] RAISED[ctype,cat] | |
499 | + cp*ctype*lemma*ncat*role*node | |
500 | + {/(np*number*case*gender*nperson*ncat*nrole*nnode\adjp*number*case*gender*grad*cat*role*node)}; | |
501 | +lemma=ile,pos=num,node=sit: | |
502 | + QUANT[cat=Price,ctype=int,role=0,nrole=0] RAISED[ctype,cat] | |
503 | + cp*ctype*lemma*cat*role*node | |
504 | + {/(ip*T*T*T*State*CORE*sit/np*number*case*gender*person*cat*nrole*concept)}; | |
505 | +lemma=który,pos=apron,node=sit: | |
506 | + QUANT[cat=0,person=ter,ctype=rel,role=0,nrole=0] RAISED[ctype,cat] | |
507 | + cp*ctype*lemma*cat*role*node | |
508 | + {/(ip*T*T*T*State*CORE*sit/np*number*case*gender*person*cat*nrole*concept)}; | |
509 | + | |
510 | +#znak zapytania | |
511 | +lemma=?,pos=interp,node=sit: | |
512 | + QUANT[cat=0,role=0] | |
513 | + intp*cat*role*node | |
514 | + \(ip*T*T*T*cat*role*sit+np*T*nom*T*T*cat*role*sit+cp*int*T*cat*role*sit+prepnp*T*T*T*cat*role*sit+advp*T*cat*role*sit); | |
515 | + | |
516 | +#metatekstowe modyfikatory pojawiające się na początku zdania | |
517 | +lemma=tym,pos=conj: | |
518 | + QUANT[cat=0,role=0,node=sit] | |
519 | + mp*cat*role*node | |
520 | + /ip*T*T*T*cat*role*sit; | |
521 | +lemma=więc|zatem|to|i|a|albo,pos=conj,node=sit: | |
522 | + QUANT[cat=0,role=0] | |
523 | + mp*cat*role*node | |
524 | + /(ip*T*T*T*cat*role*sit+cp*int*T*cat*role*sit+intp*cat*role*sit+interj*cat*role*sit+np*T*nom*T*T*cat*role*sit); | |
525 | +lemma=i|a,pos=conj,node=sit: | |
526 | + QUANT[cat=0,role=0] | |
527 | + mp*cat*role*node | |
528 | + /(np*T*nom*T*T*cat*role*sit+intp*cat*role*sit); | |
529 | + | |
530 | +#wykrzykniki | |
531 | +pos=sinterj: | |
532 | + BRACKET | |
533 | + sinterj*cat*role*node; | |
534 | +pos=sinterj: | |
535 | + sinterj*cat*role*node; #FIXME: trzeba zrobić porządek z bracketami | |
536 | +pos=interj: | |
537 | + interj*cat*role*node | |
538 | + {distant-schema}{schema}{local-schema}; | |
539 | + | |
540 | + | |
541 | + | |
542 | +lemma=nie,pos=part: | |
543 | + QUANT[cat=Time,coerced=Time&State,role=0] | |
544 | + # QUANT[cat=0,coerced=Time&State,role=0] | |
545 | + xp*coerced*role*node | |
546 | + /xp*cat*Time*concept; | |
547 | +lemma=nie,pos=part: | |
548 | + QUANT[role=0] | |
549 | + lex*nie*qub*role*node; | |
550 | +lemma=się,pos=part: | |
551 | + QUANT[role=0,node=concept&dot] | |
552 | + lex*się*qub*role*node; | |
553 | +lemma=by,pos=part,node=dot: | |
554 | + by*node; | |
555 | +lemma=niech|niechaj|niechże|niechajże,pos=part,node=dot: aux-imp*node; | |
556 | + | |
557 | +lemma=i|oraz|lub|czy|bądź|a,pos=conj,phrase=np: QUANT[cat=0,number=all_numbers,case=all_cases,gender=all_genders,person=all_persons,role=0] | |
558 | + COORD np*number*case*gender*person*cat*role*node | |
559 | + |np*T*case*T*T*cat*role*node; | |
560 | +lemma=i|oraz|lub|czy|bądź|a,pos=conj,phrase=adjp: QUANT[cat=0,number=all_numbers,case=all_cases,gender=all_genders,role=0] | |
561 | + COORD adjp*number*case*gender*T*cat*role*node | |
562 | + |adjp*number*case*gender*T*cat*role*node; | |
563 | +lemma=i|oraz|lub|czy|bądź|a,pos=conj,phrase=adjp: QUANT[cat=0,number=all_numbers,case=all_cases,gender=all_genders,role=0] | |
564 | + COORD adjp*number*case*gender*T*cat*role*node | |
565 | + |adjp*T*case*gender*T*cat*role*node; | |
566 | +#lemma=i|oraz|lub|czy|bądź|a,pos=conj: QUANT[cat=0,role=0] | |
567 | +# COORD advp*T*cat*role*node | |
568 | +# |(prepnp*sem*T*T*cat*role*node+advp*T*cat*role*node); | |
569 | +lemma=i|oraz|lub|czy|bądź|a,pos=conj,phrase=xp: QUANT[cat=0,role=0] | |
570 | + COORD xp*cat*role*node | |
571 | + |xp*cat*role*node; | |
572 | +lemma=i|oraz|lub|czy|bądź|a,pos=conj,phrase=np: QUANT[acm=congr&rec,nsem=count&mass,number=all_numbers,case=all_cases,gender=all_genders,person=all_persons,role=0] | |
573 | + COORD num*number*case*gender*person*acm*nsem*role*node | |
574 | + |num*T*case*gender*person*T*nsem*role*node; | |
575 | + | |
576 | +lemma=,,pos=conj,phrase=np: QUANT[cat=0,number=all_numbers,case=all_cases,gender=all_genders,person=all_persons,role=0] | |
577 | + COORD SINGLE-COST np*number*case*gender*person*cat*role*node | |
578 | + |np*T*case*T*T*cat*role*node; | |
579 | +lemma=,,pos=conj,phrase=adjp: QUANT[cat=0,number=all_numbers,case=all_cases,gender=all_genders,role=0] | |
580 | + COORD SINGLE-COST adjp*number*case*gender*T*cat*role*node | |
581 | + |adjp*number*case*gender*T*cat*role*node; | |
582 | +lemma=,,pos=conj,phrase=adjp: QUANT[cat=0,number=all_numbers,case=all_cases,gender=all_genders,role=0] | |
583 | + COORD SINGLE-COST adjp*number*case*gender*T*cat*role*node | |
584 | + |adjp*T*case*gender*T*cat*role*node; | |
585 | +#lemma=,,pos=conj: QUANT[cat=0,role=0] | |
586 | +# COORD SINGLE-COST advp*T*cat*role*node | |
587 | +# |(prepnp*sem*T*T*cat*role*node+advp*T*cat*role*node); | |
588 | +lemma=,,pos=conj,phrase=xp: QUANT[cat=0,role=0] | |
589 | + COORD SINGLE-COST xp*cat*role*node | |
590 | + |xp*cat*role*node; | |
591 | +lemma=,,pos=conj,phrase=np: QUANT[acm=congr&rec,nsem=count&mass,number=all_numbers,case=all_cases,gender=all_genders,person=all_persons,role=0] | |
592 | + COORD num*number*case*gender*person*acm*nsem*role*node | |
593 | + |num*T*case*gender*person*T*nsem*role*node; | |
594 | + | |
595 | +lemma=,,pos=conj,phrase=np: PRECOORD np; | |
596 | + | |
597 | +lemma=-,pos=interp,phrase=np: | |
598 | + QUANT[cat=0,role=0,node=0] | |
599 | + adja*cat*role*node\adja2*cat*role*node; | |
600 | +lemma=-,pos=interp,phrase=np: | |
601 | + QUANT[number=0,case=0,gender=0,person=0,cat=0,role=0,node=0] | |
602 | + npa*number*case*gender*person*cat*role*node/np*number*case*gender*person*cat*role*node; | |
603 | + | |
604 | +lemma=(,pos=interp,phrase=np: | |
605 | + QUANT[cat=0,role=0,node=0] | |
606 | + (inclusion*cat*role*node/inclusion-end)/ | |
607 | + (np*T*nom*T*T*cat*role*node+xp*cat*role*node+fixed*T*cat*role*node); | |
608 | +lemma=),pos=interp,phrase=np,node=dot: inclusion-end; | |
609 | + | |
610 | +#wersja z podziałem na zdania wewnątrz subsyntax | |
611 | +lemma=<sentence>,pos=interp,node=dot,phrase=<root>: BRACKET | |
612 | + <root> | |
613 | + /s*null*relations; | |
614 | +#wersja bez podziału na zdania wewnątrz subsyntax | |
615 | +lemma=<sentence>,pos=interp,node=dot,phrase=<sentence>: BRACKET | |
616 | + <sentence>*node | |
617 | + /s*null*relations; | |
618 | +lemma=</query>,pos=interp,node=relations,phrase=<paragraph>: BRACKET | |
619 | + QUANT[role=NextSentence] | |
620 | + <paragraph>*role*node | |
621 | + \?<sentence>*dot; | |
622 | +lemma=<query>,pos=interp,node=dot,phrase=<root>: BRACKET | |
623 | + <root> | |
624 | + /<paragraph>*T*relations; | |
342 | 625 | |
343 | 626 | pos=subst: <subst>; |
344 | 627 | pos=year: <year>; |
... | ... | @@ -349,6 +632,7 @@ pos=ppron12: <ppron12>; |
349 | 632 | pos=ppron3: <ppron3>; |
350 | 633 | pos=siebie: <siebie>; |
351 | 634 | pos=num: <num>; |
635 | +pos=numcomp: <numcomp>; | |
352 | 636 | pos=intnum: <intnum>; |
353 | 637 | pos=realnum: <realnum>; |
354 | 638 | pos=intnum-interval: <intnum-interval>; |
... | ... | @@ -373,7 +657,12 @@ pos=match-result: <match-result>; |
373 | 657 | pos=building-number: <building-number>; |
374 | 658 | pos=url: <url>; |
375 | 659 | pos=email: <email>; |
660 | +pos=phone-number: <phone-number>; | |
661 | +pos=postal-code: <postal-code>; | |
662 | +pos=list-item: <list-item>; | |
376 | 663 | pos=obj-id: <obj-id>; |
664 | +pos=html-tag: <html-tag>; | |
665 | +pos=fixed: <fixed>; | |
377 | 666 | pos=apron: <apron>; |
378 | 667 | pos=adj: <adj>; |
379 | 668 | pos=adjc: <adjc>; |
... | ... | @@ -404,3 +693,4 @@ pos=interp: <interp>; |
404 | 693 | pos=part: <part>; |
405 | 694 | pos=compar: <compar>; |
406 | 695 | pos=unk: <unk>; |
696 | +pos=initial: <initial>; | |
... | ... |
LCGlexicon/resources/num.tab
LCGlexicon/test.ml
... | ... | @@ -25,7 +25,7 @@ let rules = ENIAM_LCGlexicon.make_rules false ENIAM_LCGlexiconTypes.rules_filena |
25 | 25 | (* let rules = ENIAM_LCGlexicon.make_rules false "resources/lexicon-pl.dic" *) |
26 | 26 | |
27 | 27 | let examples = [ |
28 | - "kot",[ | |
28 | +(* "kot",[ | |
29 | 29 | 1, 0, 1, "","<sentence>","interp", [],false; |
30 | 30 | 2, 1, 2, "","<clause>","interp", [],false; |
31 | 31 | 3, 2, 3, "Ala","Ala","subst", [["sg"];["nom"];["f"]],true; |
... | ... | @@ -55,7 +55,7 @@ let examples = [ |
55 | 55 | 7, 6, 7, "?","?","interp", [],false; |
56 | 56 | 8, 7, 8, "","</clause>","interp", [],false; |
57 | 57 | 9, 8, 9, ".","</sentence>","interp", [],false; |
58 | - ],9; | |
58 | + ],9;*) | |
59 | 59 | "kot_i_pies",[ |
60 | 60 | 1, 0, 1, "","<sentence>","interp", [],false; |
61 | 61 | 2, 1, 2, "","<clause>","interp", [],false; |
... | ... | @@ -67,7 +67,7 @@ let examples = [ |
67 | 67 | 8, 7, 8, "","</clause>","interp", [],false; |
68 | 68 | 9, 8, 9, ".","</sentence>","interp", [],false; |
69 | 69 | ],9; |
70 | -"kotx",[ | |
70 | +(*"kotx",[ | |
71 | 71 | 1, 0, 1, "","<sentence>","interp", [],false; |
72 | 72 | 2, 1, 2, "","<clause>","interp", [],false; |
73 | 73 | 3, 2, 3, "Ala","Ala","subst", [["sg"];["nom"];["f"]],true; |
... | ... | @@ -77,18 +77,18 @@ let examples = [ |
77 | 77 | 7, 6, 7, "”","”","interp", [],false; |
78 | 78 | 8, 7, 8, "","</clause>","interp", [],false; |
79 | 79 | 9, 8, 9, ".","</sentence>","interp", [],false; |
80 | -],9; | |
80 | +],9;*) | |
81 | 81 | ] |
82 | 82 | |
83 | 83 | let valence = [ |
84 | - [Lemma,Eq,["Ala";"Al"];Pos,Eq,["subst"]],[]; | |
85 | - [Lemma,Eq,["mieć"];Pos,Eq,["fin"];Negation,Eq,["aff"];Mood,Eq,["indicative"]],[Both,Plus[One;Tensor[Atom "np";AVar "number";Atom "nom";AVar "gender";AVar "person"]]; | |
84 | + [Lemma,Eq,["Ala";"Al"];Pos,Eq,["subst"]],[],[]; | |
85 | + [Lemma,Eq,["mieć"];Pos,Eq,["fin"];Negation,Eq,["aff"];Mood,Eq,["indicative"]],[],[Both,Plus[One;Tensor[Atom "np";AVar "number";Atom "nom";AVar "gender";AVar "person"]]; | |
86 | 86 | Both,Plus[One;Tensor[Atom "np";Top;Atom "acc";Top;Top]]]; |
87 | - [Lemma,Eq,["mieć"];Pos,Eq,["fin"];Negation,Eq,["neg"];Mood,Eq,["indicative"]],[Both,Plus[One;Tensor[Atom "np";AVar "number";Atom "nom";AVar "gender";AVar "person"]]; | |
88 | - Both,Plus[One;Tensor[Atom "np";Top;Atom "gen";Top;Top]]]; | |
89 | - [Lemma,Eq,["kot"];Pos,Eq,["subst"]],[Both,Plus[One;Tensor[Atom "adjp";AVar "number";AVar "case";AVar "gender"]]]; | |
90 | - [Lemma,Eq,["kota"];Pos,Eq,["subst"]],[]; | |
91 | - [Lemma,Eq,["pies"];Pos,Eq,["subst"]],[]; | |
87 | + (* [Lemma,Eq,["mieć"];Pos,Eq,["fin"];Negation,Eq,["neg"];Mood,Eq,["indicative"]],[],[Both,Plus[One;Tensor[Atom "np";AVar "number";Atom "nom";AVar "gender";AVar "person"]]; | |
88 | + Both,Plus[One;Tensor[Atom "np";Top;Atom "gen";Top;Top]]]; *) | |
89 | + [Lemma,Eq,["kota"];Pos,Eq,["subst"]],[],[]; | |
90 | + [Lemma,Eq,["kot"];Pos,Eq,["subst"]],[],[Both,Plus[One;Tensor[Atom "adjp";AVar "number";AVar "case";AVar "gender"]]]; | |
91 | + [Lemma,Eq,["pies"];Pos,Eq,["subst"]],[],[]; | |
92 | 92 | ] |
93 | 93 | |
94 | 94 | let create_chart valence tokens last = |
... | ... | @@ -122,7 +122,7 @@ let test_example valence (name,tokens,last) = |
122 | 122 | let chart,references = ENIAM_LCGchart.lazify chart in |
123 | 123 | ENIAM_LCGlatexOf.print_chart "results/" (name^"2_chart") "a4" text_fragments chart; |
124 | 124 | ENIAM_LCGlatexOf.print_references "results/" (name^"2_references") "a4" references; |
125 | - let chart = ENIAM_LCGchart.parse chart references 30. Sys.time in (* uwaga: niejawna zmiana imperatywna w references *) | |
125 | + let chart = ENIAM_LCGchart.parse ENIAM_LCGrules.application_rules chart references 30. Sys.time in (* uwaga: niejawna zmiana imperatywna w references *) | |
126 | 126 | ENIAM_LCGlatexOf.print_chart "results/" (name^"3_chart") "a4" text_fragments chart; |
127 | 127 | ENIAM_LCGlatexOf.print_references "results/" (name^"3_references") "a4" references; |
128 | 128 | if ENIAM_LCGchart.is_parsed chart then ( |
... | ... |
LCGparser/ENIAM_LCG_XMLof.ml
... | ... | @@ -26,6 +26,7 @@ let rec linear_term = function |
26 | 26 | Xml.Element("Variant",["label",e],Xlist.map l (fun (i,t) -> |
27 | 27 | Xml.Element("option",["number",i],[linear_term t]))) |
28 | 28 | | VariantVar(v,t) -> Xml.Element("VariantVar",["var",v],[linear_term t]) |
29 | + | Proj(n,t) -> Xml.Element("Proj",["option",string_of_int n],[linear_term t]) | |
29 | 30 | | ProjVar(v,t) -> Xml.Element("ProjVar",["var",v],[linear_term t]) |
30 | 31 | | SubstVar v -> Xml.Element("SubstVar",[],[Xml.PCData v]) |
31 | 32 | | Subst(s,v,t) -> Xml.Element("Subst",["var",v],[linear_term s;linear_term t]) |
... | ... | @@ -52,6 +53,10 @@ let rec linear_term = function |
52 | 53 | Xml.Element("arg_symbol",[],[linear_term t.arg_symbol]); |
53 | 54 | Xml.Element("attrs",[],Xlist.map t.attrs (fun (k,v) -> Xml.Element("attr",["name",k],[linear_term v]))); |
54 | 55 | Xml.Element("args",[],[linear_term t.args])]) |
56 | + | Coord(l,t,a) -> Xml.Element("Coord",[],Xlist.map (t :: a :: l) linear_term) | |
57 | + | AddCoord(s,t) -> Xml.Element("AddCoord",[],[linear_term s;linear_term t]) | |
58 | + | MapCoord(s,t) -> Xml.Element("MapCoord",[],[linear_term s;linear_term t]) | |
59 | + | ConcatCoord(s,t) -> Xml.Element("ConcatCoord",[],[linear_term s;linear_term t]) | |
55 | 60 | | Ref i -> Xml.Element("Ref",["index",string_of_int i],[]) |
56 | 61 | | Cut t -> Xml.Element("Cut",[],[linear_term t]) |
57 | 62 | |
... | ... |
LCGparser/ENIAM_LCGchart.ml
... | ... | @@ -23,45 +23,53 @@ open Printf |
23 | 23 | (* open ENIAMtokenizerTypes |
24 | 24 | open ENIAMlexSemanticsTypes *) |
25 | 25 | |
26 | -let make size = Array.make_matrix (size+1) (size+1) ([],0) | |
26 | +let make size max_cost = | |
27 | + let a = Array.make_matrix (size+1) (size+1) [| |] in | |
28 | + Int.iter 0 size (fun i -> | |
29 | + Int.iter 0 size (fun j -> | |
30 | + a.(i).(j) <- Array.make (max_cost + 1) ([],0))); | |
31 | + a | |
27 | 32 | |
28 | 33 | let last_node chart = Array.length chart - 1 |
34 | +let max_cost chart = Array.length chart.(0).(0) - 1 | |
29 | 35 | |
30 | -let add chart i j v layer = | |
31 | - chart.(i).(j) <- [v],layer; | |
36 | +let add chart i j cost v layer = | |
37 | + chart.(i).(j).(cost) <- [v],layer; | |
32 | 38 | chart |
33 | 39 | |
34 | -let add_list chart i j l layer = | |
35 | - chart.(i).(j) <- l,layer; | |
40 | +let add_list chart i j cost l layer = | |
41 | + chart.(i).(j).(cost) <- l,layer; | |
36 | 42 | chart |
37 | 43 | |
38 | -let add_inc chart i j v layer = | |
39 | - let l,layer2 = chart.(i).(j) in | |
40 | - chart.(i).(j) <- v :: l, max layer layer2; | |
44 | +let add_inc chart i j cost v layer = | |
45 | + let l,layer2 = chart.(i).(j).(cost) in | |
46 | + chart.(i).(j).(cost) <- v :: l, max layer layer2; | |
41 | 47 | chart |
42 | 48 | |
43 | -let add_inc_list chart i j l layer = | |
44 | - let l2,layer2 = chart.(i).(j) in | |
45 | - chart.(i).(j) <- l @ l2, max layer layer2; | |
49 | +let add_inc_list chart i j cost l layer = | |
50 | + let l2,layer2 = chart.(i).(j).(cost) in | |
51 | + chart.(i).(j).(cost) <- l @ l2, max layer layer2; | |
46 | 52 | chart |
47 | 53 | |
48 | -let find chart i j = fst chart.(i).(j) | |
49 | -let layer chart i j = snd chart.(i).(j) | |
54 | +let find chart i j cost = fst chart.(i).(j).(cost) | |
55 | +let layer chart i j cost = snd chart.(i).(j).(cost) | |
50 | 56 | |
51 | 57 | let fold chart s f = |
52 | 58 | Int.fold 0 (last_node chart) s (fun s i -> |
53 | 59 | Int.fold 0 (last_node chart) s (fun s j -> |
54 | - let layer = layer chart i j in | |
55 | - Xlist.fold (find chart i j) s (fun s (symbol,sem) -> | |
56 | - f s (symbol,i,j,sem,layer)))) | |
60 | + Int.fold 0 (max_cost chart) s (fun s cost -> | |
61 | + let layer = layer chart i j cost in | |
62 | + Xlist.fold (find chart i j cost) s (fun s (symbol,sem) -> | |
63 | + f s (symbol,i,j,cost,sem,layer))))) | |
57 | 64 | |
58 | 65 | let rec find_paths_rec chart last i = |
59 | 66 | if i = last then [[]] else |
60 | 67 | Int.fold (i+1) last [] (fun paths j -> |
61 | - if chart.(i).(j) = [] then paths else | |
68 | + Int.fold 0 (max_cost chart) paths (fun paths cost -> | |
69 | + if find chart i j cost = [] then paths else | |
62 | 70 | let tails = find_paths_rec chart last j in |
63 | 71 | if Xlist.size tails > 1000000 then failwith "find_paths_rec: to many paths" else |
64 | - Xlist.fold tails paths (fun paths tail -> (chart.(i).(j) :: tail) :: paths)) | |
72 | + Xlist.fold tails paths (fun paths tail -> (find chart i j cost :: tail) :: paths))) | |
65 | 73 | |
66 | 74 | let find_paths chart = |
67 | 75 | let last = last_node chart - 1 in |
... | ... | @@ -70,16 +78,17 @@ let find_paths chart = |
70 | 78 | let get_no_entries chart = |
71 | 79 | Int.fold 0 (last_node chart) 0 (fun n i -> |
72 | 80 | Int.fold 0 (last_node chart) n (fun n j -> |
73 | - n + (Xlist.size (find chart i j)))) | |
81 | + Int.fold 0 (max_cost chart) n (fun n cost -> | |
82 | + n + (Xlist.size (find chart i j cost))))) | |
74 | 83 | |
75 | 84 | (* Pod referencją 0 będzie trzymany korzeń termu *) |
76 | 85 | let lazify chart = |
77 | - let new_chart = make (last_node chart) in | |
86 | + let new_chart = make (last_node chart) (max_cost chart) in | |
78 | 87 | let references = ExtArray.make (2 * last_node chart) Dot in |
79 | 88 | let _ = ExtArray.add references Dot in (* to jest potrzebne by na pozycji 0 umieścić korzeń termu *) |
80 | - let new_chart = fold chart new_chart (fun new_chart (symbol,i,j,sem,layer) -> | |
89 | + let new_chart = fold chart new_chart (fun new_chart (symbol,i,j,cost,sem,layer) -> | |
81 | 90 | let n = ExtArray.add references sem in |
82 | - add_inc new_chart i j (symbol,Ref n) layer) in | |
91 | + add_inc new_chart i j cost (symbol,Ref n) layer) in | |
83 | 92 | new_chart, references |
84 | 93 | |
85 | 94 | let rec dep_lazify_rec references (DepNode(id,left,l,right)) = |
... | ... | @@ -109,12 +118,13 @@ let merge_sems l = (* FIXME: dodać warianty *) |
109 | 118 | SymbolMap.fold map [] (fun l t (cost,sems) -> (cost,(t,ENIAM_LCGrules.make_variant sems)) :: l)*) |
110 | 119 | |
111 | 120 | let make_unique chart i j = |
112 | - let l,layer = chart.(i).(j) in | |
113 | - let l = merge_sems l in | |
114 | - chart.(i).(j) <- l, layer; | |
121 | + Int.iter 0 (max_cost chart) (fun cost -> | |
122 | + let l,layer = chart.(i).(j).(cost) in | |
123 | + let l = merge_sems l in | |
124 | + chart.(i).(j).(cost) <- l, layer); | |
115 | 125 | chart |
116 | 126 | |
117 | -let parse rules chart references timeout time_fun = | |
127 | +(*let parse rules chart references timeout time_fun = | |
118 | 128 | (* print_endline "parse 1"; *) |
119 | 129 | (* ENIAM_LCGrules.references := refs; |
120 | 130 | ENIAM_LCGrules.next_reference := next_ref; *) |
... | ... | @@ -138,38 +148,32 @@ let parse rules chart references timeout time_fun = |
138 | 148 | (* if Xlist.size l > 0 then Printf.printf "parse: %d-%d |l|=%d\n%!" i k (Xlist.size l); *) |
139 | 149 | make_unique (add_list chart i k l lay) i k))) in |
140 | 150 | (* print_endline "parse 2"; *) |
141 | - chart | |
151 | + chart*) | |
142 | 152 | |
143 | -(*let parse rules max_cost chart references timeout time_fun = | |
153 | +let parse rules chart references timeout time_fun = | |
144 | 154 | (* print_endline "parse 1"; *) |
145 | 155 | (* ENIAM_LCGrules.references := refs; |
146 | 156 | ENIAM_LCGrules.next_reference := next_ref; *) |
147 | 157 | let start_time = time_fun () in |
148 | 158 | let last_node = last_node chart in |
159 | + let max_cost = max_cost chart in | |
149 | 160 | let chart = Int.fold 2 last_node chart (fun chart len -> |
150 | 161 | Int.fold 0 (last_node - len) chart (fun chart i -> |
151 | 162 | let k = i + len in |
152 | 163 | Int.fold 1 (len - 1) chart (fun chart d -> |
153 | 164 | let time = time_fun () in |
154 | 165 | if time -. start_time > timeout then raise (Timeout(time -. start_time)) else |
155 | - let j = i + d in | |
156 | - let l,lay = Xlist.fold rules (find chart i k,layer chart i k) (fun (l,lay) (cost,rule) -> | |
157 | - let cost1,t1 = find chart i j in (* FIXME: tu trzeba dodać sortowanie po koszcie, co wymaga zastąpienia listy przez tablicę list w chart *) | |
158 | - let cost2,t2 = find chart j k in | |
159 | - if cost1 + cost2 + cost > max_cost then l,lay else | |
160 | - (Xlist.fold (rule references t1 t2) l (fun l t -> (cost1 + cost2 + cost, t) :: l), | |
161 | - max lay ((max (layer chart i j) (layer chart j k)) + 1))) in | |
162 | - (* print_int i; print_string " "; print_int j; print_string " "; print_int k; print_newline (); *) | |
163 | - (* let l = LCGreductions.merge_symbols l in *) | |
164 | - (* if Xlist.size l > 0 then Printf.printf "parse: %d-%d |l|=%d\n%!" i k (Xlist.size l); *) | |
165 | - (* if l = [] then chart else | |
166 | - let cost,l = Xlist.fold l (max_int,[]) (fun (min_cost,l) (cost,t) -> | |
167 | - if min_cost < cost then min_cost,l else | |
168 | - if min_cost > cost then cost,[t] else | |
169 | - cost, t :: l) in *) | |
170 | - make_unique (add_list chart i k l lay) i k))) in | |
171 | - (* print_endline "parse 2"; *) | |
172 | - chart*) | |
166 | + let j = i + d in | |
167 | + let chart (*l,lay*) = Xlist.fold rules chart(*find chart i k,layer chart i k*) (fun chart(*l,lay*) (cost,rule) -> | |
168 | + Int.fold 0 max_cost chart (fun chart cost1 -> | |
169 | + Int.fold 0 max_cost chart (fun chart cost2 -> | |
170 | + let t1 = find chart i j cost1 in | |
171 | + let t2 = find chart j k cost2 in | |
172 | + if cost1 + cost2 + cost > max_cost then chart(*l,lay*) else | |
173 | + add_inc_list chart i k (cost1 + cost2 + cost) (rule references t1 t2) | |
174 | + ((max (layer chart i j cost1) (layer chart j k cost2)) + 1)))) in | |
175 | + make_unique chart i k))) in | |
176 | + chart | |
173 | 177 | |
174 | 178 | let assign_not_parsed left right (t,sem) = |
175 | 179 | let sem = if left = [] then sem else (print_endline "assign_not_parsed: ni 1"; sem) in |
... | ... | @@ -224,16 +228,23 @@ let dep_parse dep_chart references timeout time_fun = |
224 | 228 | let parsed_dep_chart = dep_parse_rec references start_time timeout time_fun dep_chart in |
225 | 229 | parsed_dep_chart |
226 | 230 | |
227 | -let is_parsed chart = | |
231 | +let is_parsed_cost chart cost = | |
228 | 232 | let n = last_node chart in |
229 | - Xlist.fold (find chart 0 n) false (fun b -> function | |
233 | + Xlist.fold (find chart 0 n cost) false (fun b -> function | |
230 | 234 | Bracket(true,true,Tensor[Atom "<root>"]), _ -> true |
231 | 235 | (* | Bracket(true,true,Tensor[Atom "<ors-sentence>"]), _ -> true *) |
232 | 236 | | _ -> b) |
233 | -(* try | |
234 | - let _ = Xlist.assoc (find chart 0 n) (Bracket(true,true,Tensor[Atom "<sentence>"])) in (* FIXME: !!! *) | |
235 | - true | |
236 | - with Not_found -> false *) | |
237 | + | |
238 | +let is_parsed chart = | |
239 | + Int.fold 0 (max_cost chart) false (fun b cost -> | |
240 | + b || is_parsed_cost chart cost) | |
241 | + | |
242 | +let rec get_parsed_cost_rec chart cost = | |
243 | + if is_parsed_cost chart cost then cost else | |
244 | + get_parsed_cost_rec chart (cost+1) | |
245 | + | |
246 | +let get_parsed_cost chart = (* zakładam, że is_parsed chart = true *) | |
247 | + get_parsed_cost_rec chart 0 | |
237 | 248 | |
238 | 249 | let is_dep_parsed = function |
239 | 250 | [] -> false |
... | ... | @@ -244,7 +255,7 @@ let is_dep_parsed = function |
244 | 255 | |
245 | 256 | let get_parsed_term chart = |
246 | 257 | let n = last_node chart in |
247 | - let l = Xlist.fold (find chart 0 n) [] (fun l -> function | |
258 | + let l = Xlist.fold (find chart 0 n (get_parsed_cost chart)) [] (fun l -> function | |
248 | 259 | Bracket(true,true,Tensor[Atom "<root>"]), sem -> (Cut(Tuple[sem])) :: l |
249 | 260 | | Bracket(false,false,Imp(Tensor[Atom("<conll_root>")],Forward,Maybe _)) as t,sem-> |
250 | 261 | let sem = List.hd (ENIAM_LCGrules.deduce_optarg sem t) in |
... | ... | @@ -347,26 +358,27 @@ let merge chart references = |
347 | 358 | Int.iter 0 (n - 1) (fun i -> |
348 | 359 | let paths = select_best_paths a.(i) in |
349 | 360 | Int.iter i n (fun j -> |
350 | - let symbol_sem_list = find chart i j in | |
361 | + let symbol_sem_list = | |
362 | + Int.fold 0 (max_cost chart) [] (fun l cost -> (find chart i j cost) @ l) in | |
351 | 363 | if symbol_sem_list <> [] then a.(j) <- merge_paths paths (select_best_symbol references symbol_sem_list) :: a.(j))); |
352 | 364 | (* print_endline "merge 2"; *) |
353 | 365 | let paths = select_best_paths a.(n) in |
354 | 366 | (* print_endline "merge 3"; *) |
355 | - add_inc chart 0 n (make_root_symbol paths) 0 | |
367 | + add_inc chart 0 n 0 (make_root_symbol paths) 0 | |
356 | 368 | |
357 | 369 | let select_maximal chart = |
358 | 370 | let last = last_node chart in |
359 | 371 | let a = Array.make last (-1,[],-1) in |
360 | - let _ = fold chart () (fun chart (symbol,i,j,sem,layer) -> | |
372 | + let _ = fold chart () (fun chart (symbol,i,j,cost,sem,layer) -> | |
361 | 373 | let j0,l,_ = a.(i) in |
362 | 374 | if j > j0 then a.(i) <- j,[symbol,sem],layer else |
363 | 375 | if j < j0 then () else |
364 | 376 | a.(i) <- j,(symbol,sem) :: l,layer) in |
365 | - let chart = make last in | |
377 | + let chart = make last 0 in | |
366 | 378 | snd (Int.fold 0 (last-1) (-1,chart) (fun (j0,chart) i -> |
367 | 379 | let j,l,layer = a.(i) in |
368 | 380 | if j <= j0 then j0,chart else |
369 | - j,add_list chart i j l layer)) | |
381 | + j,add_list chart i j 0 l layer)) | |
370 | 382 | |
371 | 383 | (*FIXME: Bębni na maszynie do pisania. |
372 | 384 | Na myśl o czym brykasz?*) |
... | ... |
LCGparser/ENIAM_LCGgraphOf.ml
... | ... | @@ -70,7 +70,7 @@ let rec print_dependency_tree_rec file edge upper id = function |
70 | 70 | | t -> failwith ("print_dependency_tree_rec: " ^ ENIAM_LCGstringOf.linear_term 0 t) |
71 | 71 | |
72 | 72 | and print_dependency_tree_rec2 file edge upper = function |
73 | - Tuple l -> Xlist.iter l (print_dependency_tree_rec2 file edge upper) | |
73 | + Tuple l -> Xlist.iter (List.rev l) (print_dependency_tree_rec2 file edge upper) | |
74 | 74 | | t -> print_dependency_tree_rec file edge upper (get_single_rel_id ()) t |
75 | 75 | |
76 | 76 | let print_dependency_tree path name dependency_tree = |
... | ... | @@ -86,7 +86,7 @@ let print_dependency_tree path name dependency_tree = |
86 | 86 | Sys.chdir dir |
87 | 87 | |
88 | 88 | let rec print_simplified_dependency_tree_rec2 file edge upper = function |
89 | - Tuple l -> Xlist.iter l (print_simplified_dependency_tree_rec2 file edge upper) | |
89 | + Tuple l -> Xlist.iter (List.rev l) (print_simplified_dependency_tree_rec2 file edge upper) | |
90 | 90 | | Variant(e,l) -> |
91 | 91 | fprintf file " %s [shape=diamond]\n" e; |
92 | 92 | print_edge file edge upper e; |
... | ... |
LCGparser/ENIAM_LCGlatexOf.ml
... | ... | @@ -51,7 +51,7 @@ let rec linear_term c = function |
51 | 51 | (* | LetIn(l,s,t) -> "{\\bf let } " ^ String.concat "\\otimes " (Xlist.map l variable) ^ " = " ^ (linear_term 0 s) ^ " \\text{ {\\bf in }} " ^ (linear_term 0 t) *) |
52 | 52 | | Variant(e,l) -> "\\langle " ^ String.concat ","(*"$,\\\\$"*) (Xlist.map l (fun (i,t) -> e^i^": "^linear_term 0 t)) ^ "\\rangle" |
53 | 53 | | VariantVar(v,t) -> "\\langle " ^ linear_term 0 t ^ "\\rangle_\\text{" ^ v ^ "}" |
54 | - (* | Proj(n,t) -> "\\pi_" ^ (string_of_int n) ^ (linear_term c t) *) | |
54 | + | Proj(n,t) -> "\\pi_" ^ (string_of_int n) ^ (linear_term c t) | |
55 | 55 | | ProjVar(v,t) -> "\\pi_{" ^ variable v ^ "}" ^ (linear_term c t) |
56 | 56 | | SubstVar v -> variable v |
57 | 57 | | Subst(s,v,t) -> "{\\bf subst}(" ^ (linear_term 0 s) ^ "," ^ variable v ^ "," ^ (linear_term 0 t) ^ ")" |
... | ... | @@ -77,6 +77,10 @@ let rec linear_term c = function |
77 | 77 | "\\text{" ^ (Xlatex.escape_string e) ^ "} & " ^ (linear_term 0 t)))) ^ "\\end{array}\\right]}" |
78 | 78 | (* | Morf m -> "\\text{" ^ Xlatex.escape_string (ENIAMwalStringOf.morf m) ^ "}" |
79 | 79 | | Gf s -> "\\text{" ^ Xlatex.escape_string (ENIAMwalStringOf.gf s) ^ "}" *) |
80 | + | Coord(l,t,a) -> "[" ^ String.concat "; " (Xlist.map l (linear_term 0)) ^ "]_{" ^ linear_term 0 t ^ "," ^ linear_term 0 a ^ "}" | |
81 | + | AddCoord(s,t) -> "{\\bf add}(" ^ linear_term 0 s ^ "," ^ linear_term 0 t ^ ")" | |
82 | + | MapCoord(s,t) -> "{\\bf map}(" ^ linear_term 0 s ^ "," ^ linear_term 0 t ^ ")" | |
83 | + | ConcatCoord(s,t) -> "{\\bf concat}(" ^ linear_term 0 s ^ "," ^ linear_term 0 t ^ ")" | |
80 | 84 | | Ref i -> "{\\bf ref}\\; " ^ string_of_int i |
81 | 85 | | Cut t -> "{\\bf cut}(" ^ linear_term 0 t ^ ")" |
82 | 86 | (* | Choice(e,i,t) -> "{\\bf choice}(" ^ e ^ String.concat "" i ^ "," ^ linear_term 0 t ^ ")" *) |
... | ... | @@ -111,7 +115,7 @@ let rec linear_term_simple c = function |
111 | 115 | (* | Triple(t1,t2,t3) -> "\\{" ^ linear_term_simple 0 t1 ^ "," ^ linear_term_simple 0 t2 ^ "," ^ linear_term_simple 0 t3 ^ "\\}" *) |
112 | 116 | | Variant(e,l) -> "\\langle " ^ String.concat "," (Xlist.map l (fun (i,t) -> e^i^": "^linear_term_simple 0 t)) ^ "\\rangle" |
113 | 117 | | VariantVar(v,t) -> "\\langle " ^ linear_term_simple 0 t ^ "\\rangle_\\text{" ^ v ^ "}" |
114 | - (* | Proj(n,t) -> "\\pi_" ^ (string_of_int n) ^ (linear_term_simple c t) *) | |
118 | + | Proj(n,t) -> "\\pi_" ^ (string_of_int n) ^ (linear_term_simple c t) | |
115 | 119 | | ProjVar(v,t) -> "\\pi_{" ^ variable v ^ "}" ^ (linear_term_simple c t) |
116 | 120 | | SubstVar v -> variable v |
117 | 121 | | Subst(s,v,t) -> "{\\bf subst}(" ^ (linear_term_simple 0 s) ^ "," ^ variable v ^ "," ^ (linear_term_simple 0 t) ^ ")" |
... | ... | @@ -132,6 +136,10 @@ let rec linear_term_simple c = function |
132 | 136 | | Node _ -> "node" |
133 | 137 | (* | Morf m -> "\\text{" ^ Xlatex.escape_string (ENIAMwalStringOf.morf m) ^ "}" |
134 | 138 | | Gf s -> "\\text{" ^ Xlatex.escape_string (ENIAMwalStringOf.gf s) ^ "}" *) |
139 | + | Coord(l,t,a) -> "[" ^ String.concat "; " (Xlist.map l (linear_term 0)) ^ "]_{" ^ linear_term 0 t ^ "," ^ linear_term 0 a ^ "}" | |
140 | + | AddCoord(s,t) -> "{\\bf add}(" ^ linear_term 0 s ^ "," ^ linear_term 0 t ^ ")" | |
141 | + | MapCoord(s,t) -> "{\\bf map}(" ^ linear_term 0 s ^ "," ^ linear_term 0 t ^ ")" | |
142 | + | ConcatCoord(s,t) -> "{\\bf concat}(" ^ linear_term 0 s ^ "," ^ linear_term 0 t ^ ")" | |
135 | 143 | | Ref i -> "{\\bf ref}\\; " ^ string_of_int i |
136 | 144 | | Cut t -> "{\\bf cut}(" ^ linear_term_simple 0 t ^ ")" |
137 | 145 | (* | Choice(e,i,t) -> "{\\bf choice}(" ^ e ^ String.concat "" i ^ "," ^ linear_term_simple 0 t ^ ")" *) |
... | ... | @@ -190,21 +198,27 @@ let rec grammar_symbol c = function |
190 | 198 | | Plus l -> |
191 | 199 | let s = String.concat "\\oplus" (Xlist.map l (grammar_symbol 2)) in |
192 | 200 | if c > 1 then "(" ^ s ^ ")" else s |
201 | + | StarWith l -> | |
202 | + let s = String.concat "\\with" (Xlist.map l (grammar_symbol 2)) in | |
203 | + if c > 1 then "(" ^ s ^ ")" else s | |
193 | 204 | | Imp(s,d,t) -> "(" ^ (grammar_symbol 2 s) ^ "\\\\ \\hspace{1cm}" ^ direction d ^ (grammar_symbol 2 t) ^ ")" |
194 | 205 | | One -> "1" |
195 | 206 | | ImpSet(s,l) -> |
196 | 207 | let s = (grammar_symbol 1 s) ^ "\\{" ^ String.concat "\n," (Xlist.map l (fun (d,a) -> "\\\\ \\hspace{1cm}" ^ direction d ^ grammar_symbol 1 a)) ^ "\\}" in |
197 | 208 | if c > 0 then "(" ^ s ^ ")" else s |
198 | 209 | | WithVar(v,s,e,t) -> "\\bigwith_{" ^ e ^ ":" ^ v ^ ":=" ^ (internal_grammar_symbol 2 s) ^ "} \\\\ " ^ (grammar_symbol 2 t) |
199 | - | Star s -> grammar_symbol 2 s ^ "^\\star" | |
210 | + (* | Star(s,t) -> grammar_symbol 2 s ^ "^\\star" ^ grammar_symbol 2 t *) | |
211 | + | Star(s,t) -> "\\star" ^ grammar_symbol 2 t | |
212 | + | Conj s -> "{\\bf conj}(" ^ grammar_symbol 2 s ^ ")" | |
213 | + | Preconj -> "{\\bf preconj}" | |
200 | 214 | | Bracket(lf,rf,s) -> "\\langle " ^ (if lf then "\\langle " else "") ^ (grammar_symbol 0 s) ^ "\\rangle" ^ (if rf then "\\rangle " else "") |
201 | 215 | | BracketSet d -> "{\\bf BracketSet}(" ^ direction d ^ ")" |
202 | 216 | | Maybe s -> "?" ^ grammar_symbol 2 s |
203 | 217 | |
204 | 218 | let chart page text_fragments g = |
205 | - let layers = ENIAM_LCGchart.fold g IntMap.empty (fun layers (symbol,node1,node2,sem,layer) -> | |
219 | + let layers = ENIAM_LCGchart.fold g IntMap.empty (fun layers (symbol,node1,node2,cost,sem,layer) -> | |
206 | 220 | let nodes = try IntMap.find layers layer with Not_found -> IntMap.empty in |
207 | - let content = node2, grammar_symbol 0 symbol, linear_term 0 sem in | |
221 | + let content = node2, cost, grammar_symbol 0 symbol, linear_term 0 sem in | |
208 | 222 | (* let nodes = IntMap.add_inc nodes node1 (node2,[content]) (fun (n,l) -> if n <> node2 then failwith "to_latex" else n, content :: l) in *) |
209 | 223 | let nodes = IntMap.add_inc nodes node1 [content] (fun l -> content :: l) in |
210 | 224 | IntMap.add layers layer nodes) in |
... | ... | @@ -212,17 +226,17 @@ let chart page text_fragments g = |
212 | 226 | "\\begin{longtable}{|l|l|l|l|p{" ^ n ^ "cm}|}\n\\hline\n" ^ |
213 | 227 | String.concat "" (List.rev (IntMap.fold layers [] (fun l layer nodes -> |
214 | 228 | IntMap.fold nodes l (fun l node1 contents -> |
215 | - Xlist.fold contents l (fun l (node2,symbol,sem) -> | |
216 | - let s = try IntMap.find text_fragments.(node1) node2 with Not_found -> failwith (Printf.sprintf "chart: text_fragment not found %d-%d" node1 node2) in | |
217 | - (Printf.sprintf "%d & %d--%d & %s & $\\begin{array}{l}%s\\end{array}$ & $%s$\\\\\n\\hline\n" layer node1 node2 s symbol sem) :: l))))) ^ | |
229 | + Xlist.fold contents l (fun l (node2,cost,symbol,sem) -> | |
230 | + let s = try Xlatex.escape_string (IntMap.find text_fragments.(node1) node2) with Not_found -> failwith (Printf.sprintf "chart: text_fragment not found %d-%d" node1 node2) in | |
231 | + (Printf.sprintf "%d & %d--%d %d & %s & $\\begin{array}{l}%s\\end{array}$ & $%s$\\\\\n\\hline\n" layer node1 node2 cost s symbol sem) :: l))))) ^ | |
218 | 232 | "\\end{longtable}" |
219 | 233 | |
220 | 234 | let chart2 page text_fragments g = |
221 | 235 | let n = match page with "a4" -> "4" | "a1" -> "10" | _ -> "6" in |
222 | 236 | "\\begin{longtable}{|l|p{" ^ n ^ "cm}|l|}\n\\hline\n" ^ |
223 | - String.concat "" (List.rev (ENIAM_LCGchart.fold g [] (fun l (symbol,node1,node2,sem,layer) -> | |
224 | - let s = try IntMap.find text_fragments.(node1) node2 with Not_found -> failwith (Printf.sprintf "chart: text_fragment not found %d-%d" node1 node2) in | |
225 | - (Printf.sprintf "%d--%d & %s & $\\begin{array}{l}%s\\end{array}$\\\\\n\\hline\n" node1 node2 s (grammar_symbol 0 symbol)) :: l))) ^ | |
237 | + String.concat "" (List.rev (ENIAM_LCGchart.fold g [] (fun l (symbol,node1,node2,cost,sem,layer) -> | |
238 | + let s = try Xlatex.escape_string (IntMap.find text_fragments.(node1) node2) with Not_found -> failwith (Printf.sprintf "chart: text_fragment not found %d-%d" node1 node2) in | |
239 | + (Printf.sprintf "%d--%d %d & %s & $\\begin{array}{l}%s\\end{array}$\\\\\n\\hline\n" node1 node2 cost s (grammar_symbol 0 symbol)) :: l))) ^ | |
226 | 240 | "\\end{longtable}" |
227 | 241 | |
228 | 242 | let print_chart path name page text_fragments g = |
... | ... |
LCGparser/ENIAM_LCGreductions.ml
... | ... | @@ -135,6 +135,7 @@ let linear_term_beta_reduction4 references = |
135 | 135 | let t = Cut(Ref !next_ref) in |
136 | 136 | incr next_ref; |
137 | 137 | t) |
138 | + | Tuple l -> Tuple(List.rev (Xlist.rev_map l create_cut_refs)) | |
138 | 139 | | Variant(e,l) -> Variant(e,Xlist.map l (fun (i,t) -> i,create_cut_refs t)) |
139 | 140 | | Dot -> Dot |
140 | 141 | | _ -> failwith "create_cut_refs" in |
... | ... | @@ -149,6 +150,10 @@ let linear_term_beta_reduction4 references = |
149 | 150 | | l -> Tuple(List.rev l)) |
150 | 151 | | Variant(e,l) -> Variant(e,Xlist.map l (fun (i,t) -> i,linear_term_beta_reduction subst t)) |
151 | 152 | | VariantVar(v,t) -> VariantVar(v, linear_term_beta_reduction subst t) |
153 | + | Proj(n,t) -> | |
154 | + (match linear_term_beta_reduction subst t with | |
155 | + Variant(e,l) -> if Xlist.size l < n then Proj(n,(Variant(e,l))) else snd (List.nth l (n-1)) | |
156 | + | t2 -> Proj(n,t2)) | |
152 | 157 | | ProjVar(v,t) -> |
153 | 158 | (match linear_term_beta_reduction subst t with |
154 | 159 | VariantVar(v2,t2) -> if v = v2 then t2 else ProjVar(v,VariantVar(v2,t2)) |
... | ... | @@ -232,6 +237,7 @@ let linear_term_beta_reduction4 references = |
232 | 237 | | "ARG_DIR",Val dir -> Node{t with arg_dir=dir} |
233 | 238 | | _ -> Node{t with attrs=(e,linear_term_beta_reduction subst s) :: t.attrs}) |
234 | 239 | | Variant(e2,l) -> Variant(e2,Xlist.map l (fun (i,t) -> i,linear_term_beta_reduction subst (SetAttr(e,s,t)))) |
240 | + | Inj(i,t) -> Inj(i,linear_term_beta_reduction subst (SetAttr(e,s,t))) | |
235 | 241 | | t -> SetAttr(e,s,t)) |
236 | 242 | (* | Choice(e,i,t) -> Choice(e,i,linear_term_beta_reduction subst t) *) |
237 | 243 | | Node t -> |
... | ... | @@ -242,6 +248,30 @@ let linear_term_beta_reduction4 references = |
242 | 248 | symbol=linear_term_beta_reduction subst t.symbol; |
243 | 249 | (* arg_symbol=linear_term_beta_reduction subst t.arg_symbol; *) |
244 | 250 | args=linear_term_beta_reduction subst t.args} |
251 | + | Coord(l,t,s) -> Coord(List.rev (Xlist.rev_map l (linear_term_beta_reduction subst)), linear_term_beta_reduction subst t, linear_term_beta_reduction subst s) | |
252 | + | AddCoord(s,t) -> | |
253 | + let s = linear_term_beta_reduction subst s in | |
254 | + (match linear_term_beta_reduction subst t with | |
255 | + Coord(l,t,a) -> Coord(s :: l,t,a) | |
256 | + | Variant(e,l) -> Variant(e,List.rev (Xlist.rev_map l (fun (i,t) -> | |
257 | + i,linear_term_beta_reduction subst (AddCoord(s,t))))) | |
258 | + | t -> AddCoord(s,t)) | |
259 | + | MapCoord(s,t) -> | |
260 | + let t = linear_term_beta_reduction subst t in | |
261 | + (match linear_term_beta_reduction subst s with | |
262 | + Coord(l,c,a) -> Coord(List.rev (Xlist.rev_map l (fun s -> | |
263 | + linear_term_beta_reduction subst (App(t,s)))),c,a) | |
264 | + | Variant(e,l) -> Variant(e,List.rev (Xlist.rev_map l (fun (i,s) -> | |
265 | + i,linear_term_beta_reduction subst (MapCoord(s,t))))) | |
266 | + | s -> MapCoord(s,t)) | |
267 | + | ConcatCoord(s,t) -> | |
268 | + (match linear_term_beta_reduction subst t with | |
269 | + Coord(l,c,a) -> | |
270 | + let l,_ = Xlist.fold l ([],1) (fun (l,n) t -> App(a,SetAttr("COORD_ARG",Val (string_of_int n),t)) :: l, n+1) in | |
271 | + linear_term_beta_reduction subst (App(App(s,c),Tuple(List.rev l))) | |
272 | + | Variant(e,l) -> Variant(e,List.rev (Xlist.rev_map l (fun (i,t) -> | |
273 | + i,linear_term_beta_reduction subst (ConcatCoord(s,t))))) | |
274 | + | t -> ConcatCoord(s,t)) | |
245 | 275 | (* | Morf m -> Morf m |
246 | 276 | | Gf s -> Gf s |
247 | 277 | | Choice _ -> failwith "linear_term_beta_reduction" |
... | ... | @@ -386,7 +416,7 @@ let rec is_dependant dependants = function |
386 | 416 | let rec select_variant_rec e i = function |
387 | 417 | Variant(e2,l) -> |
388 | 418 | if e = e2 then |
389 | - let t = try Xlist.assoc l i with Not_found -> failwith "select_variant_rec" in | |
419 | + let t = try Xlist.assoc l i with Not_found -> failwith ("select_variant_rec: '" ^ e ^ "'") in | |
390 | 420 | select_variant_rec e i t |
391 | 421 | else |
392 | 422 | Variant(e2,List.rev (Xlist.rev_map l (fun (i2,t) -> |
... | ... | @@ -511,7 +541,7 @@ let validate_dependency_tree dependency_tree = |
511 | 541 | let labels = StringMap.fold labels [] (fun labels e (n,_) -> |
512 | 542 | if n > 1 then e :: labels else labels) in |
513 | 543 | if labels <> [] then |
514 | - failwith ("validate_dependency_tree: multiple labels " ^ String.concat " " labels) else | |
544 | + (*failwith ("validate_dependency_tree: multiple labels " ^ String.concat " " labels)*)() else (* FIXME: trzeba zreimplementować obsługę wielokrotnych etykiet *) | |
515 | 545 | (* let _ = Int.fold 0 (Array.length dependency_tree - 1) StringSet.empty (fun labels i -> |
516 | 546 | match dependency_tree.(i) with |
517 | 547 | Node t -> |
... | ... |
LCGparser/ENIAM_LCGrenderer.ml
... | ... | @@ -29,11 +29,14 @@ let rec internal_substitute var_name t = function |
29 | 29 | let rec substitute var_name t = function |
30 | 30 | | Tensor l -> Tensor (Xlist.map l (internal_substitute var_name t)) |
31 | 31 | | Plus l -> Plus (Xlist.map l (substitute var_name t)) |
32 | + | StarWith l -> StarWith (Xlist.map l (substitute var_name t)) | |
32 | 33 | | Imp(s,d,t2) -> Imp(substitute var_name t s,d,substitute var_name t t2) |
33 | 34 | | One -> One |
34 | 35 | | ImpSet(s,l) -> ImpSet(substitute var_name t s, Xlist.map l (fun (d,s) -> d, substitute var_name t s)) |
35 | 36 | | WithVar(v,g,e,s) -> if v = var_name then WithVar(v,g,e,s) else WithVar(v,internal_substitute var_name t g,e,substitute var_name t s) |
36 | - | Star s -> Star (substitute var_name t s) | |
37 | + | Star(s,s2) -> Star(substitute var_name t s,substitute var_name t s2) | |
38 | + | Conj s -> Conj(substitute var_name t s) | |
39 | + | Preconj -> Preconj | |
37 | 40 | | Bracket(lf,rf,s) -> Bracket(lf,rf,substitute var_name t s) |
38 | 41 | | BracketSet d -> BracketSet d |
39 | 42 | | Maybe s -> Maybe (substitute var_name t s) |
... | ... | @@ -41,13 +44,16 @@ let rec substitute var_name t = function |
41 | 44 | let rec substitute_schema var_name t = function |
42 | 45 | | Tensor l -> Tensor l |
43 | 46 | | Plus l -> Plus (Xlist.map l (substitute_schema var_name t)) |
47 | + | StarWith l -> StarWith (Xlist.map l (substitute_schema var_name t)) | |
44 | 48 | | Imp(s,d,t2) -> Imp(substitute_schema var_name t s,d,substitute_schema var_name t t2) |
45 | 49 | | One -> One |
46 | 50 | | ImpSet(s,l) -> ImpSet(substitute_schema var_name t s, List.flatten (Xlist.map l (function |
47 | - Both,Tensor[AVar var_name] -> t | |
51 | + Both,Tensor[AVar var_name2] -> if var_name = var_name2 then t else [Both,Tensor[AVar var_name2]] | |
48 | 52 | | d,s -> [d, substitute_schema var_name t s]))) |
49 | 53 | | WithVar(v,g,e,s) -> WithVar(v,g,e,substitute_schema var_name t s) |
50 | - | Star s -> Star (substitute_schema var_name t s) | |
54 | + | Star(s,s2) -> Star(substitute_schema var_name t s,substitute_schema var_name t s2) | |
55 | + | Conj s -> Conj (substitute_schema var_name t s) | |
56 | + | Preconj -> Preconj | |
51 | 57 | | Bracket(lf,rf,s) -> Bracket(lf,rf,substitute_schema var_name t s) |
52 | 58 | | BracketSet d -> BracketSet d |
53 | 59 | | Maybe s -> Maybe (substitute_schema var_name t s) |
... | ... | @@ -62,11 +68,14 @@ let rec internal_count_avar var_name = function |
62 | 68 | let rec count_avar var_name = function |
63 | 69 | | Tensor l -> Xlist.fold l 0 (fun b t -> internal_count_avar var_name t + b) |
64 | 70 | | Plus l -> Xlist.fold l 0 (fun b t -> count_avar var_name t + b) |
71 | + | StarWith l -> Xlist.fold l 0 (fun b t -> count_avar var_name t + b) | |
65 | 72 | | Imp(s,d,t2) -> count_avar var_name s + count_avar var_name t2 |
66 | 73 | | One -> 0 |
67 | 74 | | ImpSet(s,l) -> count_avar var_name s + Xlist.fold l 0 (fun b (_,t) -> count_avar var_name t + b) |
68 | 75 | | WithVar(v,g,e,s) -> if v = var_name then 0 else count_avar var_name s + internal_count_avar var_name g |
69 | - | Star t -> count_avar var_name t | |
76 | + | Star(t,t2) -> count_avar var_name t + count_avar var_name t2 | |
77 | + | Conj t -> count_avar var_name t | |
78 | + | Preconj -> 0 | |
70 | 79 | | Bracket(lf,rf,s) -> count_avar var_name s |
71 | 80 | | BracketSet _ -> 0 |
72 | 81 | | Maybe t -> count_avar var_name t |
... | ... | @@ -190,9 +199,26 @@ let rec make_term_imp node outer_node = function |
190 | 199 | | Tensor l -> Node node |
191 | 200 | | _ -> failwith "make_term_imp" |
192 | 201 | |
202 | +let rec make_term_withvar_conj node outer_node = function | |
203 | + WithVar(category,_,_,t) -> | |
204 | + let a,b = make_term_withvar_conj node outer_node t in | |
205 | + VariantVar(category,a),b | |
206 | + | Imp(s,d,t2) -> | |
207 | + (* if is_raised [d,t2] then make_raised_term_imp (Node node) outer_node Dot Both (Imp(s,d,t2)) else *) | |
208 | + let v,arg = make_term_arg d t2 in | |
209 | + let x = ENIAM_LCGrules.get_new_variable () in | |
210 | + Lambda(x,make_term_imp (add_args node [Var x]) outer_node s),Lambda(v,arg) | |
211 | + | t -> failwith "make_term_withvar_conj" | |
212 | + | |
193 | 213 | let rec make_term_withvar node outer_node = function |
194 | 214 | WithVar(category,_,_,t) -> VariantVar(category,make_term_withvar node outer_node t) |
195 | 215 | | Bracket(_,_,t) -> make_term_withvar node outer_node t |
216 | + | Conj t -> | |
217 | + let x1 = ENIAM_LCGrules.get_new_variable () in | |
218 | + let x2 = ENIAM_LCGrules.get_new_variable () in | |
219 | + let a,b = make_term_withvar_conj node outer_node t in | |
220 | + Lambda(x1,Lambda(x2,Coord([Inj(1,Var x2);Inj(2,Var x1)],a,b))) | |
221 | + | Preconj -> Dot | |
196 | 222 | | t -> make_term_imp node outer_node t |
197 | 223 | |
198 | 224 | let make_term node = make_term_withvar node empty_node |
... | ... | @@ -205,11 +231,14 @@ let rec make_symbol = function |
205 | 231 | | Top -> Val "T" |
206 | 232 | | _ -> failwith "make_symbol")) |
207 | 233 | | Plus l -> failwith "make_symbol" |
234 | + | StarWith _ -> failwith "make_symbol" | |
208 | 235 | | Imp(s,d,t2) -> make_symbol s |
209 | 236 | | One -> failwith "make_symbol" |
210 | 237 | | ImpSet(s,l) -> make_symbol s |
211 | 238 | | WithVar(v,g,e,s) -> make_symbol s |
212 | - | Star t -> failwith "make_symbol" | |
239 | + | Star _ -> failwith "make_symbol" | |
240 | + | Conj s -> make_symbol s | |
241 | + | Preconj -> Val "preconj" | |
213 | 242 | | Bracket(lf,rf,s) -> make_symbol s |
214 | 243 | | BracketSet _ -> failwith "make_symbol" |
215 | 244 | | Maybe t -> failwith "make_symbol" |
... | ... | @@ -237,11 +266,14 @@ let make_raised_symbol_arg = function |
237 | 266 | let rec make_raised_symbol = function |
238 | 267 | | Tensor l -> failwith "make_raised_symbol" |
239 | 268 | | Plus l -> failwith "make_raised_symbol" |
269 | + | StarWith _ -> failwith "make_raised_symbol" | |
240 | 270 | | Imp(s,d,t2) -> if is_raised [d,t2] then make_raised_symbol_arg [d,t2] else make_raised_symbol s |
241 | 271 | | One -> failwith "make_raised_symbol" |
242 | 272 | | ImpSet(s,l) -> if is_raised l then make_raised_symbol_arg l else make_raised_symbol s |
243 | 273 | | WithVar(v,g,e,s) -> make_raised_symbol s |
244 | - | Star t -> failwith "make_raised_symbol" | |
274 | + | Star _ -> failwith "make_raised_symbol" | |
275 | + | Conj _ -> failwith "make_raised_symbol" | |
276 | + | Preconj -> failwith "make_raised_symbol" | |
245 | 277 | | Bracket(lf,rf,s) -> make_raised_symbol s |
246 | 278 | | BracketSet _ -> failwith "make_raised_symbol" |
247 | 279 | | Maybe t -> failwith "make_raised_symbol" |
... | ... | @@ -266,11 +298,14 @@ let make_quant_restriction = function |
266 | 298 | let rec count_req_args2 = function |
267 | 299 | Tensor l -> 1 |
268 | 300 | | Plus l -> Xlist.fold l max_int (fun min_args t -> min min_args (count_req_args2 t)) |
301 | + | StarWith l -> Xlist.fold l max_int (fun min_args t -> min min_args (count_req_args2 t)) | |
269 | 302 | | Imp(s,d,t2) -> 100 |
270 | 303 | | One -> 0 |
271 | 304 | | ImpSet(s,l) -> 100 |
272 | 305 | | WithVar(v,g,e,s) -> count_req_args2 s |
273 | - | Star t -> count_req_args2 t | |
306 | + | Star(t,t2) -> count_req_args2 t + count_req_args2 t2 | |
307 | + | Conj t -> count_req_args2 t | |
308 | + | Preconj -> 0 | |
274 | 309 | | Bracket(lf,rf,s) -> count_req_args2 s |
275 | 310 | | BracketSet _ -> 10000 |
276 | 311 | | Maybe t -> 0 |
... | ... | @@ -284,12 +319,16 @@ let rec count_req_args = function |
284 | 319 | | Tensor[Atom "<squery>"] -> 0 |
285 | 320 | | Tensor[Atom s] when String.get s 0 = '<' -> 1000 |
286 | 321 | | Tensor l -> 0 |
287 | - | Plus l -> failwith "count_req_args" | |
322 | + | Plus l -> Xlist.fold l max_int (fun min_args t -> min min_args (count_req_args t)) (* FIXME: kiedy ta funkcja jest odpalana??*) | |
323 | + | StarWith l -> Xlist.fold l max_int (fun min_args t -> min min_args (count_req_args t)) | |
324 | + (* | Plus l -> failwith "count_req_args" *) | |
288 | 325 | | Imp(s,d,t2) -> count_req_args2 t2 + count_req_args s |
289 | 326 | | One -> 0 |
290 | 327 | | ImpSet(s,l) -> Xlist.fold l 0 (fun n (_,t) -> n + count_req_args2 t) + count_req_args s |
291 | 328 | | WithVar(v,g,e,s) -> count_req_args s |
292 | - | Star t -> count_req_args t | |
329 | + | Star(t,t2) -> count_req_args t + count_req_args t2 | |
330 | + | Conj t -> count_req_args t | |
331 | + | Preconj -> 0 | |
293 | 332 | | Bracket(lf,rf,s) -> count_req_args s |
294 | 333 | | BracketSet _ -> 1000 |
295 | 334 | | Maybe t -> failwith "count_req_args" |
... | ... | @@ -298,11 +337,14 @@ let rec get_arg_symbol = function |
298 | 337 | Tensor l -> Tensor l |
299 | 338 | | Plus [] -> failwith "get_arg_symbol" |
300 | 339 | | Plus l -> if count_req_args2 (Plus l) = 0 then One else get_arg_symbol (List.hd l) |
340 | + | StarWith _ -> failwith "get_arg_symbol" | |
301 | 341 | | Imp(t,d,t2) -> Imp(t,d,t2) |
302 | 342 | | One -> One |
303 | 343 | | ImpSet(t,l) -> failwith "get_arg_symbol" |
304 | 344 | | WithVar(v,g,e,s) -> failwith "get_arg_symbol" |
305 | - | Star t -> failwith "get_arg_symbol" | |
345 | + | Star _ -> failwith "get_arg_symbol" | |
346 | + | Conj t -> failwith "get_arg_symbol" | |
347 | + | Preconj -> failwith "get_arg_symbol" | |
306 | 348 | | Bracket(lf,rf,s) -> failwith "get_arg_symbol" |
307 | 349 | | BracketSet t -> failwith "get_arg_symbol" |
308 | 350 | | Maybe t -> One |
... | ... | @@ -331,6 +373,7 @@ let rec apply_args references fv = function |
331 | 373 | Tensor l,s -> Tensor l,SetAttr("ARG_DIR",Val "both", |
332 | 374 | SetAttr("ARG_SYMBOL",Tuple[Val "fragment"],s)) |
333 | 375 | | Plus l, _ -> failwith ("apply_args: " ^ ENIAM_LCGstringOf.grammar_symbol_prime (Plus l)) |
376 | + | StarWith l, _ -> failwith ("apply_args: " ^ ENIAM_LCGstringOf.grammar_symbol_prime (StarWith l)) | |
334 | 377 | | Imp(t,d,t2), s -> apply_args references fv (t, apply_arg fv s t2) |
335 | 378 | | One, s -> One, s |
336 | 379 | | ImpSet(t,l),s -> apply_args references fv (t, apply_arg_list fv s l) |
... | ... | @@ -342,7 +385,9 @@ let rec apply_args references fv = function |
342 | 385 | let s,t = apply_args references fv (WithVar(v,g,e,s),t) in |
343 | 386 | s, (i,t) :: l) in |
344 | 387 | s, Variant(e2,List.rev l)*) |
345 | - | Star t, s -> failwith ("apply_args: " ^ ENIAM_LCGstringOf.grammar_symbol_prime (Star t)) | |
388 | + | Star(t,t2), s -> failwith ("apply_args: " ^ ENIAM_LCGstringOf.grammar_symbol_prime (Star(t,t2))) | |
389 | + | Conj t, s -> failwith ("apply_args: " ^ ENIAM_LCGstringOf.grammar_symbol_prime (Conj t)) | |
390 | + | Preconj, s -> failwith ("apply_args: " ^ ENIAM_LCGstringOf.grammar_symbol_prime Preconj) | |
346 | 391 | | Bracket(lf,rf,s),t -> let s,t = apply_args references fv (s,t) in Bracket(lf,rf,s),t |
347 | 392 | | BracketSet t, s -> BracketSet t, s |
348 | 393 | | Maybe t, _ -> failwith ("apply_args: " ^ ENIAM_LCGstringOf.grammar_symbol_prime (Maybe t)) |
... | ... |
LCGparser/ENIAM_LCGrules.ml
... | ... | @@ -89,7 +89,7 @@ let make_variant = function |
89 | 89 | (* let e = get_variant_label () in *) |
90 | 90 | let l,_ = Xlist.fold l ([],1) (fun (l,i) -> function |
91 | 91 | t -> (string_of_int i,t) :: l, i+1) in |
92 | - Variant("",l) | |
92 | + Variant("",List.rev l) | |
93 | 93 | |
94 | 94 | let make_subst e = function |
95 | 95 | Zero -> Dot |
... | ... | @@ -162,6 +162,18 @@ let rec deduce_tensor afv bfv rev_sems = function |
162 | 162 | (deduce_tensor afv bfv (sem :: rev_sems) tensor_elems) @ found) |
163 | 163 | |
164 | 164 | let rec deduce_matching afv bfv in_sem = function (* maczowany term * argument funktora *) |
165 | + Plus[s1;s2], t -> | |
166 | + (* Printf.printf "\ndeduce_matching\nt=%s\n" (ENIAM_LCGstringOf.grammar_symbol 0 t); | |
167 | + Printf.printf "s1=%s\n" (ENIAM_LCGstringOf.grammar_symbol 0 s1); | |
168 | + Printf.printf "s2=%s\n" (ENIAM_LCGstringOf.grammar_symbol 0 s2); | |
169 | + Printf.printf "afv=%s bfv=%s\n" (string_of_fv afv) (string_of_fv bfv); *) | |
170 | + let x1 = get_new_variable () in | |
171 | + let x2 = get_new_variable () in | |
172 | + Xlist.fold (deduce_matching afv bfv (Var x1) (s1,t)) [] (fun l (afv,bfv,sem1) -> | |
173 | + (* Printf.printf "1 afv=%s bfv=%s\n" (string_of_fv afv) (string_of_fv bfv); *) | |
174 | + Xlist.fold (deduce_matching afv bfv (Var x2) (s2,t)) l (fun l (afv,bfv,sem2) -> | |
175 | + (* Printf.printf "2 afv=%s bfv=%s\n" (string_of_fv afv) (string_of_fv bfv); *) | |
176 | + (afv,bfv,Case(in_sem,[x1,sem1;x2,sem2])) :: l)) | |
165 | 177 | (* | Plus l, t -> (* zakładam, że afv jest pusty *) |
166 | 178 | let x = get_new_variable () in |
167 | 179 | let found = Xlist.multiply_list (Xlist.map l (fun s -> |
... | ... | @@ -181,6 +193,12 @@ let rec deduce_matching afv bfv in_sem = function (* maczowany term * argument f |
181 | 193 | Xlist.map (deduce_matching afv bfv (Var x) (s,t)) (fun (afv,bfv,sem) -> afv,bfv,Map(in_sem,Lambda(x,sem)))*) |
182 | 194 | | Star _, _ -> [] |
183 | 195 | | _, Star _ -> [] |
196 | + | Conj _, _ -> [] | |
197 | + | _, Conj _ -> [] | |
198 | + | Preconj, _ -> [] | |
199 | + | _, Preconj -> [] | |
200 | + | StarWith l, s -> | |
201 | + fst (Xlist.fold l ([],1) (fun (l,i) t -> (deduce_matching afv bfv (Proj(i,in_sem)) (t,s)) @ l, i+1)) | |
184 | 202 | | WithVar(v,g,e,s),t -> |
185 | 203 | Xlist.map (deduce_matching (add_fv afv v (g,e)) bfv (ProjVar(v,in_sem)) (s,t)) (fun (afv,bfv,sem) -> |
186 | 204 | let g,e = find_fv afv v in |
... | ... | @@ -224,6 +242,7 @@ let rec deduce_matching afv bfv in_sem = function (* maczowany term * argument f |
224 | 242 | l) |
225 | 243 | | Tensor _, _ -> [] |
226 | 244 | | _, Tensor _ -> [] |
245 | + | Maybe _, _ -> [] (* zaślepka na potrzeby reguły koordynacji *) | |
227 | 246 | | s,t -> failwith ("deduce_matching: " ^ ENIAM_LCGstringOf.grammar_symbol 1 s ^ " " ^ ENIAM_LCGstringOf.grammar_symbol 1 t) |
228 | 247 | |
229 | 248 | and deduce_optarg in_sem t = |
... | ... | @@ -263,6 +282,8 @@ let make_forward sem l = (* FIXME: po co jest ta procedura? *) |
263 | 282 | let rec deduce_imp dir afv in_sem = function |
264 | 283 | Tensor _ -> [] |
265 | 284 | | Star _ -> [] |
285 | + | Conj _ -> [] | |
286 | + | Preconj -> [] | |
266 | 287 | | Plus _ -> [] |
267 | 288 | | WithVar(v,g,e,s) -> (*print_endline "deduce_imp WithVar";*) deduce_imp dir (add_fv afv v (g,e)) (ProjVar(v,in_sem)) s |
268 | 289 | | Imp(s,d,t) -> |
... | ... | @@ -279,6 +300,10 @@ let rec deduce_imp dir afv in_sem = function |
279 | 300 | (List.flatten (Xlist.map (deduce_optargs in_sem l) (fun sem -> deduce_imp dir afv sem s))) @ |
280 | 301 | (impset_selector s dir afv in_sem2 [] (l2,1)) |
281 | 302 | else [] |
303 | + | StarWith l -> | |
304 | + fst (Xlist.fold l ([],1) (fun (l,i) t -> | |
305 | + (deduce_imp dir afv (Proj(i,in_sem)) t) @ l, i+1)) | |
306 | + | Maybe _ -> [] (* zaślepka na potrzeby reguły koordynacji *) | |
282 | 307 | | s -> failwith ("deduce_imp: " ^ ENIAM_LCGstringOf.grammar_symbol 1 s) |
283 | 308 | |
284 | 309 | let rec deduce_app references dir (funct,funct_sem) args = |
... | ... | @@ -299,6 +324,42 @@ let rec deduce_app references dir (funct,funct_sem) args = |
299 | 324 | (* print_endline "deduce_app 3"; *) |
300 | 325 | x |
301 | 326 | |
327 | +let apply_coord references = function | |
328 | + Star(arg,funct),coord_sem -> | |
329 | + let x = get_new_variable () in | |
330 | + let y = get_new_variable () in | |
331 | + List.flatten (Xlist.map (deduce_imp Forward empty_fv (Var y) funct) (fun (fv,psi,phi,funct_sem) -> | |
332 | + let l = deduce_matching empty_fv fv (Var x) (arg,phi) in | |
333 | + let map = Xlist.fold l StringMap.empty (fun map (afv,bfv,sem) -> | |
334 | + if not (is_empty_fv afv) then failwith "apply_coord" else | |
335 | + let sem = ConcatCoord(Lambda(y,funct_sem),MapCoord(coord_sem,Lambda(x,sem))) in | |
336 | + StringMap.add_inc map (string_of_fv bfv) (bfv,[sem]) (fun (fv,sems) -> fv, sem :: sems)) in | |
337 | + StringMap.fold map [] (fun l _ (bfv,sems) -> | |
338 | + let reference = ExtArray.add references (make_variant sems) in | |
339 | + (fold_fv bfv (psi,Ref reference) (fun (t,sem) v (g,e) -> WithVar(v,g,e,t), VariantVar(v,sem))) :: l))) | |
340 | + (* let x = get_new_variable () in | |
341 | + let y = get_new_variable () in | |
342 | + Xlist.rev_map (deduce_app references Forward (coord,Var y) [arg,Var x]) (fun (t,sem) -> | |
343 | + t, ConcatCoord(MapCoord(coord_sem,Lambda(x,sem)))) *) | |
344 | + | _ -> failwith "apply_coord" | |
345 | + | |
346 | +let rec deduce_contraction references dir (funct,funct_sem) args = | |
347 | + match funct with | |
348 | + Star(funct,coord) -> | |
349 | + let x = get_new_variable () in | |
350 | + let l = deduce_contraction references dir (funct,Var x) args in | |
351 | + let l = Xlist.rev_map l (fun (t,sem) -> Star(t,coord), MapCoord(funct_sem,Lambda(x,sem))) in | |
352 | + Xlist.fold l l (fun l (t,sem) -> (apply_coord references (t,sem)) @ l) | |
353 | + | Plus[funct1;funct2] -> | |
354 | + let x1 = get_new_variable () in | |
355 | + let x2 = get_new_variable () in | |
356 | + let l1 = deduce_contraction references dir (funct1,Var x1) args in | |
357 | + let l2 = deduce_contraction references dir (funct2,Var x2) args in | |
358 | + Xlist.fold l1 [] (fun l (t1,sem1) -> | |
359 | + Xlist.fold l2 l (fun l (t2,sem2) -> | |
360 | + (Plus[t1;t2],Case(funct_sem,[x1,Inj(1,sem1);x2,Inj(2,sem2)])) :: l)) | |
361 | + | funct -> deduce_app references dir (funct,funct_sem) args | |
362 | + | |
302 | 363 | let rec make_uniq fv n v = |
303 | 364 | if n = 1 then |
304 | 365 | if mem_fv fv v then make_uniq fv (n+1) v else v |
... | ... | @@ -362,6 +423,42 @@ let rec deduce_comp references dir_funct dir_arg (funct,funct_sem) args = |
362 | 423 | (* print_endline "deduce_app 3"; *) |
363 | 424 | x |
364 | 425 | |
426 | +let deduce_forward_coord references coord_funct coord_sem args = | |
427 | + match args with | |
428 | + [] -> [] | |
429 | + | [arg,arg_sem] -> [Maybe(Star(arg,coord_funct)), App(coord_sem,arg_sem)] | |
430 | + | _ -> | |
431 | + let args,args_sem = List.split args in | |
432 | + [Maybe(Star(StarWith args,coord_funct)), App(coord_sem,make_variant args_sem)] | |
433 | + (*Xlist.rev_map args (fun (arg,arg_sem) -> | |
434 | + (* let x = get_new_variable () in *) | |
435 | + Maybe(Star(arg,coord_funct)), App(coord_sem,arg_sem)) | |
436 | + (* Lambda(x,Coord([Var x; arg_sem],coord_sem))) *)*) | |
437 | + | |
438 | +let deduce_forward_precoord references coord_sem args = | |
439 | + (*let args = Xlist.fold args [] (fun l -> function | |
440 | + (Star(arg,coord_funct),arg_sem) as t -> t :: l | |
441 | + | _ -> l) in | |
442 | + if args = [] then [] else*) | |
443 | + Xlist.fold args [] (fun l -> function | |
444 | + (Star(arg,coord_funct),arg_sem) -> | |
445 | + let x = get_new_variable () in | |
446 | + let y = get_new_variable () in | |
447 | + (Maybe(Star(arg,coord_funct)), Lambda(x,AddCoord(Inj(1,Var x), | |
448 | + MapCoord(arg_sem,Lambda(y,Inj(2,Var y)))))) :: l | |
449 | + | _ -> l) | |
450 | + | |
451 | +let deduce_backward_coord references coord_funct (coord,coord_sem) args = | |
452 | + let l = match args with | |
453 | + [] -> [] | |
454 | + | [arg,arg_sem] -> [Star(Plus[arg;coord],coord_funct), App(coord_sem,arg_sem)] | |
455 | + | _ -> | |
456 | + let args,args_sem = List.split args in | |
457 | + [Star(Plus[StarWith args;coord],coord_funct), App(coord_sem,make_variant args_sem)] in | |
458 | +(* let l = Xlist.rev_map args (function (arg,arg_sem) -> | |
459 | + Star(Plus[arg;coord],coord_funct), App(coord_sem,arg_sem)) in*) | |
460 | + Xlist.fold l l (fun l (t,sem) -> (apply_coord references (t,sem)) @ l) | |
461 | + | |
365 | 462 | (*let rec forward_application = function |
366 | 463 | (Bracket(lf,false,funct),sem), (Bracket(false,rf,arg),arg_sem) -> Xlist.map (deduce_app Forward (funct,sem) (arg,arg_sem)) (fun (t,sem) -> Bracket(lf,rf,t), LCGreductions.linear_term_beta_reduction2 sem) |
367 | 464 | | (Bracket(lf,true,funct),sem), (Bracket(true,true,arg),arg_sem) -> Xlist.map (deduce_app Forward (funct,sem) (arg,arg_sem)) (fun (t,sem) -> Bracket(lf,true,t), LCGreductions.linear_term_beta_reduction2 sem) |
... | ... | @@ -503,12 +600,92 @@ let backward_cross_composition references args functs = |
503 | 600 | (Bracket(false,rf,t), (*LCGreductions.linear_term_beta_reduction2*) sem) :: l) |
504 | 601 | | _ -> l) |
505 | 602 | |
603 | +let forward_coordination references coord args = | |
604 | + Xlist.fold coord [] (fun l -> function | |
605 | + Bracket(lf,false,Conj funct),sem -> | |
606 | + let argst,argsf = Xlist.fold args ([],[]) (fun (argst,argsf) -> function | |
607 | + Bracket(false,true,arg),arg_sem -> (arg,arg_sem) :: argst, argsf | |
608 | + | Bracket(false,false,arg),arg_sem -> argst, (arg,arg_sem) :: argsf | |
609 | + | _ -> argst,argsf) in | |
610 | + let l = Xlist.fold (deduce_forward_coord references funct sem argst) l (fun l (t,sem) -> | |
611 | + (Bracket(lf,true,t), (*LCGreductions.linear_term_beta_reduction2*) sem) :: l) in | |
612 | + Xlist.fold (deduce_forward_coord references funct sem argsf) l (fun l (t,sem) -> | |
613 | + (Bracket(lf,false,t), (*LCGreductions.linear_term_beta_reduction2*) sem) :: l) | |
614 | + | Bracket(lf,false,Preconj),sem -> | |
615 | + let argst,argsf = Xlist.fold args ([],[]) (fun (argst,argsf) -> function | |
616 | + Bracket(false,true,arg),arg_sem -> (arg,arg_sem) :: argst, argsf | |
617 | + | Bracket(false,false,arg),arg_sem -> argst, (arg,arg_sem) :: argsf | |
618 | + | _ -> argst,argsf) in | |
619 | + let l = Xlist.fold (deduce_forward_precoord references sem argst) l (fun l (t,sem) -> | |
620 | + (Bracket(lf,true,t), (*LCGreductions.linear_term_beta_reduction2*) sem) :: l) in | |
621 | + Xlist.fold (deduce_forward_precoord references sem argsf) l (fun l (t,sem) -> | |
622 | + (Bracket(lf,false,t), (*LCGreductions.linear_term_beta_reduction2*) sem) :: l) | |
623 | + | _ -> l) | |
624 | + | |
625 | +let backward_coordination references args coord = | |
626 | + (* Printf.printf "backward_application: [%s] [%s]\n%!" | |
627 | + (String.concat "; " (Xlist.map args (fun (arg,_) -> "'" ^ ENIAM_LCGstringOf.grammar_symbol 1 arg ^ "'"))) | |
628 | + (String.concat "; " (Xlist.map coord (fun (arg,_) -> "'" ^ ENIAM_LCGstringOf.grammar_symbol 1 arg ^ "'"))); *) | |
629 | + Xlist.fold coord [] (fun l -> function | |
630 | + Bracket(false,rf,Maybe(Star(t,coord_funct))),sem -> | |
631 | + let argst,argsf = Xlist.fold args ([],[]) (fun (argst,argsf) -> function | |
632 | + Bracket(true,false,arg),arg_sem -> (arg,arg_sem) :: argst, argsf | |
633 | + | Bracket(false,false,arg),arg_sem -> argst, (arg,arg_sem) :: argsf | |
634 | + | _ -> argst,argsf) in | |
635 | + let l = Xlist.fold (deduce_backward_coord references coord_funct (t,sem) argst) l (fun l (t,sem) -> | |
636 | + (Bracket(true,rf,t), (*LCGreductions.linear_term_beta_reduction2*) sem) :: l) in | |
637 | + Xlist.fold (deduce_backward_coord references coord_funct (t,sem) argsf) l (fun l (t,sem) -> | |
638 | + (Bracket(false,rf,t), (*LCGreductions.linear_term_beta_reduction2*) sem) :: l) | |
639 | + | _ -> l) | |
640 | + | |
641 | +let forward_contraction references functs args = | |
642 | + Xlist.fold functs [] (fun l -> function | |
643 | + Bracket(lf,false,Star(funct,coord)),sem -> | |
644 | + let argst,argsf = Xlist.fold args ([],[]) (fun (argst,argsf) -> function | |
645 | + Bracket(false,true,arg),arg_sem -> (arg,arg_sem) :: argst, argsf | |
646 | + | Bracket(false,false,arg),arg_sem -> argst, (arg,arg_sem) :: argsf | |
647 | + | _ -> argst,argsf) in | |
648 | + let l = Xlist.fold (deduce_contraction references Forward (Star(funct,coord),sem) argst) l (fun l (t,sem) -> | |
649 | + (Bracket(lf,true,t), (*LCGreductions.linear_term_beta_reduction2*) sem) :: l) in | |
650 | + Xlist.fold (deduce_contraction references Forward (Star(funct,coord),sem) argsf) l (fun l (t,sem) -> | |
651 | + (Bracket(lf,false,t), (*LCGreductions.linear_term_beta_reduction2*) sem) :: l) | |
652 | + | Bracket(lf,true,Star(funct,coord)),sem -> | |
653 | + let args = Xlist.fold args [] (fun args -> function Bracket(true,true,arg),arg_sem -> (arg,arg_sem) :: args | _ -> args) in | |
654 | + Xlist.fold (deduce_contraction references Forward (Star(funct,coord),sem) args) l (fun l (t,sem) -> | |
655 | + (Bracket(lf,true,t), (*LCGreductions.linear_term_beta_reduction2*) sem) :: l) | |
656 | + | _ -> l) | |
657 | + | |
658 | +let backward_contraction references args functs = | |
659 | + (* Printf.printf "backward_application: [%s] [%s]\n%!" | |
660 | + (String.concat "; " (Xlist.map args (fun (arg,_) -> "'" ^ ENIAM_LCGstringOf.grammar_symbol 1 arg ^ "'"))) | |
661 | + (String.concat "; " (Xlist.map functs (fun (arg,_) -> "'" ^ ENIAM_LCGstringOf.grammar_symbol 1 arg ^ "'"))); *) | |
662 | + Xlist.fold functs [] (fun l -> function | |
663 | + Bracket(false,rf,Star(funct,coord)),sem -> | |
664 | + let argst,argsf = Xlist.fold args ([],[]) (fun (argst,argsf) -> function | |
665 | + Bracket(true,false,arg),arg_sem -> (arg,arg_sem) :: argst, argsf | |
666 | + | Bracket(false,false,arg),arg_sem -> argst, (arg,arg_sem) :: argsf | |
667 | + | _ -> argst,argsf) in | |
668 | + let l = Xlist.fold (deduce_contraction references Backward (Star(funct,coord),sem) argst) l (fun l (t,sem) -> | |
669 | + (Bracket(true,rf,t), (*LCGreductions.linear_term_beta_reduction2*) sem) :: l) in | |
670 | + Xlist.fold (deduce_contraction references Backward (Star(funct,coord),sem) argsf) l (fun l (t,sem) -> | |
671 | + (Bracket(false,rf,t), (*LCGreductions.linear_term_beta_reduction2*) sem) :: l) | |
672 | + | Bracket(true,rf,Star(funct,coord)),sem -> | |
673 | + let args = Xlist.fold args [] (fun args -> function Bracket(true,true,arg),arg_sem -> (arg,arg_sem) :: args | _ -> args) in | |
674 | + Xlist.fold (deduce_contraction references Backward (Star(funct,coord),sem) args) l (fun l (t,sem) -> | |
675 | + (Bracket(true,rf,t), (*LCGreductions.linear_term_beta_reduction2*) sem) :: l) | |
676 | + | _ -> l) | |
506 | 677 | |
507 | 678 | |
508 | 679 | (* FIXME: błąd przy redukcji "Jan chce iść spać" *) |
509 | 680 | |
510 | -let application_rules = [0,backward_application; 0,forward_application] | |
511 | -let application_rules_ignore_brackets = [0,backward_application_ignore_brackets; 0,forward_application_ignore_brackets] | |
681 | +let application_rules = [ | |
682 | + 0,backward_application; 0,forward_application; | |
683 | + 0,backward_coordination; 0,forward_coordination; | |
684 | + 0,backward_contraction; 0,forward_contraction] | |
685 | +let application_rules_ignore_brackets = [ | |
686 | + 0,backward_application_ignore_brackets; 0,forward_application_ignore_brackets; | |
687 | + 0,backward_coordination; 0,forward_coordination; | |
688 | + 0,backward_contraction; 0,forward_contraction] | |
512 | 689 | let cross_composition_rules = [1,backward_cross_composition;1,forward_cross_composition] |
513 | 690 | |
514 | 691 | let rec flatten_functor2 l seml = function |
... | ... |
LCGparser/ENIAM_LCGstringOf.ml
... | ... | @@ -34,7 +34,7 @@ let rec linear_term c = function |
34 | 34 | (* | LetIn(l,s,t) -> "let " ^ String.concat "⊗" l ^ " = " ^ (linear_term 0 s) ^ " in " ^ (linear_term 0 t) *) |
35 | 35 | | Variant(e,l) -> "〈" ^ String.concat "," (Xlist.map l (fun (i,t) -> e^i^": "^linear_term 0 t)) ^ "〉" |
36 | 36 | | VariantVar(v,t) -> "〈" ^ linear_term 0 t ^ "〉_" ^ v |
37 | - (* | Proj(n,t) -> "π_" ^ (string_of_int n) ^ (linear_term c t) *) | |
37 | + | Proj(n,t) -> "π_" ^ (string_of_int n) ^ (linear_term c t) | |
38 | 38 | | ProjVar(v,t) -> "π_[" ^ v ^ "]" ^ (linear_term c t) |
39 | 39 | | SubstVar v -> v |
40 | 40 | | Subst(s,v,t) -> "subst(" ^ (linear_term 0 s) ^ "," ^ v ^ "," ^ (linear_term 0 t) ^ ")" |
... | ... | @@ -59,6 +59,10 @@ let rec linear_term c = function |
59 | 59 | "WEIGHT",Val (string_of_float t.weight);"SYMBOL",t.symbol; |
60 | 60 | "ARG_SYMBOL",t.arg_symbol;"ARG_DIR",Val t.arg_dir;"ARGS",t.args] @ t.attrs) (fun (e,t) -> |
61 | 61 | e ^ ": " ^ (linear_term 0 t)))) ^ "]" |
62 | + | Coord(l,t,a) -> "[" ^ String.concat "; " (Xlist.map l (linear_term 0)) ^ "]_" ^ linear_term 0 t ^ "_" ^ linear_term 0 a | |
63 | + | AddCoord(s,t) -> "add(" ^ linear_term 0 s ^ "," ^ linear_term 0 t ^ ")" | |
64 | + | MapCoord(s,t) -> "map(" ^ linear_term 0 s ^ "," ^ linear_term 0 t ^ ")" | |
65 | + | ConcatCoord(s,t) -> "concat(" ^ linear_term 0 s ^ "," ^ linear_term 0 t ^ ")" | |
62 | 66 | | Ref i -> "ref " ^ string_of_int i |
63 | 67 | | Cut t -> "cut(" ^ linear_term 0 t ^ ")" |
64 | 68 | |
... | ... | @@ -84,7 +88,12 @@ let rec grammar_symbol c = function |
84 | 88 | let s = (grammar_symbol 1 s) ^ "{" ^ String.concat "," (Xlist.map l (fun (d,a) -> direction d ^ grammar_symbol 1 a)) ^ "}" in |
85 | 89 | if c > 0 then "(" ^ s ^ ")" else s |
86 | 90 | | WithVar(v,s,e,t) -> "&_" ^ e ^ ": " ^ v ^ ":=" ^ (internal_grammar_symbol 2 s) ^ " " ^ (grammar_symbol 2 t) |
87 | - | Star s -> (grammar_symbol 2 s) ^ "^*" | |
91 | + | Star(s,t) -> (grammar_symbol 2 s) ^ "^*" ^ grammar_symbol 2 t | |
92 | + | StarWith l -> | |
93 | + let s = String.concat "&" (Xlist.map l (grammar_symbol 2)) in | |
94 | + if c > 1 then "(" ^ s ^ ")" else s | |
95 | + | Conj s -> "Conj(" ^ grammar_symbol 2 s ^ ")" | |
96 | + | Preconj -> "Preconj" | |
88 | 97 | | Bracket(lf,rf,s) -> "⟨" ^ (if lf then "⟨" else "") ^ (grammar_symbol 0 s) ^ "⟩" ^ (if rf then "⟩" else "") |
89 | 98 | | BracketSet d -> "BracketSet(" ^ direction d ^ ")" |
90 | 99 | | Maybe s -> "?" ^ grammar_symbol 2 s |
... | ... | @@ -100,11 +109,14 @@ let rec internal_grammar_symbol_prime = function |
100 | 109 | let rec grammar_symbol_prime = function |
101 | 110 | Tensor l -> "Tensor[" ^ (String.concat ";" (Xlist.map l (internal_grammar_symbol_prime))) ^ "]" |
102 | 111 | | Plus l -> "Plus[" ^ (String.concat ";" (Xlist.map l (grammar_symbol_prime))) ^ "]" |
112 | + | StarWith l -> "StarWith[" ^ (String.concat ";" (Xlist.map l (grammar_symbol_prime))) ^ "]" | |
103 | 113 | | Imp(s,d,t) -> "Imp(" ^ (grammar_symbol_prime s) ^ "," ^ direction d ^ "," ^ (grammar_symbol_prime t) ^ ")" |
104 | 114 | | One -> "One" |
105 | 115 | | ImpSet(s,l) -> "ImpSet(" ^ (grammar_symbol_prime s) ^ ",[" ^ String.concat ";" (Xlist.map l (fun (d,a) -> direction d ^ grammar_symbol_prime a)) ^ "])" |
106 | 116 | | WithVar(v,s,e,t) -> "WithVar(" ^ v ^ "," ^ (internal_grammar_symbol_prime s) ^ "," ^ e ^ "," ^ (grammar_symbol_prime t) ^ ")" |
107 | - | Star s -> "Star(" ^ (grammar_symbol_prime s) ^ ")" | |
117 | + | Star(s,t) -> "Star(" ^ grammar_symbol_prime s ^ "," ^ grammar_symbol 2 t ^ ")" | |
118 | + | Conj s -> "Conj(" ^ grammar_symbol 2 s ^ ")" | |
119 | + | Preconj -> "Preconj" | |
108 | 120 | | Bracket(lf,rf,s) -> "Bracket(" ^ string_of_bool lf ^ "," ^ string_of_bool rf ^ "," ^ (grammar_symbol_prime s) ^ ")" |
109 | 121 | | BracketSet d -> "BracketSet(" ^ direction d ^ ")" |
110 | 122 | | Maybe s -> "Maybe(" ^ grammar_symbol_prime s ^ ")" |
... | ... |
LCGparser/ENIAM_LCGtypes.ml
... | ... | @@ -57,7 +57,7 @@ and linear_term = |
57 | 57 | (* | LetIn of linear_variable list * linear_term * linear_term *) |
58 | 58 | | Variant of string * (string * linear_term) list (* etykieta * indeks * term *) |
59 | 59 | | VariantVar of string * linear_term |
60 | - (* | Proj of int * linear_term *) | |
60 | + | Proj of int * linear_term | |
61 | 61 | | ProjVar of string * linear_term |
62 | 62 | | SubstVar of string |
63 | 63 | | Subst of linear_term * string * linear_term |
... | ... | @@ -86,6 +86,10 @@ and linear_term = |
86 | 86 | | AddRelation of linear_term * string * string * linear_term (* nadrządnik * role * role_attr * podrzędnik *) |
87 | 87 | | RemoveRelation of linear_term |
88 | 88 | | SetContextName of string * linear_term*) |
89 | + | Coord of linear_term list * linear_term * linear_term | |
90 | + | AddCoord of linear_term * linear_term | |
91 | + | MapCoord of linear_term * linear_term | |
92 | + | ConcatCoord of linear_term * linear_term | |
89 | 93 | | Ref of int |
90 | 94 | | Cut of linear_term |
91 | 95 | |
... | ... | @@ -103,7 +107,10 @@ type grammar_symbol = |
103 | 107 | | One |
104 | 108 | | ImpSet of grammar_symbol * (direction * grammar_symbol) list |
105 | 109 | | WithVar of string * internal_grammar_symbol * string * grammar_symbol (* zmienna * wartości * etykieta * term *) |
106 | - | Star of grammar_symbol | |
110 | + | StarWith of grammar_symbol list | |
111 | + | Star of grammar_symbol * grammar_symbol (* argument * funktor spójnika *) | |
112 | + | Conj of grammar_symbol (* funktor spójnika *) | |
113 | + | Preconj | |
107 | 114 | | Bracket of bool * bool * grammar_symbol |
108 | 115 | | BracketSet of direction |
109 | 116 | | Maybe of grammar_symbol |
... | ... | @@ -139,7 +146,7 @@ end |
139 | 146 | |
140 | 147 | module SymbolTermSet = Xset.Make(OrderedSymbolTerm) |
141 | 148 | |
142 | -type chart = (SymbolTermSet.key list * int) array array | |
149 | +type chart = (SymbolTermSet.key list * int) array array array | |
143 | 150 | |
144 | 151 | exception Timeout of float |
145 | 152 | exception SemTooBig |
... | ... |
LCGparser/test.ml
... | ... | @@ -31,18 +31,18 @@ let examples = [ |
31 | 31 | (* 1, 2, "ma","mieć","fin", Basic(Imp(Imp(Tensor[Atom "ip"],Backward,Tensor[Atom "np"; Atom "nom"]),Forward,Tensor[Atom "np"; Atom "nom"])); *) |
32 | 32 | 2, 3, "kota","kot","subst", Basic(Tensor[Atom "np"; Atom "acc"]); |
33 | 33 | 3, 4, ".",".","interp", Basic(Imp(Tensor[Atom "<root>"],Backward,Tensor[Atom "ip"])); |
34 | - ],4; | |
34 | + ],4;*) | |
35 | 35 | |
36 | - "rudy",[ | |
36 | + (* "rudy",[ | |
37 | 37 | 0, 1, "Ala","Ala","subst", Basic(Tensor[Atom "np"; Atom "nom"]); |
38 | 38 | 1, 2, "ma","mieć","fin", Basic(ImpSet(Tensor[Atom "ip"],[Both,Tensor[Atom "np"; Atom "nom"];Both,Tensor[Atom "np"; Atom "acc"]])); |
39 | 39 | 2, 3, "rudego","rudy","adj", Basic(WithVar("case",With[Atom "gen"; Atom "acc"],"A",Tensor[Atom "adjp"; AVar "case"])); |
40 | 40 | 3, 4, "kota","kot","subst", Basic(WithVar("case",With[Atom "gen"; Atom "acc"],"B",ImpSet(Tensor[Atom "np"; AVar "case"],[Backward,Maybe(Tensor[Atom "adjp"; AVar "case"])]))); |
41 | 41 | (* 3, 4, "kota","kot","subst", Basic(WithVar("case",With[Atom "gen"; Atom "acc"],"B",ImpSet(Tensor[Atom "np"; AVar "case"],[Backward,Tensor[Atom "adjp"; AVar "case"]]))); *) |
42 | 42 | 4, 5, ".",".","interp", Basic(Imp(Tensor[Atom "<root>"],Backward,Tensor[Atom "ip"])); |
43 | - ],5; | |
43 | + ],5; *) | |
44 | 44 | |
45 | - "jaki",[ | |
45 | +(* "jaki",[ | |
46 | 46 | 0, 1, "Jakiego","jaki","adj",Raised(WithVar("case",With[Atom "gen"; Atom "acc"],"A",ImpSet(ImpSet(Tensor[Atom "cp"; Atom "int"; Atom "jaki"], |
47 | 47 | [Forward,Imp(Tensor[Atom "ip"],Forward,Tensor[Atom "np"; AVar "case"])]), |
48 | 48 | [Forward,Imp(Tensor[Atom "np"; AVar "case"],Backward,Tensor[Atom "adjp"; AVar "case"])]))); |
... | ... | @@ -72,9 +72,33 @@ let examples = [ |
72 | 72 | 1, 2, "koń","koń","subst", Basic(Tensor[Atom "np"; Atom "nom"]); |
73 | 73 | ],2;*) |
74 | 74 | |
75 | - "krokodyl",[ | |
75 | + (* "krokodyl",[ | |
76 | 76 | 0, 1, "krokodyl","krokodyl","subst", Basic(Imp(Tensor[Atom "np"; Atom "nom"],Forward,Tensor[Atom "np"; Atom "gen"])); |
77 | - ],1; | |
77 | + ],1; *) | |
78 | + | |
79 | + (* "coord",[ | |
80 | + 0, 1, "Ala","Ala","subst", Basic(Tensor[Atom "np"; Atom "nom"]); | |
81 | + 1, 2, "ma","mieć","fin", Basic(ImpSet(Tensor[Atom "ip"],[Both,Tensor[Atom "np"; Atom "nom"];Both,Tensor[Atom "np"; Atom "acc"]])); | |
82 | + 2, 3, "rudego","rudy","adj", Basic(WithVar("case",With[Atom "gen"; Atom "acc"],"A",Tensor[Atom "adjp"; AVar "case"])); | |
83 | + 3, 4, "słonia","słoń","subst", Basic(WithVar("case",With[Atom "gen"; Atom "acc"],"B",ImpSet(Tensor[Atom "np"; AVar "case"],[Backward,Maybe(Tensor[Atom "adjp"; AVar "case"])]))); | |
84 | + (* 3, 4, "kota","kot","subst", Basic(WithVar("case",With[Atom "gen"; Atom "acc"],"B",ImpSet(Tensor[Atom "np"; AVar "case"],[Backward,Tensor[Atom "adjp"; AVar "case"]]))); *) | |
85 | + 4, 5, ",",",","conj", Basic(Preconj); | |
86 | + 5, 6, "kota","kot","subst", Basic(WithVar("case",With[Atom "gen"; Atom "acc"],"C",ImpSet(Tensor[Atom "np"; AVar "case"],[Backward,Maybe(Tensor[Atom "adjp"; AVar "case"])]))); | |
87 | + 6, 7, "i","i","conj", Basic(Conj(WithVar("case",With[Atom "gen"; Atom "acc"; Atom "loc"],"D",Imp(Tensor[Atom "np"; AVar "case"],Both,Tensor[Atom "np"; AVar "case"])))); | |
88 | + 7, 8, "psa","pies","subst", Basic(WithVar("case",With[Atom "gen"; Atom "acc"],"D",ImpSet(Tensor[Atom "np"; AVar "case"],[Backward,Maybe(Tensor[Atom "adjp"; AVar "case"])]))); | |
89 | + (* 3, 4, "psa","pies","subst", Basic(WithVar("case",With[Atom "gen"; Atom "acc"],"C",ImpSet(Tensor[Atom "np"; AVar "case"],[Backward,Tensor[Atom "adjp"; AVar "case"]]))); *) | |
90 | + 8, 9, ".",".","interp", Basic(Imp(Tensor[Atom "<root>"],Backward,Tensor[Atom "ip"])); | |
91 | + ],9; *) | |
92 | + | |
93 | + "unlike_coord",[ | |
94 | + 0, 1, "Al","Al","subst", Basic(Tensor[Atom "np"; Atom "nom"]); | |
95 | + 1, 2, "jest","być","fin", Basic(ImpSet(Tensor[Atom "ip"],[Both,Tensor[Atom "np"; Atom "nom"];Both,Tensor[Atom "np"; Atom "inst"]])); | |
96 | + 2, 3, "młody","młody","adj", Basic(WithVar("case",With[Atom "nom"; Atom "voc"],"A",Tensor[Atom "adjp"; AVar "case"])); | |
97 | + 3, 4, "i","i","conj", Basic(Conj(Imp(Tensor[Atom "np"; Atom "inst"],Both,Plus[Tensor[Atom "np"; Atom "inst"];Tensor[Atom "adjp"; Atom "nom"]]))); | |
98 | + (* 3, 4, "kota","kot","subst", Basic(WithVar("case",With[Atom "gen"; Atom "acc"],"B",ImpSet(Tensor[Atom "np"; AVar "case"],[Backward,Tensor[Atom "adjp"; AVar "case"]]))); *) | |
99 | + 4, 5, "republikaniniem","republikanin","subst", Basic(WithVar("case",With[Atom "inst"],"C",ImpSet(Tensor[Atom "np"; AVar "case"],[Backward,Maybe(Tensor[Atom "adjp"; AVar "case"])]))); | |
100 | + 5, 6, ".",".","interp", Basic(Imp(Tensor[Atom "<root>"],Backward,Tensor[Atom "ip"])); | |
101 | + ],6; | |
78 | 102 | |
79 | 103 | ] |
80 | 104 | |
... | ... |
compile.sh
compile.txt
0 → 100644
compile_subsyntax.sh
0 → 100755
exec/ENIAMexec.ml
... | ... | @@ -76,20 +76,21 @@ let clarify_categories cats (*snode*) token = |
76 | 76 | List.flatten (Xlist.map cats (fun (cat,coerced) -> ENIAMcategoriesPL.clarify_categories false cat coerced (*snode*) (lemma,"interp",[]))) |
77 | 77 | | _ -> [] |
78 | 78 | |
79 | -let create_chart rules tokens lex_sems paths last = | |
79 | +let create_chart rules tokens lex_sems paths last max_cost = | |
80 | 80 | ENIAM_LCGrenderer.reset_variable_numbers (); |
81 | - let chart = ENIAM_LCGchart.make last in | |
81 | + let chart = ENIAM_LCGchart.make last max_cost in | |
82 | 82 | let chart = Xlist.fold paths chart (fun chart (id,lnode,rnode) -> |
83 | 83 | let t = ExtArray.get tokens id in |
84 | 84 | let s = ExtArray.get lex_sems id in |
85 | 85 | ENIAM_LCGrenderer.reset_variable_names (); |
86 | 86 | ENIAM_LCGrenderer.add_variable_numbers (); |
87 | 87 | (* if s.ENIAMlexSemanticsTypes.schemata = [] then failwith ("create_chart: no schema for token=" ^ t.ENIAMtokenizerTypes.orth ^ " lemma=" ^ ENIAMtokens.get_lemma t.ENIAMtokenizerTypes.token) else *) |
88 | - Xlist.fold s.ENIAMlexSemanticsTypes.schemata chart (fun chart (selectors,cats,(*snode,*)schema) -> | |
88 | + Xlist.fold s.ENIAMlexSemanticsTypes.schemata chart (fun chart (selectors,cats,(*snode,*)local_schema,schema,distant_schema) -> | |
89 | 89 | let cats = clarify_categories cats (*snode*) t in |
90 | 90 | (* let chart = ENIAM_LCGchart.add_inc_list chart lnode rnode s.ENIAMlexSemanticsTypes.lex_entries 0 in *) |
91 | - let l = ENIAM_LCGlexicon.create_entries rules id t.ENIAMtokenizerTypes.orth cats [selectors,schema] s.ENIAMlexSemanticsTypes.lex_entries in | |
92 | - ENIAM_LCGchart.add_inc_list chart lnode rnode l 0)) in | |
91 | + let l = ENIAM_LCGlexicon.create_entries rules id t.ENIAMtokenizerTypes.orth cats [selectors,local_schema,schema,distant_schema] s.ENIAMlexSemanticsTypes.lex_entries in | |
92 | + Xlist.fold l chart (fun chart (v,cost) -> | |
93 | + ENIAM_LCGchart.add_inc chart lnode rnode cost v 0))) in | |
93 | 94 | chart |
94 | 95 | |
95 | 96 | let rec split_sons left id right = function |
... | ... | @@ -115,10 +116,11 @@ let create_dep_chart dep_rules tokens lex_sems paths = |
115 | 116 | let s = ExtArray.get lex_sems id in |
116 | 117 | ENIAM_LCGrenderer.reset_variable_names (); |
117 | 118 | ENIAM_LCGrenderer.add_variable_numbers (); |
118 | - Xlist.fold s.ENIAMlexSemanticsTypes.schemata nodes (fun nodes (selectors,cats,(*snode,*)schema) -> | |
119 | + Xlist.fold s.ENIAMlexSemanticsTypes.schemata nodes (fun nodes (selectors,cats,(*snode,*)local_schema,schema,distant_schema) -> | |
119 | 120 | let cats = clarify_categories ["X",["X"]] (*snode*) t in |
120 | 121 | (* let chart = ENIAM_LCGchart.add_inc_list chart lnode rnode s.ENIAMlexSemanticsTypes.lex_entries 0 in *) |
121 | - let l = ENIAM_LCGlexicon.create_entries dep_rules id t.ENIAMtokenizerTypes.orth cats [selectors,schema] s.ENIAMlexSemanticsTypes.lex_entries in | |
122 | + let l = ENIAM_LCGlexicon.create_entries dep_rules id t.ENIAMtokenizerTypes.orth cats [selectors,local_schema,schema,distant_schema] s.ENIAMlexSemanticsTypes.lex_entries in | |
123 | + let l = Xlist.rev_map l fst in | |
122 | 124 | IntMap.add_inc nodes i l (fun l2 -> l @ l2))) in |
123 | 125 | (* print_endline "create_dep_chart 3"; *) |
124 | 126 | let x = dep_create_rec nodes sons 0 in |
... | ... | @@ -154,7 +156,7 @@ let create_end_positions tokens paths last = |
154 | 156 | end_positions.(rnode) <- t.ENIAMtokenizerTypes.beg + t.ENIAMtokenizerTypes.len); |
155 | 157 | end_positions*) |
156 | 158 | |
157 | -let eniam_parse_sentence timeout verbosity rules tokens lex_sems paths last = | |
159 | +let eniam_parse_sentence timeout verbosity rules tokens lex_sems paths last max_cost = | |
158 | 160 | ENIAM_LCGreductions.reset_variant_label (); |
159 | 161 | let result = {empty_eniam_parse_result with paths_size = Xlist.size paths} in |
160 | 162 | let result = if verbosity = 0 then result else {result with |
... | ... | @@ -164,18 +166,20 @@ let eniam_parse_sentence timeout verbosity rules tokens lex_sems paths last = |
164 | 166 | let time1 = time_fun () in |
165 | 167 | try |
166 | 168 | (* print_endline "eniam_parse_sentence 1"; *) |
167 | - let chart = create_chart rules tokens lex_sems paths last in | |
169 | + let chart = create_chart rules tokens lex_sems paths last max_cost in | |
168 | 170 | let result = if verbosity = 0 then result else {result with chart1=chart} in |
169 | 171 | (* print_endline "eniam_parse_sentence 2"; *) |
170 | 172 | let chart,references = ENIAM_LCGchart.lazify chart in |
171 | 173 | let result = if verbosity = 0 then result else {result with chart2=Array.copy chart; references2=ExtArray.copy references} in |
172 | 174 | (* print_endline "eniam_parse_sentence 3"; *) |
173 | 175 | let time2 = time_fun () in |
176 | + Printf.printf "time2-time1=%f\n%!" (time2 -. time1); | |
174 | 177 | let result = {result with lex_time=time2 -. time1} in |
175 | 178 | try |
176 | 179 | (* print_endline "eniam_parse_sentence 4"; *) |
177 | 180 | let chart = ENIAM_LCGchart.parse !lcg_rules chart references timeout time_fun in (* uwaga: niejawna zmiana imperatywna w references *) |
178 | 181 | let time3 = time_fun () in |
182 | + Printf.printf "time3-time2=%f\n%!" (time3 -. time2); | |
179 | 183 | let result = if verbosity = 0 then result else {result with chart3=chart; references3=references} in |
180 | 184 | let result = {result with parse_time=time3 -. time2; chart_size=ENIAM_LCGchart.get_no_entries chart} in |
181 | 185 | (* print_endline "eniam_parse_sentence 4a"; *) |
... | ... | @@ -188,6 +192,7 @@ let eniam_parse_sentence timeout verbosity rules tokens lex_sems paths last = |
188 | 192 | let result = if verbosity = 0 then result else {result with term4=term} in |
189 | 193 | let dependency_tree = ENIAM_LCGreductions.reduce term references in |
190 | 194 | let time4 = time_fun () in |
195 | + Printf.printf "time4-time3=%f\n%!" (time4 -. time3); | |
191 | 196 | let result = if verbosity = 0 then result else {result with dependency_tree4=Array.copy dependency_tree} in |
192 | 197 | let result = {result with reduction_time=time4 -. time3; dependency_tree_size=Array.length dependency_tree} in |
193 | 198 | (* print_endline "a 0"; *) |
... | ... | @@ -201,13 +206,14 @@ let eniam_parse_sentence timeout verbosity rules tokens lex_sems paths last = |
201 | 206 | ENIAM_LCGreductions.remove_cuts dependency_tree; (* uwaga: niejawna zmiana imperatywna w result *) |
202 | 207 | let result = if verbosity = 0 then result else {result with dependency_tree6a=dependency_tree} in |
203 | 208 | (* print_endline "a 3"; *) |
204 | - let dependency_tree = ENIAM_LCGreductions.normalize_variants dependency_tree in | |
209 | + (* let dependency_tree = ENIAM_LCGreductions.normalize_variants dependency_tree in *) (* FIXME: trzeba zreimplementować obsługę wielokrotnych etykiet *) | |
205 | 210 | (* print_endline "a 4"; *) |
206 | 211 | ENIAMlexSemantics.create_tokens_for_artificial_nodes tokens lex_sems dependency_tree; |
207 | 212 | let result = (*if verbosity = 0 then result else*) {result with dependency_tree6b=Array.copy dependency_tree} in |
208 | 213 | try |
209 | 214 | ENIAM_LCGreductions.validate_dependency_tree dependency_tree; |
210 | 215 | let time6 = time_fun () in |
216 | + Printf.printf "time6-time4=%f\n%!" (time6 -. time4); | |
211 | 217 | {result with status=Parsed; sem_time=time6 -. time4} |
212 | 218 | with e -> |
213 | 219 | let time6 = time_fun () in |
... | ... | @@ -310,7 +316,7 @@ let conll_parse_sentence timeout verbosity dep_rules tokens lex_sems paths = |
310 | 316 | else stdin, stdout |
311 | 317 | *) |
312 | 318 | |
313 | -let parse timeout verbosity rules dep_rules (*name id*) tokens lex_sems = | |
319 | +let parse timeout verbosity max_cost rules dep_rules (*name id*) tokens lex_sems = | |
314 | 320 | map_text Struct (fun mode -> function |
315 | 321 | RawSentence s -> |
316 | 322 | (match mode with |
... | ... | @@ -323,7 +329,7 @@ let parse timeout verbosity rules dep_rules (*name id*) tokens lex_sems = |
323 | 329 | | StructSentence(paths,last) -> |
324 | 330 | (match mode with |
325 | 331 | ENIAM -> |
326 | - let result = eniam_parse_sentence timeout verbosity rules tokens lex_sems paths last in | |
332 | + let result = eniam_parse_sentence timeout verbosity rules tokens lex_sems paths last max_cost in | |
327 | 333 | ENIAMSentence result |
328 | 334 | | _ -> failwith "parse 3") |
329 | 335 | | DepSentence paths_list -> |
... | ... |
exec/ENIAMvisualization.ml
... | ... | @@ -813,11 +813,14 @@ let rec extract_pos_cat vars = function |
813 | 813 | (* | Tensor (pos :: cat :: _) -> (*extract_pos_cat_internal vars pos ^ "*" ^*) extract_pos_cat_internal vars cat *) |
814 | 814 | | Tensor _ as t -> print_endline ("Unknown symbol " ^ ENIAM_LCGstringOf.grammar_symbol 0 t); "Unknown" |
815 | 815 | | Plus l -> failwith "extract_pos_cat: ni" |
816 | + | StarWith l -> failwith "extract_pos_cat: ni" | |
816 | 817 | | Imp(s,d,t2) -> extract_pos_cat vars s |
817 | 818 | | One -> failwith "extract_pos_cat: ni" |
818 | 819 | | ImpSet(s,l) -> extract_pos_cat vars s |
819 | 820 | | WithVar(v,g,e,s) -> extract_pos_cat ((v,g) :: vars) s |
820 | - | Star s -> failwith "extract_pos_cat: ni" | |
821 | + | Star(_,s) -> extract_pos_cat vars s | |
822 | + | Conj _ -> "Conj" | |
823 | + | Preconj -> "Preconj" | |
821 | 824 | | Bracket(lf,rf,s) -> extract_pos_cat vars s |
822 | 825 | | BracketSet d -> "BracketSet" |
823 | 826 | | Maybe s -> failwith "extract_pos_cat: ni" |
... | ... | @@ -838,7 +841,7 @@ let omited = StringSet.of_list ["<subst>";"<depr>";"<ppron12>";"<ppron3>";"<sieb |
838 | 841 | "<phone-number>";"<postal-code>";"<sentence>";"<paragraph>"] |
839 | 842 | |
840 | 843 | let cat_tokens_sequence text_fragments g = |
841 | - let _,_,l = ENIAM_LCGchart.fold g (0,0,[]) (fun (m,n,l) (symbol,node1,node2,sem,layer) -> | |
844 | + let _,_,l = ENIAM_LCGchart.fold g (0,0,[]) (fun (m,n,l) (symbol,node1,node2,cost,sem,layer) -> | |
842 | 845 | node1,node2, |
843 | 846 | (if m < node1 then |
844 | 847 | if n < node1 then [n, node1, get_text_fragment text_fragments n node1, "null"] |
... | ... |
exec/makefile
... | ... | @@ -32,7 +32,7 @@ eniam-exec.cmxa: $(SOURCES) |
32 | 32 | ocamlopt -linkall -a -o eniam-exec.cmxa $(INCLUDES) $^ |
33 | 33 | |
34 | 34 | parser: parser.ml |
35 | - $(OCAMLOPT) -o parser $(OCAMLOPTFLAGS) $^ | |
35 | + $(OCAMLOPT) -o parser $(OCAMLOPTFLAGS) eniam-fuzzyAnalyzer.cmxa $^ | |
36 | 36 | |
37 | 37 | semparser: semparser.ml |
38 | 38 | mkdir -p results |
... | ... |
exec/parser.ml
... | ... | @@ -20,10 +20,10 @@ |
20 | 20 | open ENIAMsubsyntaxTypes |
21 | 21 | open Xstd |
22 | 22 | |
23 | -let rules = ENIAM_LCGlexicon.make_rules false ENIAM_LCGlexiconTypes.rules_filename | |
24 | -let dep_rules = ENIAM_LCGlexicon.make_rules true ENIAM_LCGlexiconTypes.rules_filename | |
23 | +let rules = ENIAM_LCGlexicon.make_rules_list false [ENIAM_LCGlexiconTypes.rules_filename; ENIAM_LCGlexiconTypes.user_lexicon_filename] | |
24 | +let dep_rules = ENIAM_LCGlexicon.make_rules_list true [ENIAM_LCGlexiconTypes.rules_filename; ENIAM_LCGlexiconTypes.user_lexicon_filename] | |
25 | 25 | |
26 | -type output = (*Text |*) Xml | Html | Marsh (*| Yaml | Graphviz*) | |
26 | +type output = Text |(* Marked |*) Xml | Html | Marsh (*| FStruct | JSON*) (*| Graphviz*) | |
27 | 27 | |
28 | 28 | let output = ref Html |
29 | 29 | let comm_stdio = ref true |
... | ... | @@ -38,13 +38,20 @@ let select_sentence_modes_flag = ref false |
38 | 38 | let select_sentences_flag = ref true |
39 | 39 | let semantic_processing_flag = ref true |
40 | 40 | let discontinuous_parsing_flag = ref false |
41 | +let correct_spelling_flag = ref false | |
41 | 42 | let output_dir = ref "results/" |
42 | 43 | let perform_integration = ref false |
44 | +let name_length = ref 20 | |
45 | +let split_pattern = ref "" | |
46 | +let max_cost = ref 2 | |
43 | 47 | let spec_list = [ |
44 | 48 | "-i", Arg.Unit (fun () -> comm_stdio:=true), "Communication using stdio (default)"; |
45 | 49 | "-p", Arg.Int (fun p -> comm_stdio:=false; port:=p), "<port> Communication using sockets on given port number"; |
46 | - (*"-t", Arg.Unit (fun () -> output:=Text), "Output as plain text (default)";*) | |
50 | + "-t", Arg.Unit (fun () -> output:=Text), "Output as plain text"; | |
51 | + (* "-r", Arg.Unit (fun () -> output:=Marked), "Output as HTML marked text"; *) | |
52 | + (* "-f", Arg.Unit (fun () -> output:=FStruct), "Output as feature structure"; *) | |
47 | 53 | "-x", Arg.Unit (fun () -> output:=Xml), "Output as XML"; |
54 | + (* "-j", Arg.Unit (fun () -> output:=JSON), "Output as JSON"; *) | |
48 | 55 | "-m", Arg.Unit (fun () -> output:=Marsh), "Output as marshalled Ocaml data structure"; |
49 | 56 | "-h", Arg.Unit (fun () -> output:=Html), "Output as HTML (default)"; |
50 | 57 | (* "-y", Arg.Unit (fun () -> output:=Yaml), "Output as YAML"; *) |
... | ... | @@ -70,6 +77,15 @@ let spec_list = [ |
70 | 77 | "--no-discontinuous", Arg.Unit (fun () -> discontinuous_parsing_flag:=false), "Do not parse discontinuous constituents (default)"; |
71 | 78 | "--partial", Arg.Unit (fun () -> ENIAMexecTypes.partial_parsing_flag:=true), "Build derivation trees for partially parsed sentences"; |
72 | 79 | "--no-partial", Arg.Unit (fun () -> ENIAMexecTypes.partial_parsing_flag:=false), "Build derivation trees for partially parsed sentences (default)"; |
80 | + "--def-cat", Arg.Unit (fun () -> ENIAM_LCGlexiconTypes.default_category_flag:=true), "Create default semantic category for unknown tokens (default)"; | |
81 | + "--no-def-cat", Arg.Unit (fun () -> ENIAM_LCGlexiconTypes.default_category_flag:=false), "Do not create default semantic category for unknown tokens"; | |
82 | + "--internet-mode", Arg.Unit (fun () -> ENIAMtokenizerTypes.internet_mode:=true), "Relaxed attitude towards interpunction"; | |
83 | + "--no-internet-mode", Arg.Unit (fun () -> ENIAMtokenizerTypes.internet_mode:=false), "Strict attitude towards interpunction (default)"; | |
84 | + "--max-par-name-length", Arg.Int (fun v -> name_length:=v), "<val> Defines maximum length of paragraph name in visualization (default 20)"; | |
85 | + "--split-pattern", Arg.String (fun s -> split_pattern:=s), "<val> Defines splitting pattern for HTML marked text (default none)"; | |
86 | + "--correct-spelling", Arg.Unit (fun () -> correct_spelling_flag:=true), "Correct spelling errors before parsing"; | |
87 | + "--no-correct-spelling", Arg.Unit (fun () -> correct_spelling_flag:=false), "Do not correct spelling errors before parsing (default)"; | |
88 | + "--max-cost", Arg.Int (fun cost -> max_cost:=cost), "<cost> Maximal parsing cost (default 2)"; | |
73 | 89 | "--dep-parser", Arg.Unit (fun () -> |
74 | 90 | ENIAMpreIntegration.concraft_enabled := true; |
75 | 91 | ENIAMpreIntegration.mate_parser_enabled := true; |
... | ... | @@ -112,7 +128,7 @@ let rec main_loop sub_in sub_out in_chan out_chan = |
112 | 128 | if text = "" then () else ( |
113 | 129 | let text,tokens,lex_sems,msg = |
114 | 130 | if !lexSemantics_built_in then |
115 | - let text,tokens,msg = ENIAMsubsyntax.catch_parse_text true text in | |
131 | + let text,tokens,msg = ENIAMsubsyntax.catch_parse_text true false text in | |
116 | 132 | let text,msg = |
117 | 133 | if msg <> "" || not !perform_integration then text,msg else |
118 | 134 | ENIAMpreIntegration.catch_parse_text ENIAMsubsyntaxTypes.Struct tokens text in |
... | ... | @@ -124,17 +140,39 @@ let rec main_loop sub_in sub_out in_chan out_chan = |
124 | 140 | (Marshal.from_channel sub_in : ENIAMsubsyntaxTypes.text * ENIAMtokenizerTypes.token_env ExtArray.t * ENIAMlexSemanticsTypes.lex_sem ExtArray.t * string)) in |
125 | 141 | if msg <> "" then |
126 | 142 | (match !output with |
143 | + | Text (*| Marked*) -> Printf.fprintf out_chan "%s\n%!" msg | |
127 | 144 | | Html -> Printf.fprintf out_chan "%s\n%!" msg |
128 | 145 | | Xml -> Printf.fprintf out_chan "%s\n%!" (Xml.to_string_fmt (ENIAMexecXMLof.message msg)) |
146 | + (* | JSON -> Printf.fprintf out_chan "%s\n%!" (JSONconverter.to_string "" (JSONconverter.message msg)) *) | |
129 | 147 | | Marsh -> Marshal.to_channel out_chan (text,tokens,lex_sems,msg) []; flush out_chan) else ( |
130 | 148 | let text = ENIAMexec.translate_text text in |
131 | - let text = ENIAMexec.parse !timeout !verbosity rules dep_rules tokens lex_sems text in | |
149 | + let text = ENIAMexec.parse !timeout !verbosity !max_cost rules dep_rules tokens lex_sems text in | |
150 | + (* let text = ENIAMdisamb.disambiguate text in | |
151 | + let text = ENIAMdisamb.sort_arguments tokens text in | |
152 | + let text = ENIAMdisamb.merge_mwe tokens text in *) | |
132 | 153 | let text = if !select_sentence_modes_flag then ENIAMselectSent.select_sentence_modes_text text else text in |
133 | 154 | let text = if !select_sentences_flag then ENIAMselectSent.select_sentences_text ENIAMexecTypes.Struct text else text in |
134 | 155 | let text = if !semantic_processing_flag then ENIAMexec.semantic_processing !verbosity tokens lex_sems text else text in |
135 | 156 | (match !output with |
157 | + | Text -> Printf.fprintf out_chan "%s\n%!" (String.concat "\n" (ENIAMvisualization.to_string_text !verbosity tokens text)) (* FIXME: obcinanie nazw *) | |
158 | + (* | Marked -> Printf.fprintf out_chan "%s\n%!" (String.concat "\n" (ENIAMvisualization.marked_string_of_text !verbosity tokens text)) *) | |
159 | + (* | Marked -> ENIAMvisualization.print_html_marked_text !output_dir "marked_text" text !img !verbosity tokens *) | |
160 | + (* | Marked -> MarkedHTMLof.print_html_marked_simple_text !output_dir "marked_text" !name_length (MarkedHTMLof.marked_string_of_text !verbosity tokens text) *) | |
136 | 161 | | Html -> ENIAMvisualization.print_html_text !output_dir "parsed_text" text !img !verbosity tokens |
137 | 162 | | Xml -> Printf.fprintf out_chan "%s\n%!" (Xml.to_string_fmt (ENIAMexecXMLof.text "" text)) |
163 | + (* | FStruct -> Printf.fprintf out_chan "%s\n%!" (Xml.to_string_fmt (FStruct.text "" text)) *) | |
164 | + (* | JSON -> | |
165 | + (* Printf.fprintf out_chan "-------------------------\n"; *) | |
166 | + (* Printf.fprintf out_chan "%s\n%!" raw_text; *) | |
167 | + let json = JSONconverter.convert text in | |
168 | + (* Printf.fprintf out_chan "%s\n%!" (JSONconverter.to_string "" json); *) | |
169 | + let json2 = JSONconverter.add_text raw_text (JSONconverter.convert_jstring_indexes (JSONconverter.convert_to_kuba json)) in | |
170 | + Printf.fprintf out_chan "%s\n%!" (JSONconverter.to_string "" json2); | |
171 | + (* (try | |
172 | + let time = TestTime.execute_gen json in | |
173 | + Printf.fprintf out_chan "%s\n%!" (TestTime.string_of "" time) | |
174 | + with Failure t -> print_endline ("FAILURE: " ^ t)); *) | |
175 | + () *) | |
138 | 176 | | Marsh -> Marshal.to_channel out_chan (text,tokens,lex_sems,msg) []; flush out_chan)); |
139 | 177 | prerr_endline "Done!"; |
140 | 178 | main_loop sub_in sub_out in_chan out_chan) |
... | ... | @@ -148,10 +186,14 @@ let _ = |
148 | 186 | prerr_endline message; |
149 | 187 | ENIAMsemTypes.user_ontology_flag := false; |
150 | 188 | ENIAMcategoriesPL.initialize (); |
151 | - ENIAMsemLexicon.initialize (); | |
189 | + (* ENIAMsemLexicon.initialize (); *) | |
190 | + ENIAMsemLexicon.sem_lexicon := ENIAMsemLexicon.load_lexicon "data/sem-lexicon.dic"; | |
191 | + (* MarkedHTMLof.initialize (); *) | |
152 | 192 | Arg.parse spec_list anon_fun usage_msg; |
153 | - if !discontinuous_parsing_flag then ENIAMexecTypes.lcg_rules := ENIAM_LCGrules.application_rules @ ENIAM_LCGrules.cross_composition_rules | |
154 | - else ENIAMexecTypes.lcg_rules := ENIAM_LCGrules.application_rules; | |
193 | + let application_rules = if !ENIAMtokenizerTypes.internet_mode then ENIAM_LCGrules.application_rules_ignore_brackets else ENIAM_LCGrules.application_rules in | |
194 | + if !discontinuous_parsing_flag then ENIAMexecTypes.lcg_rules := application_rules @ ENIAM_LCGrules.cross_composition_rules | |
195 | + else ENIAMexecTypes.lcg_rules := application_rules; | |
196 | + if !correct_spelling_flag then ENIAMfuzzyDetector.initialize (); | |
155 | 197 | if !lexSemantics_built_in then ENIAMlexSemantics.initialize (); |
156 | 198 | if !perform_integration then ENIAMpreIntegration.initialize (); |
157 | 199 | Gc.compact (); |
... | ... |
lexSemantics/ENIAMadjuncts.ml
... | ... | @@ -36,8 +36,8 @@ let simplify_position_verb mode l = function (* FIXME: dodać czyszczenie E Pro |
36 | 36 | | SimpleLexArg("się",QUB) -> l |
37 | 37 | | E Or -> l |
38 | 38 | | E (CP(CompTypeUndef,CompUndef)) -> l |
39 | - | E (PrepNP(_,prep,Case case)) -> l | |
40 | - | E (PrepNCP(_,prep,Case case,CompTypeUndef,CompUndef)) -> l | |
39 | + | E (PrepNP(prep,Case case)) -> l | |
40 | + | E (PrepNCP(prep,Case case,CompTypeUndef,CompUndef)) -> l | |
41 | 41 | | NP(Case "gen") as t -> if mode = "temp" then l else t :: l |
42 | 42 | | NP(Case "acc") as t -> if mode = "dur" then l else t :: l |
43 | 43 | | t -> t :: l |
... | ... | @@ -253,19 +253,19 @@ let simplify_schemata lexemes pos pos2 lemma schemata = |
253 | 253 | "{" ^ String.concat ";" (PhraseSet.fold morfs [] (fun l m -> ENIAMwalStringOf.phrase m :: l)) ^ "}")))); *) |
254 | 254 | schemata |
255 | 255 | |
256 | -let add_adjuncts preps compreps compars pos2 (selectors,cat,(*has_context,*)schema) = | |
256 | +let add_adjuncts preps compreps compars pos2 (selectors,cat,(*has_context,*)local_schema,schema,distant_schema) = | |
257 | 257 | let compreps = Xlist.rev_map compreps ENIAMwalRenderer.render_comprep in |
258 | 258 | let prepnps = Xlist.rev_map preps (fun (prep,cases) -> ENIAMwalRenderer.render_prepnp prep cases) in |
259 | 259 | let prepadjps = Xlist.rev_map preps (fun (prep,cases) -> ENIAMwalRenderer.render_prepadjp prep cases) in |
260 | 260 | let compars = Xlist.rev_map compars ENIAMwalRenderer.render_compar in |
261 | 261 | match pos2 with |
262 | - "verb" -> [selectors,cat,(*has_context,*)schema @ ENIAMwalRenderer.verb_adjuncts_simp @ prepnps @ prepadjps @ compreps @ compars] | |
262 | + "verb" -> [selectors,cat,(*has_context,*)local_schema,schema @ ENIAMwalRenderer.verb_adjuncts_simp @ prepnps @ prepadjps @ compreps @ compars,distant_schema] | |
263 | 263 | | "noun" -> [ |
264 | - [Nsyn,Eq,["proper"]] @ selectors,cat,(*has_context,*)ENIAMwalRenderer.proper_noun_adjuncts_simp @ prepnps @ compreps @ compars; | |
265 | - [Nsyn,Eq,["common"];Nsem,Eq,["measure"]] @ selectors,cat,(*has_context,*)ENIAMwalRenderer.measure_noun_adjuncts_simp @ prepnps @ compreps @ compars; | |
266 | - [Nsyn,Eq,["common"];Nsem,Neq,["measure"]] @ selectors,cat,(*has_context,*)ENIAMwalRenderer.common_noun_adjuncts_simp @ prepnps @ compreps @ compars] | |
267 | - | "adj" -> [selectors,cat,(*has_context,*)schema @ ENIAMwalRenderer.adj_adjuncts_simp @ compars] | |
268 | - | "adv" -> [selectors,cat,(*has_context,*)schema @ ENIAMwalRenderer.adv_adjuncts_simp @ compars] | |
264 | + [Nsyn,Eq,["proper"]] @ selectors,cat,(*has_context,*)local_schema,ENIAMwalRenderer.proper_noun_adjuncts_simp @ prepnps @ compreps @ compars,distant_schema; | |
265 | + [Nsyn,Eq,["common"];Nsem,Eq,["measure"]] @ selectors,cat,(*has_context,*)local_schema,ENIAMwalRenderer.measure_noun_adjuncts_simp @ prepnps @ compreps @ compars,distant_schema; | |
266 | + [Nsyn,Eq,["common"];Nsem,Neq,["measure"]] @ selectors,cat,(*has_context,*)local_schema,ENIAMwalRenderer.common_noun_adjuncts_simp @ prepnps @ compreps @ compars,distant_schema] | |
267 | + | "adj" -> [selectors,cat,(*has_context,*)local_schema,schema @ ENIAMwalRenderer.adj_adjuncts_simp @ compars,distant_schema] | |
268 | + | "adv" -> [selectors,cat,(*has_context,*)local_schema,schema @ ENIAMwalRenderer.adv_adjuncts_simp @ compars,distant_schema] | |
269 | 269 | | _ -> [] |
270 | 270 | |
271 | 271 | open ENIAMlexSemanticsTypes |
... | ... |
lexSemantics/ENIAMlexSemantics.ml
... | ... | @@ -293,7 +293,7 @@ let assign_valence tokens lex_sems group = |
293 | 293 | Xlist.iter group (fun id -> |
294 | 294 | let lemma = ENIAMtokens.get_lemma (ExtArray.get tokens id).token in |
295 | 295 | let pos = ENIAMtokens.get_pos (ExtArray.get tokens id).token in |
296 | - let pos2 = ENIAMvalence.simplify_pos pos in | |
296 | + let pos2 = ENIAMcategoriesPL.simplify_pos pos in | |
297 | 297 | let schemata = Entries.find schemata pos2 lemma in |
298 | 298 | let schemata = if schemata = [] then ENIAMvalence.get_default_valence pos2 else schemata in |
299 | 299 | (* Printf.printf "A %s %s %s |schemata|=%d\n" lemma pos pos2 (Xlist.size schemata); *) |
... | ... | @@ -305,9 +305,9 @@ let assign_valence tokens lex_sems group = |
305 | 305 | let schemata = ENIAMadjuncts.simplify_schemata lexemes pos pos2 lemma schemata1 in |
306 | 306 | (* Printf.printf "C %s |schemata|=%d\n" lemma (Xlist.size schemata); *) |
307 | 307 | let schemata = Xlist.rev_map schemata (fun (selectors,schema) -> |
308 | - selectors,["X",["X"]],(*snode_values,*)ENIAMwalRenderer.render_simple_schema schema) in | |
308 | + selectors,["X",["X"]],(*snode_values,*)[],ENIAMwalRenderer.render_simple_schema schema,[]) in | |
309 | 309 | let schemata = List.flatten (Xlist.rev_map schemata (ENIAMadjuncts.add_adjuncts preps compreps compars pos2)) in |
310 | - let schemata = if schemata = [] then [[],["X",["X"]],(*snode_values,*)[]] else schemata in | |
310 | + let schemata = if schemata = [] then [[],["X",["X"]],(*snode_values,*)[],[],[]] else schemata in | |
311 | 311 | (* Printf.printf "D %s |schemata|=%d\n" lemma (Xlist.size schemata); *) |
312 | 312 | let entries = List.flatten (Xlist.rev_map entries (ENIAMvalence.transform_lex_entry pos lemma)) in |
313 | 313 | let entries = Xlist.map entries (fun (selectors,entry) -> |
... | ... |
lexSemantics/ENIAMlexSemanticsHTMLof.ml
... | ... | @@ -60,11 +60,15 @@ let html_of_lex_sems tokens lex_sems = |
60 | 60 | let core = Printf.sprintf "%3d %s %s" id orth lemma in |
61 | 61 | let lex_entries = Xlist.map t.lex_entries (fun (selectors,s) -> |
62 | 62 | "  [" ^ ENIAMcategoriesPL.string_of_selectors selectors ^ "] " ^ ENIAM_LCGstringOf.grammar_symbol 0 s) in |
63 | - let schemata = Xlist.map t.schemata (fun (selectors,cat,(*snode,*)l) -> | |
63 | + let schemata = Xlist.map t.schemata (fun (selectors,cat,(*snode,*)l,l2,l3) -> | |
64 | 64 | "  [" ^ ENIAMcategoriesPL.string_of_selectors selectors ^ "]" ^ |
65 | 65 | String.concat "," (Xlist.map cat (fun (m,l) -> m ^ "[" ^ String.concat "," l ^ "]")) ^ |
66 | 66 | (*String.concat "|" snode ^*) |
67 | 67 | " {" ^ String.concat ", " (Xlist.map l (fun (d,s) -> |
68 | + ENIAM_LCGstringOf.direction d ^ ENIAM_LCGstringOf.grammar_symbol 0 s)) ^ "}" ^ | |
69 | + " {" ^ String.concat ", " (Xlist.map l2 (fun (d,s) -> | |
70 | + ENIAM_LCGstringOf.direction d ^ ENIAM_LCGstringOf.grammar_symbol 0 s)) ^ "}" ^ | |
71 | + " {" ^ String.concat ", " (Xlist.map l3 (fun (d,s) -> | |
68 | 72 | ENIAM_LCGstringOf.direction d ^ ENIAM_LCGstringOf.grammar_symbol 0 s)) ^ "}") in |
69 | 73 | (* let frames = Xlist.map t.frames (fun (selectors,senses,schema) -> FIXME |
70 | 74 | "  [" ^ ENIAMcategoriesPL.string_of_selectors selectors ^ "] {" ^ ENIAMwalStringOf.schema schema ^ "} " ^ |
... | ... |
lexSemantics/ENIAMlexSemanticsStringOf.ml
... | ... | @@ -40,11 +40,15 @@ let string_of_lex_sems tokens lex_sems = |
40 | 40 | let core = Printf.sprintf "%3d %s %s" id orth lemma in |
41 | 41 | let lex_entries = Xlist.map t.lex_entries (fun (selectors,s) -> |
42 | 42 | "&[" ^ ENIAMcategoriesPL.string_of_selectors selectors ^ "] " ^ ENIAM_LCGstringOf.grammar_symbol 0 s) in |
43 | - let schemata = Xlist.map t.schemata (fun (selectors,cat,(*snode,*)l) -> | |
43 | + let schemata = Xlist.map t.schemata (fun (selectors,cat,(*snode,*)l,l2,l3) -> | |
44 | 44 | "[" ^ ENIAMcategoriesPL.string_of_selectors selectors ^ "]" ^ |
45 | 45 | String.concat "," (Xlist.map cat (fun (m,l) -> m ^ "[" ^ String.concat "," l ^ "]")) ^ |
46 | 46 | (*String.concat "|" snode ^*) |
47 | 47 | " {" ^ String.concat "," (Xlist.map l (fun (d,s) -> |
48 | + ENIAM_LCGstringOf.direction d ^ ENIAM_LCGstringOf.grammar_symbol 0 s)) ^ "}" ^ | |
49 | + " {" ^ String.concat "," (Xlist.map l2 (fun (d,s) -> | |
50 | + ENIAM_LCGstringOf.direction d ^ ENIAM_LCGstringOf.grammar_symbol 0 s)) ^ "}" ^ | |
51 | + " {" ^ String.concat "," (Xlist.map l3 (fun (d,s) -> | |
48 | 52 | ENIAM_LCGstringOf.direction d ^ ENIAM_LCGstringOf.grammar_symbol 0 s)) ^ "}") in |
49 | 53 | let frames = Xlist.map t.frames (fun f -> |
50 | 54 | "*" ^ arole f ^ "[" ^ ENIAMcategoriesPL.string_of_selectors f.selectors ^ "] {" ^ ENIAMwalStringOf.schema f.positions ^ "} " ^ |
... | ... |
lexSemantics/ENIAMlexSemanticsTypes.ml
... | ... | @@ -43,7 +43,9 @@ type lex_sem = { |
43 | 43 | schemata: ((ENIAM_LCGlexiconTypes.selector * ENIAM_LCGlexiconTypes.selector_relation * string list) list * |
44 | 44 | (string * string list) list * (* sensy *) |
45 | 45 | (*string list **) (* has_context *) |
46 | - (ENIAM_LCGtypes.direction * ENIAM_LCGtypes.grammar_symbol) list) list; | |
46 | + (ENIAM_LCGtypes.direction * ENIAM_LCGtypes.grammar_symbol) list * (* local_schema *) | |
47 | + (ENIAM_LCGtypes.direction * ENIAM_LCGtypes.grammar_symbol) list * (* schema *) | |
48 | + (ENIAM_LCGtypes.direction * ENIAM_LCGtypes.grammar_symbol) list) list; (* distant_schema *) | |
47 | 49 | lex_entries: ((ENIAM_LCGlexiconTypes.selector * ENIAM_LCGlexiconTypes.selector_relation * string list) list * |
48 | 50 | ENIAM_LCGtypes.grammar_symbol) list; |
49 | 51 | frames: frame list; |
... | ... |
lexSemantics/ENIAMvalence.ml
... | ... | @@ -20,32 +20,6 @@ |
20 | 20 | open ENIAMwalTypes |
21 | 21 | open Xstd |
22 | 22 | |
23 | -let simplify_pos = function | |
24 | - "subst" -> "noun" | |
25 | - | "depr" -> "noun" | |
26 | - (* | "psubst" -> "noun" | |
27 | - | "pdepr" -> "noun" *) | |
28 | - | "adj" -> "adj" | |
29 | - | "adjc" -> "adj" | |
30 | - | "adjp" -> "adj" | |
31 | - | "ger" -> "verb" | |
32 | - | "pact" -> "verb" | |
33 | - | "ppas" -> "verb" | |
34 | - | "fin" -> "verb" | |
35 | - | "bedzie" -> "verb" | |
36 | - | "praet" -> "verb" | |
37 | - | "winien" -> "verb" | |
38 | - | "impt" -> "verb" | |
39 | - | "imps" -> "verb" | |
40 | - | "inf" -> "verb" | |
41 | - | "pcon" -> "verb" | |
42 | - | "pant" -> "verb" | |
43 | - | "pred" -> "verb" | |
44 | - | "ppron12" -> "pron" | |
45 | - | "ppron3" -> "pron" | |
46 | - | "siebie" -> "pron" | |
47 | - | s -> s | |
48 | - | |
49 | 23 | let transform_zeby = function |
50 | 24 | Aff -> [Comp "że"] |
51 | 25 | | Negation -> [Comp "że";Comp "żeby"] |
... | ... | @@ -73,29 +47,40 @@ let transform_str mood negation = |
73 | 47 | | Negation -> [Case "gen"] |
74 | 48 | | NegationUndef -> [Case "acc";Case "gen"] |
75 | 49 | |
76 | -let transform_np_phrase lemma = function | |
77 | - NP(Case case) -> [NP(Case case)(*;NumP(Case case)*)] | |
78 | - | NP(CaseAgr) -> [NP(CaseAgr)(*;NumP(CaseAgr)*)] | |
79 | - | NCP(Case c,ctype,comp) -> [NCP(Case c,ctype,comp)] | |
80 | - | NP(CaseUndef) -> [NP(CaseUndef)(*;NumP(Case case)*)] | |
81 | - | AdjP(Case _) as morf -> [morf] (* tylko 'zagłada adjp(postp)' *) | |
82 | - | AdjP(CaseAgr) -> [AdjP(AllAgr)] | |
83 | - | AdjP(Str) -> [AdjP(AllAgr)] (* chyba błąd walentego, tylko 'barwa', 'bieda', 'głód', 'kolor', 'nędza', 'śmierć', 'usta' *) | |
50 | +let transform_phrase pos lemma = function | |
84 | 51 | | CP(ctype,comp) as morf -> [morf] |
85 | 52 | | PrepNP _ as morf -> [morf] |
86 | - | PrepAdjP _ as morf -> [morf] (* to wygląda seryjny błąd w Walentym xp(abl[prepadjp(z,gen)]) *) | |
53 | + | PrepAdjP _ as morf -> [morf] | |
87 | 54 | | ComprepNP _ as morf -> [morf] |
88 | 55 | | ComparP _ as morf -> [morf] |
89 | 56 | | PrepNCP _ as morf -> [morf] |
90 | - | ColonP as morf -> [morf] | |
91 | - | AdvP _ as morf -> [morf] (* występuje tylko w lematach: cyrk, trwałość x2, zagłada *) | |
57 | + | InfP _ as morf -> [morf] | |
58 | + | AdvP _ as morf -> [morf] | |
59 | + | XP as morf -> [morf] | |
60 | + | AdjA as morf -> [morf] | |
61 | + | PadvP as morf -> [morf] | |
62 | + | Qub as morf -> [morf] | |
92 | 63 | | FixedP _ as morf -> [morf] |
64 | + | SymbolP as morf -> [morf] | |
65 | + | ColonP as morf -> [morf] | |
66 | + | Inclusion as morf -> [morf] | |
93 | 67 | | Or as morf -> [morf] |
94 | - (* | Pro as morf -> [morf] *) | |
68 | + | Pro as morf -> [morf] | |
95 | 69 | | Null as morf -> [morf] |
96 | - | phrase -> failwith ("transform_np_phrase: " ^ lemma ^ " " ^ ENIAMwalStringOf.phrase phrase) | |
70 | + | morf -> failwith ("transform_phrase: " ^ lemma ^ " " ^ pos ^ " " ^ ENIAMwalStringOf.phrase morf) | |
71 | + | |
72 | +let transform_noun_phrase lemma = function | |
73 | + NP(Case case) -> [NP(Case case)(*;NumP(Case case)*)] | |
74 | + | NP(CaseAgr) -> [NP(CaseAgr)(*;NumP(CaseAgr)*)] | |
75 | + | NPA(CaseAgr) -> [NPA(CaseAgr)(*;NumP(CaseAgr)*)] | |
76 | + | NCP(Case c,ctype,comp) -> [NCP(Case c,ctype,comp)] | |
77 | + | NP(CaseUndef) -> [NP(CaseUndef)(*;NumP(Case case)*)] | |
78 | + | AdjP(Case _) as morf -> [morf] (* tylko 'zagłada adjp(postp)' *) | |
79 | + | AdjP(CaseAgr) -> [AdjP(AllAgr)] | |
80 | + | AdjP(Str) -> [AdjP(AllAgr)] (* chyba błąd walentego, tylko 'barwa', 'bieda', 'głód', 'kolor', 'nędza', 'śmierć', 'usta' *) | |
81 | + | morf -> transform_phrase "noun" lemma morf | |
97 | 82 | |
98 | -let transform_np_pos lemma = function | |
83 | +let transform_noun_pos lemma = function | |
99 | 84 | | SUBST(_,Case _) as morf -> [morf] |
100 | 85 | | PPRON3(_,Case _) as morf -> [morf] |
101 | 86 | | SUBST(_,CaseAgr) as morf -> [morf] |
... | ... | @@ -112,26 +97,14 @@ let transform_np_pos lemma = function |
112 | 97 | | COMP _ as morf -> [morf] |
113 | 98 | | QUB as morf -> [morf] |
114 | 99 | | PERS _ as morf -> [morf] |
115 | - | pos -> failwith ("transform_np_pos: " ^ lemma ^ " " ^ ENIAMwalStringOf.pos pos) | |
100 | + | pos -> failwith ("transform_noun_pos: " ^ lemma ^ " " ^ ENIAMwalStringOf.pos pos) | |
116 | 101 | |
117 | 102 | let transform_adj_phrase lemma = function |
118 | 103 | NP(Case case) -> [NP(Case case)(*;NumP(Case case)*)] |
119 | 104 | | NP(Part) -> [NP(Case "gen");NP(Case "acc")(*;NumP(Case "gen");NumP(Case "acc")*)] (* jedno wystąpienie 'krewny' *) |
120 | 105 | | NCP(Case c,ctype,comp) -> [NCP(Case c,ctype,comp)] |
121 | 106 | | AdjP(CaseAgr) -> [AdjP(AllAgr)] (* jedno wystąpienie 'cały szczęśliwy', może się przydać podniesienie typu *) |
122 | - | CP(ctype,comp) as morf -> [morf] | |
123 | - | PrepNP _ as morf -> [morf] | |
124 | - | PrepAdjP _ as morf -> [morf] | |
125 | - | ComprepNP _ as morf -> [morf] | |
126 | - | ComparP _ as morf -> [morf] | |
127 | - | PrepNCP _ as morf -> [morf] | |
128 | - | InfP _ as morf -> [morf] | |
129 | - | AdvP _ as morf -> [morf] | |
130 | - (* | FixedP _ as morf -> [morf]*) | |
131 | - | Or as morf -> [morf] (* jedno wystąpienie 'jednoznaczny' *) | |
132 | - (* | Pro as morf -> [morf] *) | |
133 | - | Null as morf -> [morf] | |
134 | - | morf -> failwith ("transform_adj_phrase: " ^ lemma ^ " " ^ ENIAMwalStringOf.phrase morf) | |
107 | + | morf -> transform_phrase "adj" lemma morf | |
135 | 108 | |
136 | 109 | let transform_adj_pos lemma = function |
137 | 110 | | ADJ(n,CaseAgr,g,gr) -> [ADJ(n,AllAgr,g,gr)] |
... | ... | @@ -141,22 +114,10 @@ let transform_adj_pos lemma = function |
141 | 114 | | morf -> failwith ("transform_adj_pos: " ^ lemma ^ " " ^ ENIAMwalStringOf.pos morf) |
142 | 115 | |
143 | 116 | let transform_adv_phrase lemma = function |
144 | - NP(Case case) -> [NP(Case case)(*;NumP(Case case)*)] | |
117 | + NP(Case case) -> [NP(Case case)] | |
118 | + | NP(CaseUndef) -> [NP(CaseUndef)] | |
145 | 119 | | NCP(Case c,ctype,comp) -> [NCP(Case c,ctype,comp)] |
146 | - | CP(ctype,comp) as morf -> [morf] | |
147 | - | PrepNP _ as morf -> [morf] | |
148 | - | PrepAdjP _ as morf -> [morf] | |
149 | - | ComprepNP _ as morf -> [morf] | |
150 | - | ComparP _ as morf -> [morf] | |
151 | - | PrepNCP _ as morf -> [morf] | |
152 | - | InfP _ as morf -> [morf] | |
153 | - | AdvP _ as morf -> [morf] | |
154 | -(* | Or as morf -> [morf]*) | |
155 | - (* | Pro as morf -> [morf] *) | |
156 | - | Null as morf -> [morf] | |
157 | -(* | AdjP(CaseAgr) as morf -> [morf]*) | |
158 | - (* | FixedP _ as morf -> [morf]*) | |
159 | - | morf -> failwith ("transform_adv_phrase: " ^ lemma ^ " " ^ ENIAMwalStringOf.phrase morf) | |
120 | + | morf -> transform_phrase "adv" lemma morf | |
160 | 121 | |
161 | 122 | let transform_adv_pos lemma = function |
162 | 123 | SUBST(_,Case _) as morf -> [morf] |
... | ... | @@ -168,7 +129,8 @@ let transform_adv_pos lemma = function |
168 | 129 | | morf -> failwith ("transform_adv_pos: " ^ lemma ^ " " ^ ENIAMwalStringOf.pos morf) |
169 | 130 | |
170 | 131 | let transform_prep_phrase lemma = function |
171 | - | phrase -> failwith ("transform_prep_phrase: " ^ lemma ^ " " ^ ENIAMwalStringOf.phrase phrase) | |
132 | + NP(Case case) -> [NP(Case case)] | |
133 | + | morf -> transform_phrase "prep" lemma morf | |
172 | 134 | |
173 | 135 | let transform_prep_pos lemma = function |
174 | 136 | | SUBST(_,Case _) as morf -> [morf] |
... | ... | @@ -180,16 +142,14 @@ let transform_prep_pos lemma = function |
180 | 142 | | ADJ(_,Case _,_,_) as morf -> [morf] |
181 | 143 | | GER(_,Case _,_,_,_) as morf -> [morf] |
182 | 144 | | PPAS(_,Case _,_,_,_) as morf -> [morf] |
183 | -(* | ADV _ as morf -> [morf] | |
184 | - | QUB as morf -> [morf]*) | |
145 | +(* | ADV _ as morf -> [morf]*) | |
146 | + | QUB as morf -> [morf] | |
185 | 147 | | pos -> failwith ("transform_prep_pos: " ^ lemma ^ " " ^ ENIAMwalStringOf.pos pos) |
186 | 148 | |
187 | 149 | let transform_comprep_phrase lemma = function |
188 | 150 | NP(Case case) -> [NP(Case case)(*;NumP(Case case)*)] |
189 | 151 | | NCP(Case c,ctype,comp) -> [NCP(Case c,ctype,comp)] |
190 | - | PrepNP _ as morf -> [morf] | |
191 | - | PrepNCP _ as morf -> [morf] | |
192 | - | phrase -> failwith ("transform_comprep_phrase: " ^ lemma ^ " " ^ ENIAMwalStringOf.phrase phrase) | |
152 | + | morf -> transform_phrase "comprep" lemma morf | |
193 | 153 | |
194 | 154 | let transform_comprep_pos lemma = function |
195 | 155 | | SUBST(_,Case _) as morf -> [morf] |
... | ... | @@ -204,8 +164,7 @@ let transform_comprep_pos lemma = function |
204 | 164 | |
205 | 165 | let transform_compar_phrase lemma = function |
206 | 166 | | NP(Str) -> Xlist.map ["nom";"gen";"dat";"acc";"inst"] (fun case -> NP(Case case)) (* FIXME: sprawdzić kto kontroluje! *) (* FIXME: uzgodnić a komparatywem *) |
207 | - | FixedP _ as morf -> [morf] | |
208 | - | phrase -> failwith ("transform_compar_phrase: " ^ lemma ^ " " ^ ENIAMwalStringOf.phrase phrase) | |
167 | + | morf -> transform_phrase "compar" lemma morf | |
209 | 168 | |
210 | 169 | let transform_compar_pos lemma = function |
211 | 170 | | SUBST(_,Case _) as morf -> [morf] |
... | ... | @@ -222,43 +181,27 @@ let transform_compar_pos lemma = function |
222 | 181 | | NUM(Case _,_) as morf -> [morf] |
223 | 182 | | pos -> failwith ("transform_compar_pos: " ^ lemma ^ " " ^ ENIAMwalStringOf.pos pos) |
224 | 183 | |
225 | -let transform_comp_phrase lemma = function | |
226 | - | phrase -> failwith ("transform_comp_phrase: " ^ lemma ^ " " ^ ENIAMwalStringOf.phrase phrase) | |
227 | - | |
228 | 184 | let transform_comp_pos lemma = function |
229 | 185 | | PERS _ as morf -> [morf] |
230 | 186 | | pos -> failwith ("transform_comp_pos: " ^ lemma ^ " " ^ ENIAMwalStringOf.pos pos) |
231 | 187 | |
232 | -let transform_qub_phrase lemma = function | |
233 | - | phrase -> failwith ("transform_qub_phrase: " ^ lemma ^ " " ^ ENIAMwalStringOf.phrase phrase) | |
234 | - | |
235 | 188 | let transform_qub_pos lemma = function |
236 | 189 | | QUB as morf -> [morf] |
237 | 190 | | pos -> failwith ("transform_qub_pos: " ^ lemma ^ " " ^ ENIAMwalStringOf.pos pos) |
238 | 191 | |
239 | 192 | let transform_interj_phrase lemma = function |
240 | 193 | NP(Case "nom") as morf -> [morf] |
241 | - | Null -> [Null] | |
242 | - | phrase -> failwith ("transform_interj_phrase: " ^ lemma ^ " " ^ ENIAMwalStringOf.phrase phrase) | |
194 | + | morf -> transform_phrase "interj" lemma morf | |
243 | 195 | |
244 | 196 | let transform_interj_pos lemma = function |
245 | 197 | | pos -> failwith ("transform_interj_pos: " ^ lemma ^ " " ^ ENIAMwalStringOf.pos pos) |
246 | 198 | |
247 | -let transform_sinterj_phrase lemma = function | |
248 | - | phrase -> failwith ("transform_sinterj_phrase: " ^ lemma ^ " " ^ ENIAMwalStringOf.phrase phrase) | |
249 | - | |
250 | 199 | let transform_sinterj_pos lemma = function |
251 | 200 | | pos -> failwith ("transform_sinterj_pos: " ^ lemma ^ " " ^ ENIAMwalStringOf.pos pos) |
252 | 201 | |
253 | -let transform_aglt_phrase lemma = function | |
254 | - | phrase -> failwith ("transform_aglt_phrase: " ^ lemma ^ " " ^ ENIAMwalStringOf.phrase phrase) | |
255 | - | |
256 | 202 | let transform_aglt_pos lemma = function |
257 | 203 | | pos -> failwith ("transform_aglt_pos: " ^ lemma ^ " " ^ ENIAMwalStringOf.pos pos) |
258 | 204 | |
259 | -let transform_siebie_phrase lemma = function | |
260 | - | phrase -> failwith ("transform_siebie_phrase: " ^ lemma ^ " " ^ ENIAMwalStringOf.phrase phrase) | |
261 | - | |
262 | 205 | let transform_siebie_pos lemma = function |
263 | 206 | | ADJ(NumberAgr,CaseAgr,GenderAgr,gr) -> [ADJ(NumberAgr,AllAgr,GenderAgr,gr)] |
264 | 207 | | pos -> failwith ("transform_siebie_pos: " ^ lemma ^ " " ^ ENIAMwalStringOf.pos pos) |
... | ... | @@ -267,12 +210,8 @@ let transform_pers_subj_phrase lemma negation mood = function (* FIXME: prepnp(n |
267 | 210 | | NP(Str) -> [NP(NomAgr);NP(VocAgr)(*;NumP(NomAgr)*)] |
268 | 211 | | NP(Part) -> [NP(Case "gen");NP(Case "acc")(*;NumP(Case "gen");NumP(Case "acc")*)] (* tylko w 'nalewać', 'nalać', 'ponalewać', 'najechać','uzbierać' *) |
269 | 212 | | NCP(Str,ctype,comp) -> [NCP(NomAgr,ctype,comp);NCP(VocAgr,ctype,comp)] |
270 | - | CP(ctype,comp) as morf -> [morf] | |
271 | - | InfP _ as morf -> [morf] | |
272 | - | Or as morf -> [morf] | |
273 | 213 | | Pro -> [ProNG] |
274 | - | Null -> [Null] | |
275 | - | morf -> failwith ("transform_pers_subj_phrase: " ^ lemma ^ " " ^ ENIAMwalStringOf.phrase morf) | |
214 | + | morf -> transform_phrase "pers_subj" lemma morf | |
276 | 215 | |
277 | 216 | let transform_pers_subj_pos lemma negation mood = function |
278 | 217 | (* COMP _ as morf -> [morf]*) |
... | ... | @@ -284,15 +223,11 @@ let transform_pers_subj_pos lemma negation mood = function |
284 | 223 | | morf -> failwith ("transform_pers_subj_pos: " ^ lemma ^ " " ^ ENIAMwalStringOf.pos morf) |
285 | 224 | |
286 | 225 | let transform_ger_subj_phrase lemma negation mood control = function |
287 | - | NP(Str) -> [NP(Case "gen");PrepNP(Pnosem,"przez",Case "acc")(*;NumP(Case "gen")*)(*;PrepNumP("przez",Case "acc")*)] (* FIXME: czy przez:acc jest możliwe? *) | |
226 | + | NP(Str) -> [NP(Case "gen");PrepNP("przez",Case "acc")(*;NumP(Case "gen")*)(*;PrepNumP("przez",Case "acc")*)] (* FIXME: czy przez:acc jest możliwe? *) | |
288 | 227 | | NP(Part) -> [NP(Case "gen")(*;NP(Case "acc")*)(*;NumP(Case "gen");NumP(Case "acc")*)] |
289 | - | NCP(Str,ctype,comp) -> [NCP(Case "gen",ctype,comp);PrepNCP(Pnosem,"przez",Case "acc",ctype,comp)] (* FIXME: czy przez:acc jest możliwe? *) | |
290 | - | CP(ctype,comp) as morf -> [morf] | |
291 | - | InfP _ as morf -> [morf] (* FIXME: czy to jest możliwe? *) | |
292 | - | Or as morf -> [morf] | |
228 | + | NCP(Str,ctype,comp) -> [NCP(Case "gen",ctype,comp);PrepNCP("przez",Case "acc",ctype,comp)] (* FIXME: czy przez:acc jest możliwe? *) | |
293 | 229 | | Pro -> if control then [Pro] else [Null] |
294 | - | Null -> [Null] | |
295 | - | morf -> failwith ("transform_ger_subj_phrase: " ^ lemma ^ " " ^ ENIAMwalStringOf.phrase morf) | |
230 | + | morf -> transform_phrase "ger_subj" lemma morf | |
296 | 231 | |
297 | 232 | let transform_ger_subj_pos lemma negation mood = function (* FIXME: ADV(_) *) |
298 | 233 | (* COMP _ as morf -> [morf] (* FIXME: czy to jest możliwe? *)*) |
... | ... | @@ -304,11 +239,10 @@ let transform_ger_subj_pos lemma negation mood = function (* FIXME: ADV(_) *) |
304 | 239 | | morf -> failwith ("transform_pers_subj_pos: " ^ lemma ^ " " ^ ENIAMwalStringOf.pos morf) |
305 | 240 | |
306 | 241 | let transform_ppas_subj_phrase lemma negation mood control = function |
307 | - | NP(Str) -> [PrepNP(Pnosem,"przez",Case "acc")(*;PrepNumP("przez",Case "acc")*)] | |
308 | - | NCP(Str,ctype,comp) -> [PrepNCP(Pnosem,"przez",Case "acc",ctype,comp)] | |
309 | - | CP(ctype,comp) as morf -> [morf] | |
242 | + | NP(Str) -> [PrepNP("przez",Case "acc")(*;PrepNumP("przez",Case "acc")*)] | |
243 | + | NCP(Str,ctype,comp) -> [PrepNCP("przez",Case "acc",ctype,comp)] | |
310 | 244 | | Pro -> if control then [Pro] else [Null] |
311 | - | morf -> failwith ("transform_ppas_subj_phrase: " ^ lemma ^ " " ^ ENIAMwalStringOf.phrase morf) | |
245 | + | morf -> transform_phrase "ppas_subj" lemma morf | |
312 | 246 | |
313 | 247 | let transform_pers_phrase lemma negation mood = function |
314 | 248 | | NP(Str) -> List.flatten (Xlist.map (transform_str mood negation) (fun case -> [NP case(*;NumP(case)*)])) |
... | ... | @@ -322,21 +256,9 @@ let transform_pers_phrase lemma negation mood = function |
322 | 256 | | AdjP CaseAgr as morf -> if mood = "gerundial" then [AdjP AllAgr] else (failwith ("transform_pers_phrase2: " ^ lemma ^ " " ^ ENIAMwalStringOf.phrase morf)) |
323 | 257 | | AdjP(Case _) as morf -> [morf] (* FIXME: pomijam uzgadnianie liczby i rodzaju - wykonalne za pomocą kontroli *) |
324 | 258 | | AdjP(NomAgr) as morf -> if mood = "no-subj" then [AdjP(Case "nom")] else [morf] |
325 | - | CP(ctype,comp) as morf -> [morf] | |
326 | - | PrepNP _ as morf -> [morf] | |
327 | - | PrepAdjP _ as morf -> [morf] (* FIXME: pomijam uzgadnianie liczby i rodzaju - wykonalne za pomocą kontroli *) | |
328 | - | ComprepNP _ as morf -> [morf] | |
329 | - | ComparP _ as morf -> [morf] | |
330 | - | PrepNCP _ as morf -> [morf] | |
331 | - | InfP _ as morf -> [morf] | |
332 | 259 | | AdvP "misc" -> if mood = "gerundial" then [AdjP AllAgr] else [AdvP "misc"] |
333 | 260 | | AdvP "mod" -> if mood = "gerundial" then [AdjP AllAgr] else [AdvP "mod"] |
334 | - | AdvP _ as morf -> [morf] | |
335 | - | FixedP _ as morf -> [morf] | |
336 | - | Or as morf -> [morf] | |
337 | - | Pro as morf -> [morf] | |
338 | - | Null as morf -> [morf] | |
339 | - | morf -> failwith ("transform_pers_phrase: " ^ lemma ^ " " ^ ENIAMwalStringOf.phrase morf) | |
261 | + | morf -> transform_phrase "pers" lemma morf | |
340 | 262 | |
341 | 263 | let transform_pers_pos lemma negation mood = function |
342 | 264 | | SUBST(n,Str) -> Xlist.map (transform_str mood negation) (fun case -> SUBST(n,case)) |
... | ... | @@ -370,7 +292,7 @@ let transform_pers_pos lemma negation mood = function |
370 | 292 | let rec transform_comps negation mood = function |
371 | 293 | | CP(ctype,comp) -> Xlist.map (transform_comp negation mood comp) (fun comp -> CP(ctype,comp)) |
372 | 294 | | NCP(case,ctype,comp) -> Xlist.map (transform_comp negation mood comp) (fun comp -> NCP(case,ctype,comp)) |
373 | - | PrepNCP(psem,prep,case,ctype,comp) -> Xlist.map (transform_comp negation mood comp) (fun comp -> PrepNCP(psem,prep,case,ctype,comp)) | |
295 | + | PrepNCP(prep,case,ctype,comp) -> Xlist.map (transform_comp negation mood comp) (fun comp -> PrepNCP(prep,case,ctype,comp)) | |
374 | 296 | | E phrase -> Xlist.map (transform_comps negation mood phrase) (fun phrase -> E phrase) |
375 | 297 | | morf -> [morf] |
376 | 298 | |
... | ... | @@ -383,24 +305,25 @@ let transform_preps morf = |
383 | 305 | let morf = match morf with |
384 | 306 | | LexArg(id,lex,PREP c) -> if is_compar lex then LexArg(id,lex,COMPAR c) else LexArg(id,lex,PREP c) |
385 | 307 | | SimpleLexArg(lex,PREP c) -> if is_compar lex then SimpleLexArg(lex,COMPAR c) else SimpleLexArg(lex,PREP c) |
386 | - | PrepNP(psem,prep,c) -> if is_compar prep then ComparP(prep,c) else PrepNP(psem,prep,c) | |
308 | + | PrepNP(prep,c) -> if is_compar prep then ComparP(prep,c) else PrepNP(prep,c) | |
387 | 309 | | PrepAdjP(prep,c) -> if is_compar prep then ComparP(prep,c) else PrepAdjP(prep,c) |
388 | - | PrepNCP(psem,prep,case,ctype,comp) as morf -> if is_compar prep then failwith "transform_preps 1" else morf | |
310 | + | PrepNCP(prep,case,ctype,comp) as morf -> if is_compar prep then failwith "transform_preps 1" else morf | |
389 | 311 | | morf -> morf in |
390 | 312 | match morf with |
391 | 313 | | ComparP(prep,Str) -> Xlist.map ["nom";"gen";"dat";"acc";"inst";"postp"] (fun case -> ComparP(prep,Case case)) |
392 | - | ComparP _ -> failwith "transform_preps 2" | |
314 | + | ComparP(_,CaseUndef) as morf -> [morf] | |
315 | + | ComparP(_,Case _) as morf -> [morf] | |
393 | 316 | | LexArg(id,lex,COMPAR Str) -> Xlist.map ["nom";"gen";"dat";"acc";"inst";"postp"] (fun case -> LexArg(id,lex,COMPAR (Case case))) |
394 | 317 | | SimpleLexArg(lex,COMPAR Str) -> Xlist.map ["nom";"gen";"dat";"acc";"inst";"postp"] (fun case -> SimpleLexArg(lex,COMPAR (Case case))) |
395 | 318 | | LexArg(id,lex,COMPAR (Case _)) as morf -> [morf] |
396 | 319 | | SimpleLexArg(lex,COMPAR (Case _)) as morf -> [morf] |
397 | 320 | | LexArg(id,lex,COMPAR _) -> failwith "transform_preps 3" |
398 | 321 | | SimpleLexArg(lex,COMPAR _) -> failwith "transform_preps 4" |
399 | - | PrepNP(sem,"per",Str) -> [PrepNP(sem,"per",Case "nom");PrepNP(sem,"per",Case "voc")] (* FIXME: voc do poprawienie w leksykonie *) | |
400 | - | PrepNP(_,_,Case _) as morf -> [morf] | |
322 | + | PrepNP("per",Str) -> [PrepNP("per",Case "nom");PrepNP("per",Case "voc")] (* FIXME: voc do poprawienie w leksykonie *) | |
323 | + | PrepNP(_,Case _) as morf -> [morf] | |
401 | 324 | | PrepAdjP(_,Case _) as morf -> [morf] |
402 | - | PrepNCP(_,_,Case _,_,_) as morf -> [morf] | |
403 | - | PrepNP(_,_,CaseUndef) as morf -> [morf] | |
325 | + | PrepNCP(_,Case _,_,_) as morf -> [morf] | |
326 | + | PrepNP(_,CaseUndef) as morf -> [morf] | |
404 | 327 | | PrepNP _ as morf -> failwith ("transform_preps 5: " ^ ENIAMwalStringOf.phrase morf) |
405 | 328 | | PrepAdjP _ -> failwith "transform_preps 6" |
406 | 329 | | PrepNCP _ -> failwith "transform_preps 7" |
... | ... | @@ -502,18 +425,18 @@ let transform_num_schema acm schema = |
502 | 425 | |
503 | 426 | let transform_schema pos lemma schema = |
504 | 427 | let phrase_fun,pos_fun = match pos with |
505 | - "subst" -> transform_np_phrase,transform_np_pos | |
428 | + "subst" -> transform_noun_phrase,transform_noun_pos | |
506 | 429 | | "adj" -> transform_adj_phrase,transform_adj_pos |
507 | 430 | | "adv" -> transform_adv_phrase,transform_adv_pos |
508 | - | "prep" -> transform_prep_phrase,transform_prep_pos | |
431 | + | "prep" | "x" -> transform_prep_phrase,transform_prep_pos | |
509 | 432 | | "comprep" -> transform_comprep_phrase,transform_comprep_pos |
510 | 433 | | "compar" -> transform_compar_phrase,transform_compar_pos |
511 | - | "comp" -> transform_comp_phrase,transform_comp_pos | |
512 | - | "qub" -> transform_qub_phrase,transform_qub_pos | |
513 | - | "siebie" -> transform_siebie_phrase,transform_siebie_pos | |
434 | + | "comp" -> transform_phrase "comp",transform_comp_pos | |
435 | + | "qub" -> transform_phrase "qub",transform_qub_pos | |
436 | + | "siebie" -> transform_phrase "siebie",transform_siebie_pos | |
514 | 437 | | "interj" -> transform_interj_phrase,transform_interj_pos |
515 | - | "sinterj" -> transform_sinterj_phrase,transform_interj_pos | |
516 | - | "aglt" -> transform_aglt_phrase,transform_interj_pos | |
438 | + | "sinterj" -> transform_phrase "sinterj",transform_interj_pos | |
439 | + | "aglt" -> transform_phrase "aglt",transform_interj_pos | |
517 | 440 | | _ -> failwith "transform_schema" |
518 | 441 | in |
519 | 442 | Xlist.map schema (fun s -> |
... | ... | @@ -550,15 +473,18 @@ let aspect_sel = function |
550 | 473 | open ENIAM_LCGlexiconTypes |
551 | 474 | |
552 | 475 | let transform_entry pos lemma negation pred aspect schema = |
476 | + (* print_endline "transform_entry: start"; *) | |
553 | 477 | match pos with |
554 | - "subst" |"depr" -> | |
478 | + "subst" | "depr" | "year" | "day" | "day-month" | "date" | "date-interval" | | |
479 | + "hour-minute" | "hour" | "hour-minute-interval" | "hour-interval" | | |
480 | + "day-interval" | "day-month-interval" | "month-interval" | "year-interval" | "initial" | "fixed" -> | |
555 | 481 | if negation <> NegationUndef || pred <> PredFalse || aspect <> AspectUndef then failwith ("transform_entry 1"); |
556 | 482 | [[],transform_schema "subst" lemma schema] |
557 | - | "adj" |"adjc" |"adjp" -> | |
483 | + | "adj" | "adja" | "adjc" |"adjp" -> | |
558 | 484 | if negation <> NegationUndef || aspect <> AspectUndef then failwith ("transform_entry 2"); |
559 | 485 | let sel = match pred with PredTrue -> [Case,Eq,["pred"]] | _ -> [] in |
560 | 486 | [sel,transform_schema "adj" lemma schema] |
561 | - | "adv" | "prep" | "comprep" | "comp" | "compar" | "qub" | "siebie" -> | |
487 | + | "adv" | "prep" | "comprep" | "comp" | "compar" | "qub" | "siebie" | "x" -> | |
562 | 488 | if negation <> NegationUndef || (*pred <> PredFalse ||*) aspect <> AspectUndef then failwith ("transform_entry 3"); (* FIXME: typy przysłówków *) |
563 | 489 | [[],transform_schema pos lemma schema] |
564 | 490 | | _ -> |
... | ... | @@ -570,6 +496,13 @@ let transform_entry pos lemma negation pred aspect schema = |
570 | 496 | if pos = "interj" then ( |
571 | 497 | if negation <> NegationUndef || pred <> PredFalse || aspect <> AspectUndef then failwith ("transform_entry 6"); |
572 | 498 | [[],transform_schema "interj" lemma schema]) else |
499 | + if (pos = "conj" || pos = "interp" || pos = "ppron12" || pos = "ppron3" || pos = "numcomp" || pos = "realnum" || | |
500 | + pos = "intnum-interval" || pos = "realnum-interval" || pos = "symbol" || pos = "ordnum" || pos = "roman" || | |
501 | + pos = "roman-interval" || pos = "roman-ordnum" || pos = "match-result" || pos = "url" || pos = "email" || | |
502 | + pos = "phone-number" || pos = "postal-code" || pos = "obj-id" || pos = "building-number" || pos = "list-item" || | |
503 | + pos = "aglt" || pos = "pacta" || pos = "part" || pos = "conj" || pos = "sinterj" || pos = "burk" || | |
504 | + pos = "interp" || pos = "xxx" || pos = "unk" || pos = "html-tag" || pos = "apron" || pos = "x" || | |
505 | + pos = "other") && schema = [] then [[],[]] else | |
573 | 506 | List.flatten (Xlist.map (expand_negation negation) (fun negation -> |
574 | 507 | let sel = [Negation,Eq,[ENIAMwalStringOf.negation negation]] @ aspect_sel aspect in |
575 | 508 | if pos = "fin" || pos = "bedzie" then |
... | ... | @@ -594,7 +527,7 @@ let transform_entry pos lemma negation pred aspect schema = |
594 | 527 | with Not_found -> [] else |
595 | 528 | if pos = "ger" then |
596 | 529 | [sel,transform_ger_schema lemma negation schema] else |
597 | - if schema = [] then [[],[]] else | |
530 | + (* if schema = [] then (print_endline "transform_entry: empty"; [[],[]]) else *) | |
598 | 531 | failwith ("transform_entry: " ^ pos))) |
599 | 532 | |
600 | 533 | let transform_lex_entry pos lemma = function |
... | ... |
lexSemantics/ENIAMwalParser.ml
... | ... | @@ -249,14 +249,14 @@ let parse_pos = function |
249 | 249 | |
250 | 250 | let rec parse_phrase = function |
251 | 251 | "np",[case] -> NP(parse_case case) |
252 | - | "prepnp",[[Text prep]; case] -> PrepNP(Psem,prep,parse_case case) | |
252 | + | "prepnp",[[Text prep]; case] -> PrepNP((*Psem,*)prep,parse_case case) | |
253 | 253 | | "adjp",[case] -> AdjP(parse_case case) |
254 | 254 | | "prepadjp",[[Text prep]; case] -> PrepAdjP(prep,parse_case case) |
255 | 255 | | "comprepnp",[[Text prep]] -> ComprepNP prep |
256 | - | "comparp",[[Text prep]] -> ComparP(prep,Str) | |
256 | + | "comparp",[[Text prep]] -> ComparP((*Psem,*)prep,Str) | |
257 | 257 | | "cp",[ctype;comp] -> CP(parse_ctype ctype,parse_comp comp) |
258 | 258 | | "ncp",[case;ctype;comp] -> NCP(parse_case case,parse_ctype ctype,parse_comp comp) |
259 | - | "prepncp",[[Text prep];case;ctype;comp] -> PrepNCP(Psem,prep,parse_case case,parse_ctype ctype,parse_comp comp) | |
259 | + | "prepncp",[[Text prep];case;ctype;comp] -> PrepNCP((*Psem,*)prep,parse_case case,parse_ctype ctype,parse_comp comp) | |
260 | 260 | | "infp",[aspect] -> InfP(parse_aspect aspect) |
261 | 261 | | "fixed",[[Text lemma]] -> FixedP lemma |
262 | 262 | | "fixed",[[Text lemma1];[Text lemma2]] -> FixedP (lemma1 ^ "," ^ lemma2) |
... | ... |
lexSemantics/ENIAMwalReduce.ml
... | ... | @@ -21,9 +21,9 @@ open ENIAMwalTypes |
21 | 21 | open Xstd |
22 | 22 | |
23 | 23 | let create_phrase_reqs s (reqs,noreqs) = function |
24 | - | PrepNP(_,prep,_) -> StringMap.add_inc reqs s (StringSet.singleton prep) (fun set -> StringSet.add set prep), noreqs | |
24 | + | PrepNP(prep,_) -> StringMap.add_inc reqs s (StringSet.singleton prep) (fun set -> StringSet.add set prep), noreqs | |
25 | 25 | | PrepAdjP(prep,_) -> StringMap.add_inc reqs s (StringSet.singleton prep) (fun set -> StringSet.add set prep), noreqs |
26 | - | PrepNCP(_,prep,_,_,_) -> StringMap.add_inc reqs s (StringSet.singleton prep) (fun set -> StringSet.add set prep), noreqs | |
26 | + | PrepNCP(prep,_,_,_) -> StringMap.add_inc reqs s (StringSet.singleton prep) (fun set -> StringSet.add set prep), noreqs | |
27 | 27 | | ComparP(prep,_) -> StringMap.add_inc reqs s (StringSet.singleton prep) (fun set -> StringSet.add set prep), noreqs |
28 | 28 | | FixedP(prep) -> StringMap.add_inc reqs s (StringSet.singleton prep) (fun set -> StringSet.add set prep), noreqs |
29 | 29 | | SimpleLexArg(lex,_) -> StringMap.add_inc reqs s (StringSet.singleton lex) (fun set -> StringSet.add set lex), noreqs |
... | ... | @@ -32,9 +32,9 @@ let create_phrase_reqs s (reqs,noreqs) = function |
32 | 32 | | _ -> reqs, StringSet.add noreqs s |
33 | 33 | |
34 | 34 | let create_phrase_reqs2 s (reqs,noreqs) = function |
35 | - | PrepNP(_,prep,_) -> IntMap.add_inc reqs s (StringSet.singleton prep) (fun set -> StringSet.add set prep), noreqs | |
35 | + | PrepNP(prep,_) -> IntMap.add_inc reqs s (StringSet.singleton prep) (fun set -> StringSet.add set prep), noreqs | |
36 | 36 | | PrepAdjP(prep,_) -> IntMap.add_inc reqs s (StringSet.singleton prep) (fun set -> StringSet.add set prep), noreqs |
37 | - | PrepNCP(_,prep,_,_,_) -> IntMap.add_inc reqs s (StringSet.singleton prep) (fun set -> StringSet.add set prep), noreqs | |
37 | + | PrepNCP(prep,_,_,_) -> IntMap.add_inc reqs s (StringSet.singleton prep) (fun set -> StringSet.add set prep), noreqs | |
38 | 38 | | ComparP(prep,_) -> IntMap.add_inc reqs s (StringSet.singleton prep) (fun set -> StringSet.add set prep), noreqs |
39 | 39 | | FixedP(prep) -> IntMap.add_inc reqs s (StringSet.singleton prep) (fun set -> StringSet.add set prep), noreqs |
40 | 40 | | SimpleLexArg(lex,_) -> IntMap.add_inc reqs s (StringSet.singleton lex) (fun set -> StringSet.add set lex), noreqs |
... | ... | @@ -123,13 +123,13 @@ let rec reduce_comp test_lexemes = function |
123 | 123 | | CompUndef -> failwith "reduce_comp" |
124 | 124 | |
125 | 125 | let reduce_phrase (test_comprep_reqs,test_comprep_reqs2,test_lexarg_reqs,test_lexemes) = function |
126 | - | PrepNP(_,prep,case) as phrase -> if test_lexemes prep then phrase else raise Not_found | |
126 | + | PrepNP(prep,case) as phrase -> if test_lexemes prep then phrase else raise Not_found | |
127 | 127 | | PrepAdjP(prep,case) as phrase -> if test_lexemes prep then phrase else raise Not_found |
128 | 128 | | ComprepNP(prep) as phrase -> if test_comprep_reqs prep && test_comprep_reqs2 prep then phrase else raise Not_found |
129 | 129 | | ComparP(prep,case) as phrase -> if test_lexemes prep then phrase else raise Not_found |
130 | 130 | | CP(ctype,comp) -> CP(ctype,reduce_comp test_lexemes comp) |
131 | 131 | | NCP(case,ctype,comp) -> if test_lexemes "to" then NCP(case,ctype,reduce_comp test_lexemes comp) else raise Not_found |
132 | - | PrepNCP(psem,prep,case,ctype,comp) -> if test_lexemes prep && test_lexemes "to" then PrepNCP(psem,prep,case,ctype,reduce_comp test_lexemes comp) else raise Not_found | |
132 | + | PrepNCP(prep,case,ctype,comp) -> if test_lexemes prep && test_lexemes "to" then PrepNCP(prep,case,ctype,reduce_comp test_lexemes comp) else raise Not_found | |
133 | 133 | | SimpleLexArg(lemma,_) as phrase -> if test_lexemes lemma then phrase else raise Not_found |
134 | 134 | | LexArg(id,lemma,_) as phrase -> if test_lexemes lemma && test_lexarg_reqs id then phrase else raise Not_found |
135 | 135 | | FixedP lemma as phrase -> if test_lexemes lemma then phrase else raise Not_found |
... | ... | @@ -155,6 +155,7 @@ let rec reduce_schema tests = function |
155 | 155 | {s with morfs=morfs} :: reduce_schema tests l |
156 | 156 | |
157 | 157 | let reduce_entries lexemes entries = |
158 | + let lexemes = StringSet.add lexemes "" in | |
158 | 159 | StringMap.map entries (fun entries -> |
159 | 160 | StringSet.fold lexemes StringMap.empty (fun reduced lemma -> |
160 | 161 | try StringMap.add reduced lemma (StringMap.find entries lemma) |
... | ... |
lexSemantics/ENIAMwalRenderer.ml
... | ... | @@ -107,21 +107,26 @@ let render_pos = function (* wprowadzam uzgodnienia a nie wartości cech, bo war |
107 | 107 | | pos -> failwith ("render_pos: " ^ ENIAMwalStringOf.pos pos) |
108 | 108 | |
109 | 109 | let render_phrase = function |
110 | - NP(Case case) -> Tensor[Atom "np"; Top; Atom case; Top; Top] | |
111 | - | NP NomAgr -> Tensor[Atom "np"; AVar "number"; Atom "nom"; AVar "gender"; AVar "person"] | |
110 | + NP(Case case) -> Tensor[Atom "np"; Top; Atom case; Top; Top; Top; Top; Top] | |
111 | + | NP NomAgr -> Tensor[Atom "np"; AVar "number"; Atom "nom"; AVar "gender"; AVar "person"; Top; Top; Top] | |
112 | + | NP VocAgr -> Tensor[Atom "np"; AVar "number"; Atom "voc"; AVar "gender"; AVar "person"; Top; Top; Top] | |
112 | 113 | (* | NP GenAgr -> Tensor[Atom "np"; AVar "number"; Atom "gen"; AVar "gender"; AVar "person"] |
113 | 114 | | NP AllAgr -> Tensor[Atom "np"; AVar "number"; AVar "case"; AVar "gender"; AVar "person"]*) |
114 | - | NP CaseAgr -> Tensor[Atom "np"; Top; AVar "case"; Top; Top] | |
115 | -(* | NP CaseUndef -> Tensor[Atom "np"; Top; Top; Top; Top] | |
116 | - | PrepNP("",CaseUndef) -> Tensor[Atom "prepnp"; Top; Top]*) | |
117 | - | PrepNP(Psem,prep,Case case) -> Tensor[Atom "prepnp"; Atom "sem"; Atom prep; Atom case] | |
118 | - | PrepNP(Pnosem,prep,Case case) -> Tensor[Atom "prepnp"; Atom "nosem"; Atom prep; Atom case] | |
119 | - | AdjP(Case case) -> Tensor[Atom "adjp"; Top; Atom case; Top] | |
120 | - | AdjP NomAgr -> Tensor[Atom "adjp"; AVar "number"; Atom "nom"; AVar "gender"] | |
121 | - | AdjP AllAgr -> Tensor[Atom "adjp"; AVar "number"; AVar "case"; AVar "gender"] | |
115 | + | NP CaseAgr -> Tensor[Atom "np"; Top; AVar "case"; Top; Top; Top; Top; Top] | |
116 | + | NP CaseUndef -> Tensor[Atom "np"; Top; Top; Top; Top; Top; Top; Top] | |
117 | + | NPA CaseAgr -> Tensor[Atom "npa"; Top; AVar "case"; Top; Top; Top; Top; Top] | |
118 | + | PrepNP("",CaseUndef) -> Tensor[Atom "prepnp"; (*Atom "sem";*) Top; Top; Top; Top; Top] | |
119 | + | PrepNP("_",CaseUndef) -> Tensor[Atom "prepnp";(* Atom "sem";*) Top; Top; Top; Top; Top] | |
120 | + | PrepNP("_",Case case) -> Tensor[Atom "prepnp"; (*Atom "sem";*) Top; Atom case; Top; Top; Top] | |
121 | + | PrepNP(prep,CaseUndef) -> Tensor[Atom "prepnp"; (*Atom "sem";*) Atom prep; Top; Top; Top; Top] | |
122 | + | PrepNP(prep,Case case) -> Tensor[Atom "prepnp"; (*Atom "sem";*) Atom prep; Atom case; Top; Top; Top] | |
123 | + | AdjP(Case case) -> Tensor[Atom "adjp"; Top; Atom case; Top; Top; Top; Top; Top] | |
124 | + | AdjP NomAgr -> Tensor[Atom "adjp"; AVar "number"; Atom "nom"; AVar "gender"; Top; Top; Top; Top] | |
125 | + | AdjP AllAgr -> Tensor[Atom "adjp"; AVar "number"; AVar "case"; AVar "gender"; Top; Top; Top; Top] | |
122 | 126 | (* | AdjP CaseAgr -> Tensor[Atom "adjp"; Top; AVar "case"; Top] |
123 | 127 | | PrepAdjP("",CaseUndef) -> Tensor[Atom "prepnp"; Top; Top]*) |
124 | - | PrepAdjP(prep,Case case) -> Tensor[Atom "prepadjp"; Atom prep; Atom case] | |
128 | + | AdjA -> Tensor[Atom "adja"; Top; Top; Top] | |
129 | + | PrepAdjP(prep,Case case) -> Tensor[Atom "prepadjp"; Atom prep; Atom case; Top; Top; Top] | |
125 | 130 | (* | NumP(Case case) -> Tensor[Atom "nump"; Top; Atom case; Top; Top] |
126 | 131 | | NumP NomAgr -> Tensor[Atom "nump"; AVar "number"; Atom "nom"; AVar "gender"; AVar "person"] |
127 | 132 | | NumP CaseAgr -> Tensor[Atom "nump"; Top; AVar "case"; Top; Top] |
... | ... | @@ -129,34 +134,47 @@ let render_phrase = function |
129 | 134 | | PrepNumP(_,"",CaseUndef) -> Tensor[Atom "prepnp"; Top; Top] |
130 | 135 | | PrepNumP(_,prep,Case case) -> Tensor[Atom "prepnump"; Atom prep; Atom case] *) |
131 | 136 | (* | ComprepNP("") -> Tensor[Atom "comprepnp"; Top]*) |
132 | - | ComprepNP(prep) -> Tensor[Atom "comprepnp"; Atom prep] | |
133 | - | ComparP(prep,Case case) -> Tensor[Atom "comparp"; Atom prep; Atom case] | |
137 | + | ComprepNP(prep) -> Tensor[Atom "comprepnp"; Atom prep; Top; Top; Top] | |
138 | + | ComparP((*Psem,*)prep,Case case) -> Tensor[Atom "comparp"; (*Atom "sem";*) Atom prep; Atom case; Top; Top; Top] | |
139 | + (* | ComparP(Pnosem,prep,Case case) -> Tensor[Atom "comparp"; Atom "nosem"; Atom prep; Atom case] *) | |
140 | + | ComparP((*Psem,*)prep,CaseUndef) -> Tensor[Atom "comparp"; (*Atom "sem";*) Atom prep; Top; Top; Top; Top] | |
141 | + (* | ComparP(Pnosem,prep,CaseUndef) -> Tensor[Atom "comparp"; Atom "nosem"; Atom prep; Top] *) | |
134 | 142 | (* | ComparPP(_,prep) -> Tensor[Atom "comparpp"; Atom prep] *) |
135 | 143 | (* | IP -> Tensor[Atom "ip";Top;Top;Top] *) |
136 | - | CP (ctype,Comp comp) -> Tensor[Atom "cp"; arg_of_ctype ctype; Atom comp] | |
144 | + | CP (ctype,Comp comp) -> Tensor[Atom "cp"; arg_of_ctype ctype; Atom comp; Top; Top; Top] | |
137 | 145 | (* | CP (ctype,CompUndef) -> Tensor[Atom "cp"; arg_of_ctype ctype; Top]*) |
138 | - | NCP(Case case,ctype,Comp comp) -> Tensor[Atom "ncp"; Top; Atom case; Top; Top; arg_of_ctype ctype; Atom comp] | |
139 | - | NCP(Case case,CompTypeUndef,CompUndef) -> Tensor[Atom "ncp"; Top; Atom case; Top; Top; Top; Top] | |
140 | - | NCP(NomAgr,ctype,Comp comp) -> Tensor[Atom "ncp"; AVar "number"; Atom "nom"; AVar "gender"; AVar "person"; arg_of_ctype ctype; Atom comp] | |
141 | - | NCP(NomAgr,CompTypeUndef,CompUndef) -> Tensor[Atom "ncp"; AVar "number"; Atom "nom"; AVar "gender"; AVar "person"; Top; Top] | |
142 | - | PrepNCP(Psem,prep,Case case,ctype,Comp comp) -> Tensor[Atom "prepncp"; Atom "sem"; Atom prep; Atom case; arg_of_ctype ctype; Atom comp] | |
143 | - | PrepNCP(Psem,prep,Case case,CompTypeUndef,CompUndef) -> Tensor[Atom "prepncp"; Atom "sem"; Atom prep; Atom case; Top; Top] | |
144 | - | PrepNCP(Pnosem,prep,Case case,ctype,Comp comp) -> Tensor[Atom "prepncp"; Atom "nosem"; Atom prep; Atom case; arg_of_ctype ctype; Atom comp] | |
145 | - | PrepNCP(Pnosem,prep,Case case,CompTypeUndef,CompUndef) -> Tensor[Atom "prepncp"; Atom "nosem"; Atom prep; Atom case; Top; Top] | |
146 | - | InfP(Aspect aspect) -> Tensor[Atom "infp"; Atom aspect] | |
147 | - | InfP AspectUndef -> Tensor[Atom "infp"; Top] | |
148 | - (* | PadvP -> Tensor[Atom "padvp"] *) | |
149 | - | AdvP "misc" -> Tensor[Atom "advp"; Top] (* FIXME: a może Atom "mod" zamiast Top *) | |
150 | - | AdvP mode -> Tensor[Atom "advp"; Atom mode] | |
151 | - | ColonP -> Tensor[Atom "colonp"] | |
152 | - | FixedP lex -> Tensor[Atom "fixed"; Atom lex] | |
146 | + | NCP(Case case,ctype,Comp comp) -> Tensor[Atom "ncp"; Top; Atom case; Top; Top; arg_of_ctype ctype; Atom comp; Top; Top; Top] | |
147 | + | NCP(Case case,CompTypeUndef,CompUndef) -> Tensor[Atom "ncp"; Top; Atom case; Top; Top; Top; Top; Top; Top; Top] | |
148 | + | NCP(NomAgr,ctype,Comp comp) -> Tensor[Atom "ncp"; AVar "number"; Atom "nom"; AVar "gender"; AVar "person"; arg_of_ctype ctype; Atom comp; Top; Top; Top] | |
149 | + | NCP(NomAgr,CompTypeUndef,CompUndef) -> Tensor[Atom "ncp"; AVar "number"; Atom "nom"; AVar "gender"; AVar "person"; Top; Top; Top; Top; Top] | |
150 | + | NCP(VocAgr,ctype,Comp comp) -> Tensor[Atom "ncp"; AVar "number"; Atom "voc"; AVar "gender"; AVar "person"; arg_of_ctype ctype; Atom comp; Top; Top; Top] | |
151 | + | NCP(VocAgr,CompTypeUndef,CompUndef) -> Tensor[Atom "ncp"; AVar "number"; Atom "voc"; AVar "gender"; AVar "person"; Top; Top; Top; Top; Top] | |
152 | + | PrepNCP((*Psem,*)prep,Case case,ctype,Comp comp) -> Tensor[Atom "prepncp"; (*Atom "sem";*) Atom prep; Atom case; arg_of_ctype ctype; Atom comp; Top; Top; Top] | |
153 | + | PrepNCP((*Psem,*)prep,Case case,CompTypeUndef,CompUndef) -> Tensor[Atom "prepncp"; (*Atom "sem";*) Atom prep; Atom case; Top; Top; Top; Top; Top] | |
154 | + (* | PrepNCP(Pnosem,prep,Case case,ctype,Comp comp) -> Tensor[Atom "prepncp"; Atom "nosem"; Atom prep; Atom case; arg_of_ctype ctype; Atom comp] | |
155 | + | PrepNCP(Pnosem,prep,Case case,CompTypeUndef,CompUndef) -> Tensor[Atom "prepncp"; Atom "nosem"; Atom prep; Atom case; Top; Top] *) | |
156 | + | InfP(Aspect aspect) -> Tensor[Atom "infp"; Atom aspect; Top; Top; Top] | |
157 | + | InfP AspectUndef -> Tensor[Atom "infp"; Top; Top; Top; Top] | |
158 | + | PadvP -> Tensor[Atom "padvp"; Top; Top; Top] | |
159 | + | AdvP "misc" -> Tensor[Atom "advp"; Top; Top; Top; Top] (* FIXME: a może Atom "mod" zamiast Top *) | |
160 | + | AdvP "" -> Tensor[Atom "advp"; Top; Top; Top; Top] (* FIXME: a może Atom "mod" zamiast Top *) | |
161 | + | AdvP "pos" -> Tensor[Atom "advp"; Atom "pos"; Top; Top; Top] (* FIXME: a może Atom "mod" zamiast Top *) | |
162 | + | AdvP "com" -> Tensor[Atom "advp"; Atom "com"; Top; Top; Top] (* FIXME: a może Atom "mod" zamiast Top *) | |
163 | + | AdvP "sup" -> Tensor[Atom "advp"; Atom "sup"; Top; Top; Top] (* FIXME: a może Atom "mod" zamiast Top *) | |
164 | + | AdvP mode -> Tensor[Atom "advp"; Atom mode; Top; Top; Top] | |
165 | + | ColonP -> Tensor[Atom "colonp"; Top; Top; Top] | |
166 | + | FixedP "" -> Tensor[Atom "fixed"; Top; Top; Top; Top] | |
167 | + | FixedP lex -> Tensor[Atom "fixed"; Atom lex; Top; Top; Top] | |
168 | + | XP -> Tensor[Atom "xp"; Top; Top; Top] | |
169 | + | SymbolP -> Tensor[Atom "symbol"; Top; Top; Top] | |
170 | + | Inclusion -> Tensor[Atom "inclusion"; Top; Top; Top] | |
153 | 171 | (* | PrepP -> Tensor[Atom "prepp";Top] |
154 | 172 | | Prep("",CaseAgr) -> Tensor[Atom "prep"; Top; AVar "case"] |
155 | 173 | | Prep("",CaseUAgr) -> Tensor[Atom "prep"; Top; AVar "ucase"] |
156 | 174 | | Num(AllAgr,Acm acm) -> Tensor[Atom "num"; AVar "number"; AVar "case"; AVar "gender"; AVar "person"; Atom acm] |
157 | 175 | | Measure(AllUAgr) -> Tensor[Atom "measure"; AVar "unumber"; AVar "ucase"; AVar "ugender"; AVar "uperson"] *) |
158 | - | Or -> Tensor[Atom "or"] | |
159 | - (* | Qub -> Tensor[Atom "qub"]*) | |
176 | + | Or -> Tensor[Atom "or"; Top; Top; Top] | |
177 | + | Qub -> Tensor[Atom "qub"; Top; Top; Top] | |
160 | 178 | (* | Inclusion -> Tensor[Atom "inclusion"] |
161 | 179 | | Adja -> Tensor[Atom "adja"] |
162 | 180 | | Aglt -> Tensor[Atom "aglt"; AVar "number"; AVar "person"] |
... | ... | @@ -165,16 +183,18 @@ let render_phrase = function |
165 | 183 | | AuxImp -> Tensor[Atom "aux-imp"] |
166 | 184 | | Pro -> One |
167 | 185 | | ProNG -> One *) |
168 | - | E Or -> Tensor[Atom "or"] | |
169 | - | E (CP(CompTypeUndef,CompUndef)) -> Tensor[Atom "cp"; Top; Top] | |
170 | - | E (NCP(NomAgr,CompTypeUndef,CompUndef)) -> Tensor[Atom "ncp"; AVar "number"; Atom "nom"; AVar "gender"; AVar "person"; Top; Top] | |
171 | - | E (NP(NomAgr)) -> Tensor[Atom "np"; AVar "number"; Atom "nom"; AVar "gender"; AVar "person"] | |
172 | - | E (PrepNP(Psem,prep,Case case)) -> Tensor[Atom "prepnp"; Atom "sem"; Atom prep; Atom case] | |
173 | - | E (PrepNP(Pnosem,prep,Case case)) -> Tensor[Atom "prepnp"; Atom "nosem"; Atom prep; Atom case] | |
174 | - | E (NP(Case case)) -> Tensor[Atom "np"; Top; Atom case; Top; Top] | |
175 | - | E (NCP(Case case,CompTypeUndef,CompUndef)) -> Tensor[Atom "ncp"; Top; Atom case; Top; Top; Top; Top] | |
176 | - | E (PrepNCP(Psem,prep,Case case,CompTypeUndef,CompUndef)) -> Tensor[Atom "prepncp"; Atom "sem"; Atom prep; Atom case; Top; Top] | |
177 | - | E (PrepNCP(Pnosem,prep,Case case,CompTypeUndef,CompUndef)) -> Tensor[Atom "prepncp"; Atom "nosem"; Atom prep; Atom case; Top; Top] | |
186 | + | E Or -> Tensor[Atom "or"; Top; Top; Top] | |
187 | + | E (CP(CompTypeUndef,CompUndef)) -> Tensor[Atom "cp"; Top; Top; Top; Top; Top] | |
188 | + | E (NCP(NomAgr,CompTypeUndef,CompUndef)) -> Tensor[Atom "ncp"; AVar "number"; Atom "nom"; AVar "gender"; AVar "person"; Top; Top; Top; Top; Top] | |
189 | + | E (NCP(VocAgr,CompTypeUndef,CompUndef)) -> Tensor[Atom "ncp"; AVar "number"; Atom "voc"; AVar "gender"; AVar "person"; Top; Top; Top; Top; Top] | |
190 | + | E (NP(NomAgr)) -> Tensor[Atom "np"; AVar "number"; Atom "nom"; AVar "gender"; AVar "person"; Top; Top; Top] | |
191 | + | E (NP(VocAgr)) -> Tensor[Atom "np"; AVar "number"; Atom "voc"; AVar "gender"; AVar "person"; Top; Top; Top] | |
192 | + | E (PrepNP((*Psem,*)prep,Case case)) -> Tensor[Atom "prepnp"; (*Atom "sem";*) Atom prep; Atom case; Top; Top; Top] | |
193 | + (* | E (PrepNP(Pnosem,prep,Case case)) -> Tensor[Atom "prepnp"; Atom "nosem"; Atom prep; Atom case] *) | |
194 | + | E (NP(Case case)) -> Tensor[Atom "np"; Top; Atom case; Top; Top; Top; Top; Top] | |
195 | + | E (NCP(Case case,CompTypeUndef,CompUndef)) -> Tensor[Atom "ncp"; Top; Atom case; Top; Top; Top; Top; Top; Top; Top] | |
196 | + | E (PrepNCP((*Psem,*)prep,Case case,CompTypeUndef,CompUndef)) -> Tensor[Atom "prepncp"; (*Atom "sem";*) Atom prep; Atom case; Top; Top; Top; Top; Top] | |
197 | + (* | E (PrepNCP(Pnosem,prep,Case case,CompTypeUndef,CompUndef)) -> Tensor[Atom "prepncp"; Atom "nosem"; Atom prep; Atom case; Top; Top] *) | |
178 | 198 | | phrase -> failwith ("render_phrase: " ^ ENIAMwalStringOf.phrase phrase) |
179 | 199 | |
180 | 200 | let render_phrase_cat cat role node = function |
... | ... | @@ -185,21 +205,23 @@ let render_phrase_cat cat role node = function |
185 | 205 | | NP AllAgr -> Tensor[Atom "np"; AVar "number"; AVar "case"; AVar "gender"; AVar "person"; Atom cat; Atom role; Atom node]*) |
186 | 206 | | NP CaseAgr -> Tensor[Atom "np"; Top; AVar "case"; Top; Top; Atom cat; Atom role; Atom node] |
187 | 207 | | NP CaseUndef -> Tensor[Atom "np"; Top; Top; Top; Top; Atom cat; Atom role; Atom node] |
188 | - | PrepNP(Psem,"",CaseUndef) -> Tensor[Atom "prepnp"; Atom "sem"; Top; Top; Atom cat; Atom role; Atom node] | |
189 | - | PrepNP(Psem,"_",CaseUndef) -> Tensor[Atom "prepnp"; Atom "sem"; Top; Top; Atom cat; Atom role; Atom node] | |
190 | - | PrepNP(Psem,"_",Case case) -> Tensor[Atom "prepnp"; Atom "sem"; Top; Atom case; Atom cat; Atom role; Atom node] | |
191 | - | PrepNP(Psem,prep,CaseUndef) -> Tensor[Atom "prepnp"; Atom "sem"; Atom prep; Top; Atom cat; Atom role; Atom node] | |
192 | - | PrepNP(Psem,prep,Case case) -> Tensor[Atom "prepnp"; Atom "sem"; Atom prep; Atom case; Atom cat; Atom role; Atom node] | |
193 | - | PrepNP(Pnosem,"",CaseUndef) -> Tensor[Atom "prepnp"; Atom "nosem"; Top; Top; Atom cat; Atom role; Atom node] | |
208 | + | NPA CaseAgr -> Tensor[Atom "npa"; Top; AVar "case"; Top; Top; Atom cat; Atom role; Atom node] | |
209 | + | PrepNP("",CaseUndef) -> Tensor[Atom "prepnp"; (*Atom "sem";*) Top; Top; Atom cat; Atom role; Atom node] | |
210 | + | PrepNP("_",CaseUndef) -> Tensor[Atom "prepnp";(* Atom "sem";*) Top; Top; Atom cat; Atom role; Atom node] | |
211 | + | PrepNP("_",Case case) -> Tensor[Atom "prepnp"; (*Atom "sem";*) Top; Atom case; Atom cat; Atom role; Atom node] | |
212 | + | PrepNP(prep,CaseUndef) -> Tensor[Atom "prepnp"; (*Atom "sem";*) Atom prep; Top; Atom cat; Atom role; Atom node] | |
213 | + | PrepNP(prep,Case case) -> Tensor[Atom "prepnp"; (*Atom "sem";*) Atom prep; Atom case; Atom cat; Atom role; Atom node] | |
214 | + (* | PrepNP(Pnosem,"",CaseUndef) -> Tensor[Atom "prepnp"; Atom "nosem"; Top; Top; Atom cat; Atom role; Atom node] | |
194 | 215 | | PrepNP(Pnosem,"_",CaseUndef) -> Tensor[Atom "prepnp"; Atom "nosem"; Top; Top; Atom cat; Atom role; Atom node] |
195 | 216 | | PrepNP(Pnosem,"_",Case case) -> Tensor[Atom "prepnp"; Atom "nosem"; Top; Atom case; Atom cat; Atom role; Atom node] |
196 | 217 | | PrepNP(Pnosem,prep,CaseUndef) -> Tensor[Atom "prepnp"; Atom "nosem"; Atom prep; Top; Atom cat; Atom role; Atom node] |
197 | - | PrepNP(Pnosem,prep,Case case) -> Tensor[Atom "prepnp"; Atom "nosem"; Atom prep; Atom case; Atom cat; Atom role; Atom node] | |
218 | + | PrepNP(Pnosem,prep,Case case) -> Tensor[Atom "prepnp"; Atom "nosem"; Atom prep; Atom case; Atom cat; Atom role; Atom node] *) | |
198 | 219 | | AdjP(Case case) -> Tensor[Atom "adjp"; Top; Atom case; Top; Top; Atom cat; Atom role; Atom node] |
199 | 220 | | AdjP NomAgr -> Tensor[Atom "adjp"; AVar "number"; Atom "nom"; AVar "gender"; Top; Atom cat; Atom role; Atom node] |
200 | 221 | | AdjP AllAgr -> Tensor[Atom "adjp"; AVar "number"; AVar "case"; AVar "gender"; Top; Atom cat; Atom role; Atom node] |
201 | 222 | (* | AdjP CaseAgr -> Tensor[Atom "adjp"; Top; AVar "case"; Top; Top; Atom cat; Atom role; Atom node] |
202 | 223 | | PrepAdjP("",CaseUndef) -> Tensor[Atom "prepnp"; Top; Top; Atom cat; Atom role; Atom node]*) |
224 | + | AdjA -> Tensor[Atom "adja"; Atom cat; Atom role; Atom node] | |
203 | 225 | | PrepAdjP(prep,Case case) -> Tensor[Atom "prepadjp"; Atom prep; Atom case; Atom cat; Atom role; Atom node] |
204 | 226 | (* | NumP(Case case) -> Tensor[Atom "nump"; Top; Atom case; Top; Atom node] |
205 | 227 | | NumP NomAgr -> Tensor[Atom "nump"; AVar "number"; Atom "nom"; AVar "gender"; AVar "person"] |
... | ... | @@ -209,7 +231,9 @@ let render_phrase_cat cat role node = function |
209 | 231 | | PrepNumP(_,prep,Case case) -> Tensor[Atom "prepnump"; Atom prep; Atom case] *) |
210 | 232 | (* | ComprepNP("") -> Tensor[Atom "comprepnp"; Top; Atom cat; Atom role; Atom node]*) |
211 | 233 | | ComprepNP(prep) -> Tensor[Atom "comprepnp"; Atom prep; Atom cat; Atom role; Atom node] |
212 | - | ComparP(prep,Case case) -> Tensor[Atom "comparp"; Atom prep; Atom case; Atom cat; Atom role; Atom node] | |
234 | + | ComparP((*Psem,*)prep,Case case) -> Tensor[Atom "comparp"; (*Atom "sem";*) Atom prep; Atom case; Atom cat; Atom role; Atom node] | |
235 | + | ComparP((*Psem,*)prep,CaseUndef) -> Tensor[Atom "comparp"; (*Atom "sem";*) Atom prep; Top; Atom cat; Atom role; Atom node] | |
236 | + (* | ComparP(Pnosem,prep,Case case) -> Tensor[Atom "comparp"; Atom "nosem"; Atom prep; Atom case; Atom cat; Atom role; Atom node] *) | |
213 | 237 | (* | ComparPP(_,prep) -> Tensor[Atom "comparpp"; Atom prep; Atom cat; Atom role; Atom node] *) |
214 | 238 | (* | IP -> Tensor[Atom "ip";Top;Top;Top; Atom cat; Atom role; Atom node] *) |
215 | 239 | | CP (ctype,Comp comp) -> Tensor[Atom "cp"; arg_of_ctype ctype; Atom comp; Atom cat; Atom role; Atom node] |
... | ... | @@ -220,23 +244,32 @@ let render_phrase_cat cat role node = function |
220 | 244 | | NCP(NomAgr,CompTypeUndef,CompUndef) -> Tensor[Atom "ncp"; AVar "number"; Atom "nom"; AVar "gender"; AVar "person"; Top; Top; Atom cat; Atom role; Atom node] |
221 | 245 | | NCP(VocAgr,ctype,Comp comp) -> Tensor[Atom "ncp"; AVar "number"; Atom "voc"; AVar "gender"; AVar "person"; arg_of_ctype ctype; Atom comp; Atom cat; Atom role; Atom node] |
222 | 246 | | NCP(VocAgr,CompTypeUndef,CompUndef) -> Tensor[Atom "ncp"; AVar "number"; Atom "voc"; AVar "gender"; AVar "person"; Top; Top; Atom cat; Atom role; Atom node] |
223 | - | PrepNCP(Psem,prep,Case case,ctype,Comp comp) -> Tensor[Atom "prepncp"; Atom "sem"; Atom prep; Atom case; arg_of_ctype ctype; Atom comp; Atom cat; Atom role; Atom node] | |
224 | - | PrepNCP(Psem,prep,Case case,CompTypeUndef,CompUndef) -> Tensor[Atom "prepncp"; Atom "sem"; Atom prep; Atom case; Top; Top; Atom cat; Atom role; Atom node] | |
225 | - | PrepNCP(Pnosem,prep,Case case,ctype,Comp comp) -> Tensor[Atom "prepncp"; Atom "nosem"; Atom prep; Atom case; arg_of_ctype ctype; Atom comp; Atom cat; Atom role; Atom node] | |
226 | - | PrepNCP(Pnosem,prep,Case case,CompTypeUndef,CompUndef) -> Tensor[Atom "prepncp"; Atom "nosem"; Atom prep; Atom case; Top; Top; Atom cat; Atom role; Atom node] | |
247 | + | PrepNCP((*Psem,*)prep,Case case,ctype,Comp comp) -> Tensor[Atom "prepncp"; (*Atom "sem";*) Atom prep; Atom case; arg_of_ctype ctype; Atom comp; Atom cat; Atom role; Atom node] | |
248 | + | PrepNCP((*Psem,*)prep,Case case,CompTypeUndef,CompUndef) -> Tensor[Atom "prepncp"; (*Atom "sem";*) Atom prep; Atom case; Top; Top; Atom cat; Atom role; Atom node] | |
249 | + (* | PrepNCP(Pnosem,prep,Case case,ctype,Comp comp) -> Tensor[Atom "prepncp"; Atom "nosem"; Atom prep; Atom case; arg_of_ctype ctype; Atom comp; Atom cat; Atom role; Atom node] | |
250 | + | PrepNCP(Pnosem,prep,Case case,CompTypeUndef,CompUndef) -> Tensor[Atom "prepncp"; Atom "nosem"; Atom prep; Atom case; Top; Top; Atom cat; Atom role; Atom node] *) | |
227 | 251 | | InfP(Aspect aspect) -> Tensor[Atom "infp"; Atom aspect; Atom cat; Atom role; Atom node] |
228 | 252 | | InfP AspectUndef -> Tensor[Atom "infp"; Top; Atom cat; Atom role; Atom node] |
229 | - (* | PadvP -> Tensor[Atom "padvp"; Atom cat; Atom role; Atom node] *) | |
253 | + | PadvP -> Tensor[Atom "padvp"; Atom cat; Atom role; Atom node] | |
230 | 254 | | AdvP "misc" -> Tensor[Atom "advp"; Top; Atom cat; Atom role; Atom node] (* FIXME: a może Atom "mod" zamiast Top *) |
231 | 255 | | AdvP "" -> Tensor[Atom "advp"; Top; Atom cat; Atom role; Atom node] (* FIXME: a może Atom "mod" zamiast Top *) |
256 | + | AdvP "pos" -> Tensor[Atom "advp"; Atom "pos"; Atom cat; Atom role; Atom node] (* FIXME: a może Atom "mod" zamiast Top *) | |
257 | + | AdvP "com" -> Tensor[Atom "advp"; Atom "com"; Atom cat; Atom role; Atom node] (* FIXME: a może Atom "mod" zamiast Top *) | |
258 | + | AdvP "sup" -> Tensor[Atom "advp"; Atom "sup"; Atom cat; Atom role; Atom node] (* FIXME: a może Atom "mod" zamiast Top *) | |
232 | 259 | | AdvP mode -> Tensor[Atom "advp"; Top; Atom cat; Atom role; Atom node] |
233 | - | ColonP -> Tensor[Atom "colonp"; Atom cat; Atom cat; Atom role; Atom node] | |
260 | + | ColonP -> Tensor[Atom "colonp"; Atom cat; Atom role; Atom node] | |
261 | + | FixedP "" -> Tensor[Atom "fixed"; Top; Atom cat; Atom role; Atom node] | |
262 | + | FixedP lex -> Tensor[Atom "fixed"; Atom lex; Atom cat; Atom role; Atom node] | |
263 | + | XP -> Tensor[Atom "xp"; Atom cat; Atom role; Atom node] | |
264 | + | SymbolP -> Tensor[Atom "symbol"; Atom cat; Atom role; Atom node] | |
265 | + | Inclusion -> Tensor[Atom "inclusion"; Atom cat; Atom role; Atom node] | |
234 | 266 | (* | PrepP -> Tensor[Atom "prepp";Top] |
235 | 267 | | Prep("",CaseAgr) -> Tensor[Atom "prep"; Top; AVar "case"] |
236 | 268 | | Prep("",CaseUAgr) -> Tensor[Atom "prep"; Top; AVar "ucase"] |
237 | 269 | | Num(AllAgr,Acm acm) -> Tensor[Atom "num"; AVar "number"; AVar "case"; AVar "gender"; AVar "person"; Atom acm] |
238 | 270 | | Measure(AllUAgr) -> Tensor[Atom "measure"; AVar "unumber"; AVar "ucase"; AVar "ugender"; AVar "uperson"] *) |
239 | - (* | Qub -> Tensor[Atom "qub"]*) | |
271 | + | Or -> Tensor[Atom "or"; Atom cat; Atom role; Atom node] | |
272 | + | Qub -> Tensor[Atom "qub"; Atom cat; Atom role; Atom node] | |
240 | 273 | (* | Inclusion -> Tensor[Atom "inclusion"] |
241 | 274 | | Adja -> Tensor[Atom "adja"] |
242 | 275 | | Aglt -> Tensor[Atom "aglt"; AVar "number"; AVar "person"] |
... | ... | @@ -245,19 +278,24 @@ let render_phrase_cat cat role node = function |
245 | 278 | | AuxImp -> Tensor[Atom "aux-imp"] |
246 | 279 | | Pro -> One |
247 | 280 | | ProNG -> One *) |
281 | + | E Or -> Tensor[Atom "or"; Atom cat; Atom role; Atom node] | |
248 | 282 | | E (CP(CompTypeUndef,CompUndef)) -> Tensor[Atom "cp"; Top; Top; Atom cat; Atom role; Atom node] |
249 | 283 | | E (NCP(NomAgr,CompTypeUndef,CompUndef)) -> Tensor[Atom "ncp"; AVar "number"; Atom "nom"; AVar "gender"; AVar "person"; Top; Top; Atom cat; Atom role; Atom node] |
284 | + | E (NCP(VocAgr,CompTypeUndef,CompUndef)) -> Tensor[Atom "ncp"; AVar "number"; Atom "voc"; AVar "gender"; AVar "person"; Top; Top; Atom cat; Atom role; Atom node] | |
250 | 285 | | E (NP(NomAgr)) -> Tensor[Atom "np"; AVar "number"; Atom "nom"; AVar "gender"; AVar "person"; Atom cat; Atom role; Atom node] |
251 | - | E (PrepNP(Psem,prep,Case case)) -> Tensor[Atom "prepnp"; Atom "sem"; Atom prep; Atom case; Atom cat; Atom role; Atom node] | |
252 | - | E (PrepNP(Pnosem,prep,Case case)) -> Tensor[Atom "prepnp"; Atom "nosem"; Atom prep; Atom case; Atom cat; Atom role; Atom node] | |
286 | + | E (NP(VocAgr)) -> Tensor[Atom "np"; AVar "number"; Atom "Voc"; AVar "gender"; AVar "person"; Atom cat; Atom role; Atom node] | |
287 | + | E (PrepNP((*Psem,*)prep,Case case)) -> Tensor[Atom "prepnp"; (*Atom "sem";*) Atom prep; Atom case; Atom cat; Atom role; Atom node] | |
288 | + (* | E (PrepNP(Pnosem,prep,Case case)) -> Tensor[Atom "prepnp"; Atom "nosem"; Atom prep; Atom case; Atom cat; Atom role; Atom node] *) | |
253 | 289 | | E (NP(Case case)) -> Tensor[Atom "np"; Top; Atom case; Top; Top; Atom cat; Atom role; Atom node] |
254 | 290 | | E (NCP(Case case,CompTypeUndef,CompUndef)) -> Tensor[Atom "ncp"; Top; Atom case; Top; Top; Top; Top; Atom cat; Atom role; Atom node] |
255 | - | E (PrepNCP(Psem,prep,Case case,CompTypeUndef,CompUndef)) -> Tensor[Atom "prepncp"; Atom "sem"; Atom prep; Atom case; Top; Top; Atom cat; Atom role; Atom node] | |
256 | - | E (PrepNCP(Pnosem,prep,Case case,CompTypeUndef,CompUndef)) -> Tensor[Atom "prepncp"; Atom "nosem"; Atom prep; Atom case; Top; Top; Atom cat; Atom role; Atom node] | |
291 | + | E (PrepNCP((*Psem,*)prep,Case case,CompTypeUndef,CompUndef)) -> Tensor[Atom "prepncp"; (*Atom "sem";*) Atom prep; Atom case; Top; Top; Atom cat; Atom role; Atom node] | |
292 | + (* | E (PrepNCP(Pnosem,prep,Case case,CompTypeUndef,CompUndef)) -> Tensor[Atom "prepncp"; Atom "nosem"; Atom prep; Atom case; Top; Top; Atom cat; Atom role; Atom node] *) | |
257 | 293 | | phrase -> failwith ("render_phrase_cat: " ^ ENIAMwalStringOf.phrase phrase) |
258 | 294 | |
259 | 295 | let render_morf = function |
260 | 296 | | Null -> One |
297 | + | Pro -> One | |
298 | + | ProNG -> One | |
261 | 299 | (* | X -> Tensor[Atom "X"] |
262 | 300 | | Lex lex -> Tensor[Atom lex] *) |
263 | 301 | | LexArg(id,lex,pos) -> Tensor([Atom "lex";Atom (string_of_int id);Atom lex] @ render_pos pos) |
... | ... | @@ -268,9 +306,8 @@ let render_morf_cat cats role node = function |
268 | 306 | | Null -> [One] |
269 | 307 | | Pro -> [One] |
270 | 308 | | ProNG -> [One] |
271 | - | FixedP lex -> [Tensor[Atom "fixed"; Atom lex]] | |
272 | - | Or -> [Tensor[Atom "or"]] | |
273 | - | E Or -> [Tensor[Atom "or"]] | |
309 | + (* | Or -> [Tensor[Atom "or"]] | |
310 | + | E Or -> [Tensor[Atom "or"]] *) | |
274 | 311 | (* | X -> Tensor[Atom "X"] |
275 | 312 | | Lex lex -> Tensor[Atom lex] *) |
276 | 313 | | LexArg(id,lex,pos) -> [Tensor([Atom "lex";Atom (string_of_int id);Atom lex] @ render_pos pos)] |
... | ... | @@ -298,8 +335,8 @@ let render_schema_cat schema = |
298 | 335 | Xlist.map schema (fun p -> |
299 | 336 | match List.flatten (Xlist.map p.morfs (render_morf_cat p.cat_prefs p.role p.node)) with |
300 | 337 | [] -> failwith "render_schema" |
301 | - | [s] -> translate_dir p.dir,s | |
302 | - | l -> translate_dir p.dir,Plus l) | |
338 | + | [s] -> translate_dir p.dir,if p.is_necessary = Multi then Maybe s else s | |
339 | + | l -> translate_dir p.dir,if p.is_necessary = Multi then Maybe(Plus l) else Plus l) | |
303 | 340 | |
304 | 341 | let render_simple_schema schema = |
305 | 342 | Xlist.map schema (fun morfs -> |
... | ... | @@ -343,122 +380,122 @@ let adjunct_multi dir morfs = {empty_position with gf=ADJUNCT; is_necessary=Mul |
343 | 380 | let adjunct_dir dir morfs = {empty_position with gf=ADJUNCT; is_necessary=Opt; dir=dir; morfs=Xlist.map morfs (fun morf -> LCG morf)} |
344 | 381 | let adjunct_ce ce morfs = {empty_position with gf=ADJUNCT; ce=[ce]; is_necessary=Opt; morfs=Xlist.map morfs (fun morf -> LCG morf)} |
345 | 382 | |
346 | -let render_comprep prep = Both,Plus[One;Tensor[Atom "comprepnp"; Atom prep]] | |
383 | +let render_comprep prep = Both,Plus[One;Tensor[Atom "comprepnp"; Atom prep; Top; Top; Top]] | |
347 | 384 | |
348 | -let render_connected_comprep prep = adjunct [Tensor[Atom "comprepnp"; Atom prep]] | |
385 | +let render_connected_comprep prep = adjunct [Tensor[Atom "comprepnp"; Atom prep; Top; Top; Top]] | |
349 | 386 | |
350 | 387 | let render_prepnp prep cases = |
351 | 388 | Both,Plus(One :: List.flatten (Xlist.map cases (fun case -> |
352 | - [Tensor[Atom "prepnp"; Atom prep; Atom case]; | |
353 | - Tensor[Atom "prepncp"; Atom prep; Atom case; Top; Top]]))) | |
389 | + [Tensor[Atom "prepnp"; Atom prep; Atom case; Top; Top; Top]; | |
390 | + Tensor[Atom "prepncp"; Atom prep; Atom case; Top; Top; Top; Top; Top]]))) | |
354 | 391 | |
355 | 392 | let render_connected_prepnp prep cases = |
356 | 393 | adjunct (List.flatten (Xlist.map cases (fun case -> |
357 | - [Tensor[Atom "prepnp"; Atom prep; Atom case]; | |
358 | - Tensor[Atom "prepncp"; Atom prep; Atom case; Top; Top]]))) | |
394 | + [Tensor[Atom "prepnp"; Atom prep; Atom case; Top; Top; Top]; | |
395 | + Tensor[Atom "prepncp"; Atom prep; Atom case; Top; Top; Top; Top; Top]]))) | |
359 | 396 | |
360 | 397 | let render_prepadjp prep cases = |
361 | - let postp = if prep = "z" || prep = "po" || prep = "na" then [Tensor[Atom "prepadjp"; Atom prep; Atom "postp"]] else [] in | |
398 | + let postp = if prep = "z" || prep = "po" || prep = "na" then [Tensor[Atom "prepadjp"; Atom prep; Atom "postp"; Top; Top; Top]] else [] in | |
362 | 399 | Both,Plus(One :: postp @ (Xlist.map cases (fun case -> |
363 | - Tensor[Atom "prepadjp"; Atom prep; Atom case]))) | |
400 | + Tensor[Atom "prepadjp"; Atom prep; Atom case; Top; Top; Top]))) | |
364 | 401 | |
365 | 402 | let render_connected_prepadjp prep cases = |
366 | - let postp = if prep = "z" || prep = "po" || prep = "na" then [Tensor[Atom "prepadjp"; Atom prep; Atom "postp"]] else [] in | |
403 | + let postp = if prep = "z" || prep = "po" || prep = "na" then [Tensor[Atom "prepadjp"; Atom prep; Atom "postp"; Top; Top; Top]] else [] in | |
367 | 404 | adjunct (postp @ (Xlist.map cases (fun case -> |
368 | - Tensor[Atom "prepadjp"; Atom prep; Atom case]))) | |
405 | + Tensor[Atom "prepadjp"; Atom prep; Atom case; Top; Top; Top]))) | |
369 | 406 | |
370 | -let render_compar prep = Both,Plus[One;Tensor[Atom "comparp"; Atom prep; Top]] | |
407 | +let render_compar prep = Both,Plus[One;Tensor[Atom "comparp"; Atom prep; Top; Top; Top; Top]] | |
371 | 408 | |
372 | -let render_connected_compar prep = adjunct [Tensor[Atom "comparp"; Atom prep; Top]] | |
409 | +let render_connected_compar prep = adjunct [Tensor[Atom "comparp"; Atom prep; Top; Top; Top; Top]] | |
373 | 410 | |
374 | 411 | let verb_adjuncts_simp = [ |
375 | - Both, Plus[One;Tensor[Atom "advp"; Atom "pron"]]; | |
376 | - Both, Plus[One;Tensor[Atom "advp"; Atom "locat"]]; | |
377 | - Both, Plus[One;Tensor[Atom "advp"; Atom "abl"]]; | |
378 | - Both, Plus[One;Tensor[Atom "advp"; Atom "adl"]]; | |
379 | - Both, Plus[One;Tensor[Atom "advp"; Atom "perl"]]; | |
380 | - Both, Plus[One;Tensor[Atom "advp"; Atom "temp"]]; | |
381 | - Both, Plus[One;Tensor[Atom "advp"; Atom "dur"]]; | |
382 | - Both, Plus[One;Tensor[Atom "advp"; Atom "mod"]]; | |
383 | - Both, Plus[One;Tensor[Atom "np";Top;Atom "dat"; Top; Top];Tensor[Atom "ncp"; Top; Atom "dat"; Top; Top; Top; Top]]; | |
384 | - Both, Plus[One;Tensor[Atom "np";Top;Atom "inst"; Top; Top];Tensor[Atom "ncp"; Top; Atom "inst"; Top; Top; Top; Top]]; | |
412 | + Both, Plus[One;Tensor[Atom "advp"; Atom "pron"; Top; Top; Top]]; | |
413 | + Both, Plus[One;Tensor[Atom "advp"; Atom "locat"; Top; Top; Top]]; | |
414 | + Both, Plus[One;Tensor[Atom "advp"; Atom "abl"; Top; Top; Top]]; | |
415 | + Both, Plus[One;Tensor[Atom "advp"; Atom "adl"; Top; Top; Top]]; | |
416 | + Both, Plus[One;Tensor[Atom "advp"; Atom "perl"; Top; Top; Top]]; | |
417 | + Both, Plus[One;Tensor[Atom "advp"; Atom "temp"; Top; Top; Top]]; | |
418 | + Both, Plus[One;Tensor[Atom "advp"; Atom "dur"; Top; Top; Top]]; | |
419 | + Both, Plus[One;Tensor[Atom "advp"; Atom "mod"; Top; Top; Top]]; | |
420 | + Both, Plus[One;Tensor[Atom "np";Top;Atom "dat"; Top; Top; Top; Top; Top];Tensor[Atom "ncp"; Top; Atom "dat"; Top; Top; Top; Top; Top; Top; Top]]; | |
421 | + Both, Plus[One;Tensor[Atom "np";Top;Atom "inst"; Top; Top; Top; Top; Top];Tensor[Atom "ncp"; Top; Atom "inst"; Top; Top; Top; Top; Top; Top; Top]]; | |
385 | 422 | Both, Plus[One;Tensor[Atom "date"];Tensor[Atom "day-lex"];Tensor[Atom "day-month"];Tensor[Atom "day"]]; |
386 | - Forward, Plus[One;Tensor[Atom "cp";Top; Top]]; (* FIXME: to powinno być jako ostatnia lista argumentów *) | |
387 | - Both, Plus[One;Tensor[Atom "or"]]; | |
423 | + Forward, Plus[One;Tensor[Atom "cp";Top; Top; Top; Top; Top]]; (* FIXME: to powinno być jako ostatnia lista argumentów *) | |
424 | + Both, Plus[One;Tensor[Atom "or"; Top; Top; Top]]; | |
388 | 425 | Both, Plus[One;Tensor[Atom "lex";Atom "się";Atom "qub"]]; |
389 | - Both, Plus[One;Tensor[Atom "padvp"]]; | |
426 | + Both, Plus[One;Tensor[Atom "padvp"; Top; Top; Top]]; | |
390 | 427 | ] |
391 | 428 | |
392 | 429 | let verb_connected_adjuncts_simp = [ |
393 | - adjunct [Tensor[Atom "advp"; Atom "pron"]]; | |
394 | - adjunct [Tensor[Atom "advp"; Atom "locat"]]; | |
395 | - adjunct [Tensor[Atom "advp"; Atom "abl"]]; | |
396 | - adjunct [Tensor[Atom "advp"; Atom "adl"]]; | |
397 | - adjunct [Tensor[Atom "advp"; Atom "perl"]]; | |
398 | - adjunct [Tensor[Atom "advp"; Atom "temp"]]; | |
399 | - adjunct [Tensor[Atom "advp"; Atom "dur"]]; | |
400 | - adjunct [Tensor[Atom "advp"; Atom "mod"]]; | |
401 | - adjunct [Tensor[Atom "np";Top;Atom "dat"; Top; Top];Tensor[Atom "ncp"; Top; Atom "dat"; Top; Top; Top; Top]]; | |
402 | - adjunct [Tensor[Atom "np";Top;Atom "inst"; Top; Top];Tensor[Atom "ncp"; Top; Atom "inst"; Top; Top; Top; Top]]; | |
430 | + adjunct [Tensor[Atom "advp"; Atom "pron"; Top; Top; Top]]; | |
431 | + adjunct [Tensor[Atom "advp"; Atom "locat"; Top; Top; Top]]; | |
432 | + adjunct [Tensor[Atom "advp"; Atom "abl"; Top; Top; Top]]; | |
433 | + adjunct [Tensor[Atom "advp"; Atom "adl"; Top; Top; Top]]; | |
434 | + adjunct [Tensor[Atom "advp"; Atom "perl"; Top; Top; Top]]; | |
435 | + adjunct [Tensor[Atom "advp"; Atom "temp"; Top; Top; Top]]; | |
436 | + adjunct [Tensor[Atom "advp"; Atom "dur"; Top; Top; Top]]; | |
437 | + adjunct [Tensor[Atom "advp"; Atom "mod"; Top; Top; Top]]; | |
438 | + adjunct [Tensor[Atom "np";Top;Atom "dat"; Top; Top];Tensor[Atom "ncp"; Top; Atom "dat"; Top; Top; Top; Top; Top; Top; Top]]; | |
439 | + adjunct [Tensor[Atom "np";Top;Atom "inst"; Top; Top];Tensor[Atom "ncp"; Top; Atom "inst"; Top; Top; Top; Top; Top; Top; Top]]; | |
403 | 440 | adjunct [Tensor[Atom "date"];Tensor[Atom "day-lex"];Tensor[Atom "day-month"];Tensor[Atom "day"]]; |
404 | - adjunct_dir Forward_ [Tensor[Atom "cp";Top; Top]]; | |
405 | - adjunct [Tensor[Atom "or"]]; | |
441 | + adjunct_dir Forward_ [Tensor[Atom "cp";Top; Top; Top; Top; Top]]; | |
442 | + adjunct [Tensor[Atom "or"; Top; Top; Top]]; | |
406 | 443 | adjunct [Tensor[Atom "lex";Atom "się";Atom "qub"]]; |
407 | - adjunct_ce "3" [Tensor[Atom "padvp"]]; | |
444 | + adjunct_ce "3" [Tensor[Atom "padvp"; Top; Top; Top]]; | |
408 | 445 | ] |
409 | 446 | |
410 | 447 | let proper_noun_adjuncts_simp = [ |
411 | - Both, Plus[One;Tensor[Atom "np";Top;Atom "gen"; Top; Top];Tensor[Atom "ncp"; Top; Atom "gen"; Top; Top; Top; Top]]; | |
412 | - Forward, Plus[One;Tensor[Atom "np";Top;Atom "nom"; Top; Top];Tensor[Atom "np";Top;AVar "case"; Top; Top]]; | |
413 | - Backward, Maybe(Tensor[Atom "adjp"; AVar "number"; AVar "case"; AVar "gender"]); | |
414 | - Forward, Plus[One;Tensor[Atom "adjp"; AVar "number"; AVar "case"; AVar "gender"]]; | |
448 | + Both, Plus[One;Tensor[Atom "np";Top;Atom "gen"; Top; Top; Top; Top; Top];Tensor[Atom "ncp"; Top; Atom "gen"; Top; Top; Top; Top; Top; Top; Top]]; | |
449 | + Forward, Plus[One;Tensor[Atom "np";Top;Atom "nom"; Top; Top; Top; Top; Top];Tensor[Atom "np";Top;AVar "case"; Top; Top; Top; Top; Top]]; | |
450 | + Backward, Maybe(Tensor[Atom "adjp"; AVar "number"; AVar "case"; AVar "gender"; Top; Top; Top]); | |
451 | + Forward, Plus[One;Tensor[Atom "adjp"; AVar "number"; AVar "case"; AVar "gender"; Top; Top; Top]]; | |
415 | 452 | ] |
416 | 453 | |
417 | 454 | let proper_noun_connected_adjuncts_simp = [ |
418 | - adjunct [Tensor[Atom "np";Top;Atom "gen"; Top; Top];Tensor[Atom "ncp"; Top; Atom "gen"; Top; Top; Top; Top]]; | |
419 | - adjunct_dir Forward_ [Tensor[Atom "np";Top;Atom "nom"; Top; Top];Tensor[Atom "np";Top;AVar "case"; Top; Top]]; | |
420 | - adjunct_multi Backward_ [Tensor[Atom "adjp"; AVar "number"; AVar "case"; AVar "gender"]]; | |
421 | - adjunct_dir Forward_ [Tensor[Atom "adjp"; AVar "number"; AVar "case"; AVar "gender"]]; | |
455 | + adjunct [Tensor[Atom "np";Top;Atom "gen"; Top; Top; Top; Top; Top];Tensor[Atom "ncp"; Top; Atom "gen"; Top; Top; Top; Top; Top; Top; Top]]; | |
456 | + adjunct_dir Forward_ [Tensor[Atom "np";Top;Atom "nom"; Top; Top; Top; Top; Top];Tensor[Atom "np";Top;AVar "case"; Top; Top; Top; Top; Top]]; | |
457 | + adjunct_multi Backward_ [Tensor[Atom "adjp"; AVar "number"; AVar "case"; AVar "gender"; Top; Top; Top]]; | |
458 | + adjunct_dir Forward_ [Tensor[Atom "adjp"; AVar "number"; AVar "case"; AVar "gender"; Top; Top; Top]]; | |
422 | 459 | ] |
423 | 460 | |
424 | 461 | let common_noun_adjuncts_simp = [ |
425 | - Both, Plus[One;Tensor[Atom "np";Top;Atom "gen"; Top; Top];Tensor[Atom "ncp"; Top; Atom "gen"; Top; Top; Top; Top]]; | |
426 | - Forward, Plus[One;Tensor[Atom "np";Top;Atom "nom"; Top; Top];Tensor[Atom "np";Top;AVar "case"; Top; Top]]; | |
427 | - Backward, Maybe(Tensor[Atom "adjp"; AVar "number"; AVar "case"; AVar "gender"]); | |
428 | - Forward, Plus[One;Tensor[Atom "adjp"; AVar "number"; AVar "case"; AVar "gender"]]; | |
462 | + Both, Plus[One;Tensor[Atom "np";Top;Atom "gen"; Top; Top; Top; Top; Top];Tensor[Atom "ncp"; Top; Atom "gen"; Top; Top; Top; Top; Top; Top; Top]]; | |
463 | + Forward, Plus[One;Tensor[Atom "np";Top;Atom "nom"; Top; Top; Top; Top; Top];Tensor[Atom "np";Top;AVar "case"; Top; Top; Top; Top; Top]]; | |
464 | + Backward, Maybe(Tensor[Atom "adjp"; AVar "number"; AVar "case"; AVar "gender"; Top; Top; Top]); | |
465 | + Forward, Plus[One;Tensor[Atom "adjp"; AVar "number"; AVar "case"; AVar "gender"; Top; Top; Top]]; | |
429 | 466 | ] |
430 | 467 | |
431 | 468 | let common_noun_connected_adjuncts_simp = [ |
432 | - adjunct [Tensor[Atom "np";Top;Atom "gen"; Top; Top];Tensor[Atom "ncp"; Top; Atom "gen"; Top; Top; Top; Top]]; | |
433 | - adjunct_dir Forward_ [Tensor[Atom "np";Top;Atom "nom"; Top; Top];Tensor[Atom "np";Top;AVar "case"; Top; Top]]; | |
434 | - adjunct_multi Backward_ [Tensor[Atom "adjp"; AVar "number"; AVar "case"; AVar "gender"]]; | |
435 | - adjunct_dir Forward_ [Tensor[Atom "adjp"; AVar "number"; AVar "case"; AVar "gender"]]; | |
469 | + adjunct [Tensor[Atom "np";Top;Atom "gen"; Top; Top; Top; Top; Top];Tensor[Atom "ncp"; Top; Atom "gen"; Top; Top; Top; Top; Top; Top; Top]]; | |
470 | + adjunct_dir Forward_ [Tensor[Atom "np";Top;Atom "nom"; Top; Top; Top; Top; Top];Tensor[Atom "np";Top;AVar "case"; Top; Top; Top; Top; Top]]; | |
471 | + adjunct_multi Backward_ [Tensor[Atom "adjp"; AVar "number"; AVar "case"; AVar "gender"; Top; Top; Top]]; | |
472 | + adjunct_dir Forward_ [Tensor[Atom "adjp"; AVar "number"; AVar "case"; AVar "gender"; Top; Top; Top]]; | |
436 | 473 | ] |
437 | 474 | |
438 | 475 | let measure_noun_adjuncts_simp = [ |
439 | - Backward, Maybe(Tensor[Atom "adjp"; AVar "number"; AVar "case"; AVar "gender"]); | |
440 | - Forward, Plus[One;Tensor[Atom "adjp"; AVar "number"; AVar "case"; AVar "gender"]]; | |
476 | + Backward, Maybe(Tensor[Atom "adjp"; AVar "number"; AVar "case"; AVar "gender"; Top; Top; Top]); | |
477 | + Forward, Plus[One;Tensor[Atom "adjp"; AVar "number"; AVar "case"; AVar "gender"; Top; Top; Top]]; | |
441 | 478 | ] |
442 | 479 | |
443 | 480 | let measure_noun_connected_adjuncts_simp = [ |
444 | - adjunct_multi Backward_ [Tensor[Atom "adjp"; AVar "number"; AVar "case"; AVar "gender"]]; | |
445 | - adjunct_dir Forward_ [Tensor[Atom "adjp"; AVar "number"; AVar "case"; AVar "gender"]]; | |
481 | + adjunct_multi Backward_ [Tensor[Atom "adjp"; AVar "number"; AVar "case"; AVar "gender"; Top; Top; Top]]; | |
482 | + adjunct_dir Forward_ [Tensor[Atom "adjp"; AVar "number"; AVar "case"; AVar "gender"; Top; Top; Top]]; | |
446 | 483 | ] |
447 | 484 | |
448 | 485 | let adj_adjuncts_simp = [ |
449 | - Both, Plus[One;Tensor[Atom "advp"; Top]]; | |
486 | + Both, Plus[One;Tensor[Atom "advp"; Top; Top; Top; Top]]; | |
450 | 487 | ] |
451 | 488 | |
452 | 489 | let adj_connected_adjuncts_simp = [ |
453 | - adjunct [Tensor[Atom "advp"; Top]]; | |
490 | + adjunct [Tensor[Atom "advp"; Top; Top; Top; Top]]; | |
454 | 491 | ] |
455 | 492 | |
456 | 493 | let adv_adjuncts_simp = [ |
457 | - Both, Plus[One;Tensor[Atom "advp"; Top]]; | |
494 | + Both, Plus[One;Tensor[Atom "advp"; Top; Top; Top; Top]]; | |
458 | 495 | ] |
459 | 496 | |
460 | 497 | let adv_connected_adjuncts_simp = [ |
461 | - adjunct [Tensor[Atom "advp"; Top]]; | |
498 | + adjunct [Tensor[Atom "advp"; Top; Top; Top; Top]]; | |
462 | 499 | ] |
463 | 500 | |
464 | 501 | let assing_prep_morfs = function |
... | ... |
lexSemantics/ENIAMwalStringOf.ml
... | ... | @@ -88,9 +88,9 @@ let grad = function |
88 | 88 | Grad s -> s |
89 | 89 | | GradUndef -> "_" |
90 | 90 | |
91 | -let psem = function | |
91 | +(* let psem = function | |
92 | 92 | Psem -> "sem" |
93 | - | Pnosem -> "nosem" | |
93 | + | Pnosem -> "nosem" *) | |
94 | 94 | |
95 | 95 | |
96 | 96 | (* let refl = function |
... | ... | @@ -132,23 +132,29 @@ let pos = function |
132 | 132 | |
133 | 133 | let rec phrase = function |
134 | 134 | NP c -> "np(" ^ case c ^ ")" |
135 | - | PrepNP(p,prep,c) -> "prepnp(" ^ psem p ^ "," ^ prep ^ "," ^ case c ^ ")" | |
135 | + | NPA c -> "npa(" ^ case c ^ ")" | |
136 | + | PrepNP(prep,c) -> "prepnp(" ^ (*psem p ^ "," ^*) prep ^ "," ^ case c ^ ")" | |
136 | 137 | | AdjP c -> "adjp(" ^ case c ^ ")" |
138 | + | AdjA -> "adja" | |
137 | 139 | | PrepAdjP(prep,c) -> "prepadjp(" ^ prep ^ "," ^ case c ^ ")" |
138 | 140 | (* | NumP(c) -> "nump(" ^ case c ^ ")" |
139 | 141 | | PrepNumP(prep,c) -> "prepnump(" ^ prep ^ "," ^ case c ^ ")" *) |
140 | 142 | | ComprepNP(prep) -> "comprepnp(" ^ prep ^ ")" |
141 | - | ComparP(prep,c) -> "comparp(" ^ prep ^ "," ^ case c ^ ")" | |
143 | + | ComparP(prep,c) -> "comparp(" ^(* psem p ^ "," ^*) prep ^ "," ^ case c ^ ")" | |
142 | 144 | | CP(ct,co) -> "cp(" ^ comp_type ct ^ "," ^ comp co ^ ")" |
143 | 145 | | NCP(c,ct,co) -> "ncp(" ^ case c ^ "," ^ comp_type ct ^ "," ^ comp co ^ ")" |
144 | - | PrepNCP(p,prep,c,ct,co) -> "prepncp(" ^ psem p ^ "," ^ prep ^ "," ^ case c ^ "," ^ comp_type ct ^ "," ^ comp co ^ ")" | |
146 | + | PrepNCP(prep,c,ct,co) -> "prepncp(" ^ (*psem p ^ "," ^*) prep ^ "," ^ case c ^ "," ^ comp_type ct ^ "," ^ comp co ^ ")" | |
145 | 147 | | InfP(a) -> "infp(" ^ aspect a (*^ req r*) ^ ")" |
148 | + | PadvP -> "padvp" | |
146 | 149 | | AdvP(m) -> "advp(" ^ m ^ ")" |
150 | + | XP -> "xp" | |
147 | 151 | | ColonP -> "colonp" |
152 | + | SymbolP -> "symbolp" | |
148 | 153 | | FixedP s -> "fixed(" ^ s ^ ")" |
149 | 154 | (* | Num(c,a) -> "num(" ^ case c ^ "," ^ acm a ^ ")" *) |
150 | 155 | | Or -> "or" |
151 | 156 | | Qub -> "qub" |
157 | + | Inclusion -> "inclusion" | |
152 | 158 | | Pro -> "pro" |
153 | 159 | | ProNG -> "prong" |
154 | 160 | | Null -> "null" |
... | ... |
lexSemantics/ENIAMwalTypes.ml
... | ... | @@ -30,7 +30,7 @@ type comp_type = Int | Rel | CompTypeUndef (*| CompTypeAgr*) |
30 | 30 | type number = Number of string | NumberUndef | NumberAgr |
31 | 31 | type gender = Gender of string | GenderUndef | GenderAgr | Genders of string list |
32 | 32 | type grad = Grad of string | GradUndef |
33 | -type psem = Psem | Pnosem | |
33 | +(* type psem = Psem | Pnosem *) | |
34 | 34 | (* type refl = (*ReflEmpty |*) ReflTrue | ReflFalse | ReflUndef *) |
35 | 35 | (* type acm = Acm of string | AcmUndef *) |
36 | 36 | |
... | ... | @@ -63,25 +63,31 @@ type pos = |
63 | 63 | |
64 | 64 | type phrase = |
65 | 65 | NP of case |
66 | - | PrepNP of psem * string * case | |
66 | + | NPA of case | |
67 | + | PrepNP of (*psem **) string * case | |
67 | 68 | | AdjP of case |
69 | + | AdjA | |
68 | 70 | | PrepAdjP of string * case |
69 | 71 | (* | NumP of case |
70 | 72 | | PrepNumP of string * case *) |
71 | 73 | | ComprepNP of string |
72 | - | ComparP of string * case | |
74 | + | ComparP of (*psem **) string * case | |
73 | 75 | | CP of comp_type * comp |
74 | 76 | | NCP of case * comp_type * comp |
75 | - | PrepNCP of psem * string * case * comp_type * comp | |
77 | + | PrepNCP of (*psem **) string * case * comp_type * comp | |
76 | 78 | | InfP of aspect |
79 | + | PadvP | |
77 | 80 | | AdvP of string |
81 | + | XP | |
78 | 82 | | ColonP |
83 | + | SymbolP | |
79 | 84 | | FixedP of string |
80 | 85 | (* | Num of case * acm *) |
81 | 86 | | Or |
82 | 87 | (* | Refl |
83 | 88 | | Recip *) |
84 | 89 | | Qub |
90 | + | Inclusion | |
85 | 91 | | Pro |
86 | 92 | | ProNG |
87 | 93 | | Null |
... | ... | @@ -108,12 +114,16 @@ type necessary = Req | Opt | Pro | ProNG | Multi |
108 | 114 | |
109 | 115 | type direction = Both_ | Forward_ | Backward_ |
110 | 116 | |
111 | -type position = {psn_id: int; gf: gf; role: string; role_attr: string; node: string; sel_prefs: sel_prefs list; cat_prefs: string list; | |
117 | +type range = Local | Distant | Middle | |
118 | + | |
119 | +type position = {psn_id: int; gf: gf; role: string; role_attr: string; node: string; range: range; | |
120 | + sel_prefs: sel_prefs list; cat_prefs: string list; | |
112 | 121 | mode: string list; cr: string list; ce: string list; morfs: phrase list; |
113 | 122 | dir: direction; is_necessary: necessary} |
114 | 123 | |
115 | 124 | let empty_position = |
116 | - {psn_id=(-1); gf=ARG; role=""; role_attr=""; mode=[]; node="concept"; sel_prefs=[]; cat_prefs=["X"]; cr=[]; ce=[]; dir=Both_; morfs=[]; is_necessary=Opt} | |
125 | + {psn_id=(-1); gf=ARG; role=""; role_attr=""; mode=[]; node="concept"; range=Middle; | |
126 | + sel_prefs=[]; cat_prefs=["X"]; cr=[]; ce=[]; dir=Both_; morfs=[]; is_necessary=Opt} | |
117 | 127 | |
118 | 128 | type sense = {mng_id: int; |
119 | 129 | name: string; |
... | ... |
lexSemantics/interface.ml
... | ... | @@ -18,13 +18,19 @@ |
18 | 18 | *) |
19 | 19 | |
20 | 20 | type output = Text | Xml | Html | Marsh | Graphviz |
21 | +type sentence_split = Full | Partial | None | |
21 | 22 | |
22 | 23 | let output = ref Text |
23 | 24 | let comm_stdio = ref true |
25 | +let sentence_split = ref Full | |
24 | 26 | let port = ref 5439 |
25 | 27 | let perform_integration = ref false |
28 | +let par_names = ref false | |
26 | 29 | |
27 | 30 | let spec_list = [ |
31 | + "-s", Arg.Unit (fun () -> sentence_split:=Full), "Split input into sentences (default)"; | |
32 | + "-a", Arg.Unit (fun () -> sentence_split:=Partial), "Split input into paragraphs, do not split input into sentences"; | |
33 | + (* "-n", Arg.Unit (fun () -> sentence_split:=None), "Do not split input into sentences"; *) | |
28 | 34 | "-i", Arg.Unit (fun () -> comm_stdio:=true), "Communication using stdio (default)"; |
29 | 35 | "-p", Arg.Int (fun p -> comm_stdio:=false; port:=p), "<port> Communication using sockets on given port number"; |
30 | 36 | "-t", Arg.Unit (fun () -> output:=Text), "Output as plain text (default)"; |
... | ... | @@ -33,11 +39,19 @@ let spec_list = [ |
33 | 39 | "-h", Arg.Unit (fun () -> output:=Html), "Output as HTML"; |
34 | 40 | "--strong-disamb", Arg.Unit (fun () -> ENIAMsubsyntaxTypes.strong_disambiguate_flag:=true), "Perform strong disambiguation"; |
35 | 41 | "--no-strong-disamb", Arg.Unit (fun () -> ENIAMsubsyntaxTypes.strong_disambiguate_flag:=false), "Do not perform strong disambiguation (default)"; |
36 | - "--dep_parser", Arg.Unit (fun () -> | |
42 | + "--internet-mode", Arg.Unit (fun () -> ENIAMtokenizerTypes.internet_mode:=true), "Relaxed attitude towards interpunction"; | |
43 | + "--no-internet-mode", Arg.Unit (fun () -> ENIAMtokenizerTypes.internet_mode:=false), "Strict attitude towards interpunction (default)"; | |
44 | + "--par-names", Arg.Unit (fun () -> par_names:=true), "Identifiers of paragraphs provided"; | |
45 | + "--no-par-names", Arg.Unit (fun () -> par_names:=false), "No identifiers of paragraphs provided (default)"; | |
46 | + "--proper-names", Arg.Unit (fun () -> ENIAMsubsyntaxTypes.recognize_proper_names:=true), "Recognize proper names (default)"; | |
47 | + "--no-proper-names", Arg.Unit (fun () -> ENIAMsubsyntaxTypes.recognize_proper_names:=false), "Do not recognize proper names"; | |
48 | + "--merge-lemmata", Arg.Unit (fun () -> ENIAMsubsyntaxTypes.merge_lemmata:=true), "Merge lemmata (default)"; | |
49 | + "--no-merge-lemmata", Arg.Unit (fun () -> ENIAMsubsyntaxTypes.merge_lemmata:=false), "Do not merge lemmata"; | |
50 | + "--dep-parser", Arg.Unit (fun () -> | |
37 | 51 | ENIAMpreIntegration.concraft_enabled := true; |
38 | 52 | ENIAMpreIntegration.mate_parser_enabled := true; |
39 | 53 | perform_integration := true), "Enable dependency parser"; |
40 | - "--no_dep_parser", Arg.Unit (fun () -> | |
54 | + "--no-dep-parser", Arg.Unit (fun () -> | |
41 | 55 | ENIAMpreIntegration.concraft_enabled := false; |
42 | 56 | ENIAMpreIntegration.mate_parser_enabled := false), "Disable dependency parser (default)"; |
43 | 57 | ] |
... | ... | @@ -66,7 +80,9 @@ let rec main_loop in_chan out_chan = |
66 | 80 | (* print_endline "input text begin"; |
67 | 81 | print_endline text; |
68 | 82 | print_endline "input text end"; *) |
69 | - let text,tokens,msg = ENIAMsubsyntax.catch_parse_text text in | |
83 | + let text,tokens,msg = | |
84 | + if !sentence_split = Full then ENIAMsubsyntax.catch_parse_text true !par_names text | |
85 | + else ENIAMsubsyntax.catch_parse_text false !par_names text in | |
70 | 86 | let text,msg = |
71 | 87 | if msg <> "" || not !perform_integration then text,msg else |
72 | 88 | ENIAMpreIntegration.catch_parse_text ENIAMsubsyntaxTypes.Struct tokens text in |
... | ... |
morphology/webInterface.ml
... | ... | @@ -27,7 +27,7 @@ let get_sock_addr host_name port = |
27 | 27 | Unix.ADDR_INET(addr.(0),port) |
28 | 28 | |
29 | 29 | let process_query query = |
30 | - let sock = get_sock_addr "wloczykij"(*"localhost"*) 5736 in | |
30 | + let sock = get_sock_addr (*"wloczykij"*)"localhost" 5736 in | |
31 | 31 | let ic,oc = |
32 | 32 | try Unix.open_connection sock |
33 | 33 | with e -> failwith ("server connection error: " ^ Printexc.to_string e) in |
... | ... |
semantics/ENIAMsemGraph.ml
... | ... | @@ -206,7 +206,7 @@ let create_normal_concept tokens lex_sems t cat coerced = |
206 | 206 | (* make_make_triple_relation t (Concept c) else *) |
207 | 207 | if is_sem then make_relation t (add_coerced2 coerced (CreateContext({empty_context with cx_sense=c.c_sense; cx_variable=c.c_variable; cx_pos=c.c_pos; cx_cat=c.c_cat},c.c_relations))) |
208 | 208 | else make_relation t (RemoveRelation("CORE","",c.c_relations)) else |
209 | - if coerced <> Dot then failwith ("create_normal_concept coerced: " ^ t.lemma) else | |
209 | + if coerced <> Dot then failwith ("create_normal_concept coerced: " ^ t.lemma ^ ":" ^ t.pos) else | |
210 | 210 | if t.pos = "pro" || t.pos = "ppron12" || t.pos = "ppron3" || t.pos = "siebie" then (* FIXME: indexicalność *) |
211 | 211 | let c = {c with c_local_quant=false} in |
212 | 212 | let c = Xlist.fold t.attrs c (fun c -> function |
... | ... | @@ -325,7 +325,7 @@ let rec translate_node tokens lex_sems t = |
325 | 325 | arg_dir=t.ENIAM_LCGtypes.arg_dir; |
326 | 326 | attrs=[]; label=""; def_label=""; snode=""; |
327 | 327 | args=create_concepts tokens lex_sems t.ENIAM_LCGtypes.args; |
328 | - gf=""; role=""; role_attr=""; selprefs=Dot; sense=Dot; arole=""; arole_attr=""; arev=false; sem_args=Dot} in | |
328 | + gf=""; role=""; role_attr=""; coord_arg=""; selprefs=Dot; sense=Dot; arole=""; arole_attr=""; arev=false; sem_args=Dot} in | |
329 | 329 | let t,attrs,cat,coerced = Xlist.fold attrs (t,[],Dot,Dot) (fun (t,attrs,cat,coerced) -> function |
330 | 330 | "gf",Val s -> {t with gf=s},attrs,cat,coerced |
331 | 331 | | "role",Val s -> {t with role=s},attrs,cat,coerced |
... | ... | @@ -396,6 +396,7 @@ let rec make_tree_rec references = function |
396 | 396 | | SingleRelation r -> SingleRelation r |
397 | 397 | (* | TripleRelation(r,a,s,t) -> TripleRelation(r,a,make_tree_rec references s,make_tree_rec references t) *) |
398 | 398 | | AddRelation(t,r,a,s) -> AddRelation(make_tree_rec references t,r,a,make_tree_rec references s) |
399 | + | AddParentRelation(t,s) -> AddParentRelation(make_tree_rec references t,make_tree_rec references s) | |
399 | 400 | | AddSingleRelation(r,s) -> AddSingleRelation(r,make_tree_rec references s) |
400 | 401 | | RemoveRelation(r,a,t) -> RemoveRelation(r,a,make_tree_rec references t) |
401 | 402 | | SetContextName(s,t) -> SetContextName(s,make_tree_rec references t) |
... | ... | @@ -423,6 +424,7 @@ let rec validate_translation r = function |
423 | 424 | | SingleRelation _ -> () |
424 | 425 | (* | TripleRelation(_,_,s,t) -> validate_translation r s; validate_translation r t *) |
425 | 426 | | AddRelation(t,_,_,s) -> validate_translation r t; validate_translation r s |
427 | + | AddParentRelation(t,s) -> validate_translation r t; validate_translation r s | |
426 | 428 | | AddSingleRelation(_,s) -> validate_translation r s |
427 | 429 | | RemoveRelation(_,_,t) -> validate_translation r t |
428 | 430 | | SetContextName(s,t) -> validate_translation r t |
... | ... | @@ -512,7 +514,11 @@ let rec extract_aroles t = function |
512 | 514 | let rec reduce_tree = function |
513 | 515 | Concept c -> Concept{c with c_relations=reduce_tree c.c_relations} |
514 | 516 | | Context c -> Context{c with cx_contents=reduce_tree c.cx_contents; cx_relations=reduce_tree c.cx_relations} |
515 | - | Relation(r,a,t) -> Relation(r,a,reduce_tree t) | |
517 | + | Relation(r,a,t) -> | |
518 | + (match reduce_tree t with | |
519 | + AddParentRelation(x,Dot) -> x | |
520 | + | AddParentRelation(x,y) -> Tuple[Relation(r,a,y);x] | |
521 | + | t -> Relation(r,a,reduce_tree t)) | |
516 | 522 | | RevRelation(r,a,t) -> RevRelation(r,a,reduce_tree t) |
517 | 523 | | SingleRelation r -> SingleRelation r |
518 | 524 | (* | TripleRelation(r,a,s,t) -> TripleRelation(r,a,reduce_tree s,reduce_tree t) *) |
... | ... | @@ -533,6 +539,7 @@ let rec reduce_tree = function |
533 | 539 | Concept c -> Concept{c with c_relations=Tuple[Relation(Val r,Val a,s);c.c_relations]} |
534 | 540 | | Context c -> Context{c with cx_relations=Tuple[Relation(Val r,Val a,s);c.cx_relations]} |
535 | 541 | | _ -> AddRelation(t,r,a,s))*) |
542 | + | AddParentRelation(t,s) -> AddParentRelation(reduce_tree t,reduce_tree s) | |
536 | 543 | | RemoveRelation(r0,a0,t) -> |
537 | 544 | (match reduce_tree t with |
538 | 545 | Relation(r,a,t) -> |
... | ... | @@ -570,7 +577,8 @@ let rec reduce_tree = function |
570 | 577 | (match reduce_tree c with |
571 | 578 | Context c -> |
572 | 579 | let t,args = extract_aroles {t with arole=""} c.cx_contents in |
573 | - make_relation t (Context {c with cx_contents=args}) | |
580 | + (*make_relation t (Context {c with cx_contents=args})*) (* FIXME: to trzeba poprawić tak by działało w obu wersjach parserów *) | |
581 | + Relation(t.role,"",Context {c with cx_contents=args}) | |
574 | 582 | | Variant(e,l) -> reduce_tree (Variant(e,Xlist.map l (fun (i,c) -> i,ManageCoordination(t,c)))) |
575 | 583 | | c -> ManageCoordination(t,c)) |
576 | 584 | | Tuple l -> Tuple(List.rev (Xlist.rev_map l reduce_tree)) |
... | ... |
semantics/ENIAMsemGraphOf.ml
... | ... | @@ -270,6 +270,14 @@ let rec print_graph2_rec file edge_rev edge_label edge_style edge_head upper = f |
270 | 270 | let _ = print_graph2_rec file false "" "" "" id t in |
271 | 271 | let _ = print_graph2_rec file false "" "" "" id s in |
272 | 272 | id |
273 | + | AddParentRelation(t,s) -> | |
274 | + let id = !id_counter in | |
275 | + incr id_counter; | |
276 | + fprintf file " %d [shape=circle,label=\"AddParentRelation\"]\n" id; | |
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 | + let _ = print_graph2_rec file false "" "" "" id s in | |
280 | + id | |
273 | 281 | | AddSingleRelation(role,t) -> |
274 | 282 | let id = !id_counter in |
275 | 283 | incr id_counter; |
... | ... |
semantics/ENIAMsemLatexOf.ml
... | ... | @@ -75,7 +75,8 @@ let rec linear_term c = function |
75 | 75 | | SingleRelation r -> "{\\bf singlerelation}(" ^ linear_term 0 r ^ ")" |
76 | 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 | 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 | + | AddParentRelation(r,s) -> "{\\bf addparentrelation}(" ^ linear_term 0 r ^ "," ^ linear_term 0 s ^ ")" | |
79 | + | AddSingleRelation(r,s) -> "{\\bf addsinglerelation}(" ^ linear_term 0 r ^ "," ^ linear_term 0 s ^ ")" | |
79 | 80 | | RemoveRelation(r,a,t) -> "{\\bf removerelation}(" ^ r ^ "," ^ a ^ "," ^ linear_term 0 t ^ ")" |
80 | 81 | | SetContextName(s,t) -> "{\\bf setcontextname}(" ^ linear_term 0 s ^ "," ^ linear_term 0 t ^ ")" |
81 | 82 | | CreateContext(s,t) -> "{\\bf createcontext}(" ^ linear_term 0 (Context s) ^ "," ^ linear_term 0 t ^ ")" |
... | ... |
semantics/ENIAMsemStringOf.ml
... | ... | @@ -52,6 +52,7 @@ let rec linear_term c = function |
52 | 52 | | SingleRelation r -> "singlerelation(" ^ linear_term 0 r ^ ")" |
53 | 53 | (* | TripleRelation(r,a,c,t) -> "triplerelation(" ^ r ^ "," ^ a ^ "," ^ linear_term 0 c ^ "," ^ linear_term 0 t ^ ")" *) |
54 | 54 | | AddRelation(t,r,a,s) -> "addrelation(" ^ linear_term 0 t ^ "," ^ r ^ "," ^ a ^ "," ^ linear_term 0 s ^ ")" |
55 | + | AddParentRelation(t,s) -> "addparentrelation(" ^ linear_term 0 t ^ "," ^ linear_term 0 s ^ ")" | |
55 | 56 | | AddSingleRelation(r,s) -> "addsinglerelation(" ^ linear_term 0 r ^ "," ^ linear_term 0 s ^ ")" |
56 | 57 | | RemoveRelation(r,a,t) -> "removerelation(" ^ r ^ "," ^ a ^ "," ^ linear_term 0 t ^ ")" |
57 | 58 | | SetContextName(s,t) -> "setcontextname(" ^ linear_term 0 s ^ "," ^ linear_term 0 t ^ ")" |
... | ... |
semantics/ENIAMsemTypes.ml
... | ... | @@ -39,6 +39,7 @@ type node = { |
39 | 39 | gf: string; |
40 | 40 | role: string; |
41 | 41 | role_attr: string; |
42 | + coord_arg: string; | |
42 | 43 | selprefs: linear_term; |
43 | 44 | sense: linear_term; |
44 | 45 | arole: string; |
... | ... | @@ -74,6 +75,7 @@ and linear_term = |
74 | 75 | | SingleRelation of linear_term |
75 | 76 | (* | TripleRelation of string * string * linear_term * linear_term (* role * role_attr * concept *) *) |
76 | 77 | | AddRelation of linear_term * string * string * linear_term (* nadrzędnik * role * role_attr * podrzędnik *) |
78 | + | AddParentRelation of linear_term * linear_term (* relacja * podrzędnik *) | |
77 | 79 | | AddSingleRelation of linear_term * linear_term (* role * podrzędnik *) |
78 | 80 | | RemoveRelation of string * string * linear_term |
79 | 81 | | SetContextName of linear_term * linear_term (* sense * concept *) |
... | ... |
semantics/ENIAMsemXMLof.ml
... | ... | @@ -61,6 +61,9 @@ let rec linear_term = function |
61 | 61 | | AddRelation(t,r,a,s) -> |
62 | 62 | Xml.Element("AddRelation",["role",r;"role_attribute",a], |
63 | 63 | [Xml.Element("",[],[linear_term t]);Xml.Element("",[],[linear_term s])]) |
64 | + | AddParentRelation(t,s) -> | |
65 | + Xml.Element("AddParentRelation",[], | |
66 | + [Xml.Element("",[],[linear_term t]);Xml.Element("",[],[linear_term s])]) | |
64 | 67 | | AddSingleRelation(r,s) -> |
65 | 68 | Xml.Element("AddSingleRelation",[], |
66 | 69 | [Xml.Element("",[],[linear_term r]);Xml.Element("",[],[linear_term s])]) |
... | ... |