Commit e1e0aff2fdff30ee63fa356e4f78f35223d5a2e6
1 parent
95c86f11
usunięcie pola 'cats' ze struktury danych
Showing
12 changed files
with
137 additions
and
29 deletions
exec/makefile
... | ... | @@ -32,11 +32,14 @@ eniam-exec.cmxa: $(SOURCES) |
32 | 32 | ocamlopt -linkall -a -o eniam-exec.cmxa $(INCLUDES) $^ |
33 | 33 | |
34 | 34 | parser: $(SOURCES) parser.ml |
35 | - $(OCAMLOPT) -o parser $(OCAMLOPTFLAGS) $(SOURCES) parser.ml | |
35 | + $(OCAMLOPT) -o parser $(OCAMLOPTFLAGS) $^ | |
36 | + | |
37 | +domparser: $(SOURCES) domparser.ml | |
38 | + $(OCAMLOPT) -o domparser $(OCAMLOPTFLAGS) eniam-domainLexSemantics.cmxa $^ | |
36 | 39 | |
37 | 40 | semparser: $(SOURCES) semparser.ml |
38 | 41 | mkdir -p results |
39 | - $(OCAMLOPT) -o semparser $(OCAMLOPTFLAGS) $(SOURCES) semparser.ml | |
42 | + $(OCAMLOPT) -o semparser $(OCAMLOPTFLAGS) $^ | |
40 | 43 | |
41 | 44 | webInterface: ENIAMexecTypes.ml ENIAMvisualization.ml webInterface.ml |
42 | 45 | $(OCAMLOPT) -o parser3.cgi $(OCAMLOPTFLAGS) $^ |
... | ... |
lexSemantics/ENIAMadjuncts.ml
... | ... | @@ -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,schema) = | |
256 | +let add_adjuncts preps compreps compars pos2 (selectors,cat,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,schema @ ENIAMwalRenderer.verb_adjuncts_simp @ prepnps @ prepadjps @ compreps @ compars] | |
262 | + "verb" -> [selectors,cat,schema @ ENIAMwalRenderer.verb_adjuncts_simp @ prepnps @ prepadjps @ compreps @ compars] | |
263 | 263 | | "noun" -> [ |
264 | - [Nsyn,Eq,["proper"]] @ selectors,ENIAMwalRenderer.proper_noun_adjuncts_simp @ prepnps @ compreps @ compars; | |
265 | - [Nsyn,Eq,["common"];Nsem,Eq,["measure"]] @ selectors,ENIAMwalRenderer.measure_noun_adjuncts_simp @ prepnps @ compreps @ compars; | |
266 | - [Nsyn,Eq,["common"];Nsem,Neq,["measure"]] @ selectors,ENIAMwalRenderer.common_noun_adjuncts_simp @ prepnps @ compreps @ compars] | |
267 | - | "adj" -> [selectors,schema @ ENIAMwalRenderer.adj_adjuncts_simp @ compars] | |
268 | - | "adv" -> [selectors,schema @ ENIAMwalRenderer.adv_adjuncts_simp @ compars] | |
264 | + [Nsyn,Eq,["proper"]] @ selectors,cat,ENIAMwalRenderer.proper_noun_adjuncts_simp @ prepnps @ compreps @ compars; | |
265 | + [Nsyn,Eq,["common"];Nsem,Eq,["measure"]] @ selectors,cat,ENIAMwalRenderer.measure_noun_adjuncts_simp @ prepnps @ compreps @ compars; | |
266 | + [Nsyn,Eq,["common"];Nsem,Neq,["measure"]] @ selectors,cat,ENIAMwalRenderer.common_noun_adjuncts_simp @ prepnps @ compreps @ compars] | |
267 | + | "adj" -> [selectors,cat,schema @ ENIAMwalRenderer.adj_adjuncts_simp @ compars] | |
268 | + | "adv" -> [selectors,cat,schema @ ENIAMwalRenderer.adv_adjuncts_simp @ compars] | |
269 | 269 | | _ -> [] |
270 | 270 | |
271 | 271 | open ENIAMlexSemanticsTypes |
... | ... |
lexSemantics/ENIAMlexSemantics.ml
... | ... | @@ -302,7 +302,7 @@ let assign_valence tokens lex_sems group = |
302 | 302 | let schemata = ENIAMadjuncts.simplify_schemata lexemes pos pos2 lemma schemata1 in |
303 | 303 | (* Printf.printf "C %s |schemata|=%d\n" lemma (Xlist.size schemata); *) |
304 | 304 | let schemata = Xlist.rev_map schemata (fun (selectors,schema) -> |
305 | - selectors,ENIAMwalRenderer.render_simple_schema schema) in | |
305 | + selectors,["X"],ENIAMwalRenderer.render_simple_schema schema) in | |
306 | 306 | let schemata = List.flatten (Xlist.rev_map schemata (ENIAMadjuncts.add_adjuncts preps compreps compars pos2)) in |
307 | 307 | (* Printf.printf "D %s |schemata|=%d\n" lemma (Xlist.size schemata); *) |
308 | 308 | let entries = List.flatten (Xlist.rev_map entries (ENIAMvalence.transform_lex_entry pos lemma)) in |
... | ... | @@ -343,7 +343,7 @@ let assign_valence tokens lex_sems group = |
343 | 343 | let connected = Xlist.rev_map connected mark_nosem in |
344 | 344 | (* let connected = List.flatten (Xlist.rev_map connected (set_context lemma pos)) in *) |
345 | 345 | (* Printf.printf "K %s |connected|=%d\n" lemma (Xlist.size connected); *) |
346 | - ExtArray.set lex_sems id {(ExtArray.get lex_sems id) with | |
346 | + ExtArray.set lex_sems id {(*(ExtArray.get lex_sems id) with*) | |
347 | 347 | schemata=schemata; lex_entries=entries; frames=connected}) |
348 | 348 | |
349 | 349 | (* TODO: |
... | ... | @@ -356,8 +356,6 @@ let assign_valence tokens lex_sems group = |
356 | 356 | - scalanie frames |
357 | 357 | *) |
358 | 358 | |
359 | - | |
360 | - | |
361 | 359 | (* |
362 | 360 | let assign_valence tokens lex_sems group = |
363 | 361 | let lexemes = Xlist.fold group StringMap.empty (fun lexemes id -> |
... | ... |
lexSemantics/ENIAMlexSemanticsHTMLof.ml
... | ... | @@ -60,8 +60,8 @@ 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,l) -> | |
64 | - "  [" ^ ENIAMcategoriesPL.string_of_selectors selectors ^ "] {" ^ String.concat ", " (Xlist.map l (fun (d,s) -> | |
63 | + let schemata = Xlist.map t.schemata (fun (selectors,cat,l) -> | |
64 | + "  [" ^ ENIAMcategoriesPL.string_of_selectors selectors ^ "]" ^ String.concat "," cat ^ "{" ^ String.concat ", " (Xlist.map l (fun (d,s) -> | |
65 | 65 | ENIAM_LCGstringOf.direction d ^ ENIAM_LCGstringOf.grammar_symbol 0 s)) ^ "}") in |
66 | 66 | (* let frames = Xlist.map t.frames (fun (selectors,meanings,schema) -> FIXME |
67 | 67 | "  [" ^ ENIAMcategoriesPL.string_of_selectors selectors ^ "] {" ^ ENIAMwalStringOf.schema schema ^ "} " ^ |
... | ... |
lexSemantics/ENIAMlexSemanticsStringOf.ml
... | ... | @@ -40,8 +40,8 @@ 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,l) -> | |
44 | - "[" ^ ENIAMcategoriesPL.string_of_selectors selectors ^ "] {" ^ String.concat "," (Xlist.map l (fun (d,s) -> | |
43 | + let schemata = Xlist.map t.schemata (fun (selectors,cat,l) -> | |
44 | + "[" ^ ENIAMcategoriesPL.string_of_selectors selectors ^ "]" ^ String.concat "," cat ^ "{" ^ String.concat "," (Xlist.map l (fun (d,s) -> | |
45 | 45 | ENIAM_LCGstringOf.direction d ^ ENIAM_LCGstringOf.grammar_symbol 0 s)) ^ "}") in |
46 | 46 | let frames = Xlist.map t.frames (fun f -> |
47 | 47 | "*" ^ arole f ^ "[" ^ ENIAMcategoriesPL.string_of_selectors f.selectors ^ "] {" ^ ENIAMwalStringOf.schema f.positions ^ "} " ^ |
... | ... |
lexSemantics/ENIAMlexSemanticsTypes.ml
... | ... | @@ -40,15 +40,16 @@ let empty_frame = {selectors=[]; meanings=[]; positions=[]; arole=""; arole_attr |
40 | 40 | |
41 | 41 | type lex_sem = { |
42 | 42 | schemata: ((ENIAM_LCGlexiconTypes.selector * ENIAM_LCGlexiconTypes.selector_relation * string list) list * |
43 | + string list * (* sensy *) | |
43 | 44 | (ENIAM_LCGtypes.direction * ENIAM_LCGtypes.grammar_symbol) list) list; |
44 | 45 | lex_entries: ((ENIAM_LCGlexiconTypes.selector * ENIAM_LCGlexiconTypes.selector_relation * string list) list * |
45 | 46 | ENIAM_LCGtypes.grammar_symbol) list; |
46 | 47 | frames: frame list; |
47 | - cats: (string * string list) list; | |
48 | + (* cats: (string * string list) list; *) | |
48 | 49 | } |
49 | 50 | |
50 | 51 | let empty_lex_sem = { |
51 | - schemata=[]; lex_entries=[]; frames=[]; cats=["X",["X"]]} | |
52 | + schemata=[]; lex_entries=[]; frames=[]; (*cats=["X",["X"]]*)} | |
52 | 53 | |
53 | 54 | let hipero_threshold = 3 |
54 | 55 | let unknown_meaning_weight = -1. |
... | ... | @@ -59,3 +60,5 @@ let syn_filename = resource_path ^ "/plWordnet/syn.tab" |
59 | 60 | |
60 | 61 | let predef_filename = resource_path ^ "/lexSemantics/predef_prefs.tab" |
61 | 62 | let proper_classes_filename = resource_path ^ "/lexSemantics/proper_classes.tab" |
63 | + | |
64 | +let proj_filename = ENIAMwalTypes.data_path ^ "/projections.tab" | |
... | ... |
lexSemantics/ENIAMvalence.ml
... | ... | @@ -76,6 +76,7 @@ let transform_np_phrase lemma = function |
76 | 76 | NP(Case case) -> [NP(Case case)(*;NumP(Case case)*)] |
77 | 77 | | NP(CaseAgr) -> [NP(CaseAgr)(*;NumP(CaseAgr)*)] |
78 | 78 | | NCP(Case c,ctype,comp) -> [NCP(Case c,ctype,comp)] |
79 | + | NP(CaseUndef) -> [NP(CaseUndef)(*;NumP(Case case)*)] | |
79 | 80 | | AdjP(Case _) as morf -> [morf] (* tylko 'zagłada adjp(postp)' *) |
80 | 81 | | AdjP(CaseAgr) -> [AdjP(AllAgr)] |
81 | 82 | | AdjP(Str) -> [AdjP(AllAgr)] (* chyba błąd walentego, tylko 'barwa', 'bieda', 'głód', 'kolor', 'nędza', 'śmierć', 'usta' *) |
... | ... | @@ -247,7 +248,7 @@ let transform_pers_subj_phrase lemma negation mood = function (* FIXME: prepnp(n |
247 | 248 | | CP(ctype,comp) as morf -> [morf] |
248 | 249 | | InfP _ as morf -> [morf] |
249 | 250 | | Or as morf -> [morf] |
250 | - (* | Pro -> [ProNG] *) | |
251 | + | Pro -> [ProNG] | |
251 | 252 | | Null -> [Null] |
252 | 253 | | morf -> failwith ("transform_pers_subj_phrase: " ^ lemma ^ " " ^ ENIAMwalStringOf.phrase morf) |
253 | 254 | |
... | ... | @@ -291,6 +292,7 @@ let transform_pers_phrase lemma negation mood = function |
291 | 292 | | NP(Str) -> List.flatten (Xlist.map (transform_str mood negation) (fun case -> [NP case(*;NumP(case)*)])) |
292 | 293 | | NP(Part) -> [NP(Case "gen")] @ (if mood = "gerundial" then [] else [NP(Case "acc")(*;NumP(Case "gen");NumP(Case "acc")*)]) |
293 | 294 | | NP(Case case) -> [NP(Case case)(*;NumP(Case case)*)] |
295 | + | NP(CaseUndef) -> [NP(CaseUndef)(*;NumP(Case case)*)] | |
294 | 296 | | NCP(Str,ctype,comp) -> List.flatten (Xlist.map (transform_str mood negation) (fun case -> [NCP(case,ctype,comp)])) |
295 | 297 | | NCP(Part,ctype,comp) -> List.flatten (Xlist.map (transform_str mood negation) (fun case -> [NCP(case,ctype,comp)])) |
296 | 298 | | NCP(Case case,ctype,comp) -> [NCP(Case case,ctype,comp)] |
... | ... |
lexSemantics/ENIAMwalRenderer.ml
... | ... | @@ -171,6 +171,69 @@ let render_phrase = function |
171 | 171 | | E (PrepNCP(prep,Case case,CompTypeUndef,CompUndef)) -> Tensor[Atom "prepncp"; Atom prep; Atom case; Top; Top] |
172 | 172 | | phrase -> failwith ("render_phrase: " ^ ENIAMwalStringOf.phrase phrase) |
173 | 173 | |
174 | +let render_phrase_cat cat = function | |
175 | + NP(Case case) -> Tensor[Atom "np"; Atom cat; Top; Atom case; Top; Top] | |
176 | + | NP NomAgr -> Tensor[Atom "np"; Atom cat; AVar "number"; Atom "nom"; AVar "gender"; AVar "person"] | |
177 | +(* | NP GenAgr -> Tensor[Atom "np"; Atom cat; AVar "number"; Atom "gen"; AVar "gender"; AVar "person"] | |
178 | + | NP AllAgr -> Tensor[Atom "np"; Atom cat; AVar "number"; AVar "case"; AVar "gender"; AVar "person"]*) | |
179 | + | NP CaseAgr -> Tensor[Atom "np"; Atom cat; Top; AVar "case"; Top; Top] | |
180 | + | NP CaseUndef -> Tensor[Atom "np"; Atom cat; Top; Top; Top; Top] | |
181 | + | PrepNP("",CaseUndef) -> Tensor[Atom "prepnp"; Atom cat; Top; Top] | |
182 | + | PrepNP("_",CaseUndef) -> Tensor[Atom "prepnp"; Atom cat; Top; Top] | |
183 | + | PrepNP(prep,Case case) -> Tensor[Atom "prepnp"; Atom cat; Atom prep; Atom case] | |
184 | + | AdjP(Case case) -> Tensor[Atom "adjp"; Atom cat; Top; Atom case; Top] | |
185 | +(* | AdjP NomAgr -> Tensor[Atom "adjp"; AVar "number"; Atom "nom"; AVar "gender"]*) | |
186 | + | AdjP AllAgr -> Tensor[Atom "adjp"; Atom cat; AVar "number"; AVar "case"; AVar "gender"] | |
187 | +(* | AdjP CaseAgr -> Tensor[Atom "adjp"; Top; AVar "case"; Top] | |
188 | + | PrepAdjP("",CaseUndef) -> Tensor[Atom "prepnp"; Top; Top]*) | |
189 | + | PrepAdjP(prep,Case case) -> Tensor[Atom "prepadjp"; Atom cat; Atom prep; Atom case] | |
190 | + (* | NumP(Case case) -> Tensor[Atom "nump"; Top; Atom case; Top; Top] | |
191 | + | NumP NomAgr -> Tensor[Atom "nump"; AVar "number"; Atom "nom"; AVar "gender"; AVar "person"] | |
192 | + | NumP CaseAgr -> Tensor[Atom "nump"; Top; AVar "case"; Top; Top] | |
193 | + | NumP CaseUndef -> Tensor[Atom "nump"; Top; Top; Top; Top] | |
194 | + | PrepNumP(_,"",CaseUndef) -> Tensor[Atom "prepnp"; Top; Top] | |
195 | + | PrepNumP(_,prep,Case case) -> Tensor[Atom "prepnump"; Atom prep; Atom case] *) | |
196 | +(* | ComprepNP("") -> Tensor[Atom "comprepnp"; Top]*) | |
197 | + | ComprepNP(prep) -> Tensor[Atom "comprepnp"; Atom cat; Atom prep] | |
198 | + | ComparP(prep,Case case) -> Tensor[Atom "compar"; Atom cat; Atom prep; Atom case] | |
199 | + (* | ComparPP(_,prep) -> Tensor[Atom "comparpp"; Atom prep] *) | |
200 | + (* | IP -> Tensor[Atom "ip";Top;Top;Top] *) | |
201 | + | CP (ctype,Comp comp) -> Tensor[Atom "cp"; Atom cat; arg_of_ctype ctype; Atom comp] | |
202 | + (* | CP (ctype,CompUndef) -> Tensor[Atom "cp"; arg_of_ctype ctype; Top]*) | |
203 | + | NCP(Case case,ctype,Comp comp) -> Tensor[Atom "ncp"; Atom cat; Top; Atom case; Top; Top; arg_of_ctype ctype; Atom comp] | |
204 | + | NCP(Case case,CompTypeUndef,CompUndef) -> Tensor[Atom "ncp"; Atom cat; Top; Atom case; Top; Top; Top; Top] | |
205 | + | NCP(NomAgr,ctype,Comp comp) -> Tensor[Atom "ncp"; Atom cat; AVar "number"; Atom "nom"; AVar "gender"; AVar "person"; arg_of_ctype ctype; Atom comp] | |
206 | + | NCP(NomAgr,CompTypeUndef,CompUndef) -> Tensor[Atom "ncp"; Atom cat; AVar "number"; Atom "nom"; AVar "gender"; AVar "person"; Top; Top] | |
207 | + | PrepNCP(prep,Case case,ctype,Comp comp) -> Tensor[Atom "prepncp"; Atom cat; Atom prep; Atom case; arg_of_ctype ctype; Atom comp] | |
208 | + | PrepNCP(prep,Case case,CompTypeUndef,CompUndef) -> Tensor[Atom "prepncp"; Atom cat; Atom prep; Atom case; Top; Top] | |
209 | + | InfP(Aspect aspect) -> Tensor[Atom "infp"; Atom cat; Atom aspect] | |
210 | + | InfP AspectUndef -> Tensor[Atom "infp"; Atom cat; Top] | |
211 | + (* | PadvP -> Tensor[Atom "padvp"] *) | |
212 | + | AdvP "misc" -> Tensor[Atom "advp"; Atom cat; Top] (* FIXME: a może Atom "mod" zamiast Top *) | |
213 | + | AdvP mode -> Tensor[Atom "advp"; Atom cat; Atom mode] | |
214 | + (* | PrepP -> Tensor[Atom "prepp";Top] | |
215 | + | Prep("",CaseAgr) -> Tensor[Atom "prep"; Top; AVar "case"] | |
216 | + | Prep("",CaseUAgr) -> Tensor[Atom "prep"; Top; AVar "ucase"] | |
217 | + | Num(AllAgr,Acm acm) -> Tensor[Atom "num"; AVar "number"; AVar "case"; AVar "gender"; AVar "person"; Atom acm] | |
218 | + | Measure(AllUAgr) -> Tensor[Atom "measure"; AVar "unumber"; AVar "ucase"; AVar "ugender"; AVar "uperson"] *) | |
219 | + (* | Qub -> Tensor[Atom "qub"]*) | |
220 | + (* | Inclusion -> Tensor[Atom "inclusion"] | |
221 | + | Adja -> Tensor[Atom "adja"] | |
222 | + | Aglt -> Tensor[Atom "aglt"; AVar "number"; AVar "person"] | |
223 | + | AuxPast -> Tensor[Atom "aux-past"; AVar "number"; AVar "gender"; AVar "person"] | |
224 | + | AuxFut -> Tensor[Atom "aux-fut"; AVar "number"; AVar "gender"; AVar "person"] | |
225 | + | AuxImp -> Tensor[Atom "aux-imp"] | |
226 | + | Pro -> One | |
227 | + | ProNG -> One *) | |
228 | + | E (CP(CompTypeUndef,CompUndef)) -> Tensor[Atom "cp"; Atom cat; Top; Top] | |
229 | + | E (NCP(NomAgr,CompTypeUndef,CompUndef)) -> Tensor[Atom "ncp"; Atom cat; AVar "number"; Atom "nom"; AVar "gender"; AVar "person"; Top; Top] | |
230 | + | E (NP(NomAgr)) -> Tensor[Atom "np"; Atom cat; AVar "number"; Atom "nom"; AVar "gender"; AVar "person"] | |
231 | + | E (PrepNP(prep,Case case)) -> Tensor[Atom "prepnp"; Atom cat; Atom prep; Atom case] | |
232 | + | E (NP(Case case)) -> Tensor[Atom "np"; Atom cat; Top; Atom case; Top; Top] | |
233 | + | E (NCP(Case case,CompTypeUndef,CompUndef)) -> Tensor[Atom "ncp"; Atom cat; Top; Atom case; Top; Top; Top; Top] | |
234 | + | E (PrepNCP(prep,Case case,CompTypeUndef,CompUndef)) -> Tensor[Atom "prepncp"; Atom cat; Atom prep; Atom case; Top; Top] | |
235 | + | phrase -> failwith ("render_phrase: " ^ ENIAMwalStringOf.phrase phrase) | |
236 | + | |
174 | 237 | let render_morf = function |
175 | 238 | | Null -> One |
176 | 239 | (* | X -> Tensor[Atom "X"] |
... | ... | @@ -179,6 +242,24 @@ let render_morf = function |
179 | 242 | | SimpleLexArg(lex,pos) -> Tensor([Atom "lex";Atom lex] @ render_pos pos) |
180 | 243 | | phrase -> render_phrase phrase |
181 | 244 | |
245 | +let render_morf_cat cats = function | |
246 | + | Null -> [One] | |
247 | + | Pro -> [One] | |
248 | + | ProNG -> [One] | |
249 | + | FixedP lex -> [Tensor[Atom "fixed"; Atom lex]] | |
250 | + | Or -> [Tensor[Atom "or"]] | |
251 | + | E Or -> [Tensor[Atom "or"]] | |
252 | + (* | X -> Tensor[Atom "X"] | |
253 | + | Lex lex -> Tensor[Atom lex] *) | |
254 | + | LexArg(id,lex,pos) -> [Tensor([Atom "lex";Atom (string_of_int id);Atom lex] @ render_pos pos)] | |
255 | + | SimpleLexArg(lex,pos) -> [Tensor([Atom "lex";Atom lex] @ render_pos pos)] | |
256 | + | phrase -> Xlist.map cats (fun cat -> render_phrase_cat cat phrase) | |
257 | + | |
258 | +let extract_sel_prefs sel_prefs = | |
259 | + Xlist.map sel_prefs (function | |
260 | + Predef s -> s | |
261 | + | _ -> failwith "extract_sel_prefs") | |
262 | + | |
182 | 263 | let render_schema schema = |
183 | 264 | Xlist.map schema (fun p -> |
184 | 265 | match Xlist.map p.morfs render_morf with |
... | ... | @@ -186,6 +267,13 @@ let render_schema schema = |
186 | 267 | | [s] -> Both,s |
187 | 268 | | l -> Both,Plus l) |
188 | 269 | |
270 | +let render_schema_cat schema = | |
271 | + Xlist.map schema (fun p -> | |
272 | + match List.flatten (Xlist.map p.morfs (render_morf_cat (extract_sel_prefs p.sel_prefs))) with | |
273 | + [] -> failwith "render_schema" | |
274 | + | [s] -> Both,s | |
275 | + | l -> Both,Plus l) | |
276 | + | |
189 | 277 | let render_simple_schema schema = |
190 | 278 | Xlist.map schema (fun morfs -> |
191 | 279 | Both,Plus(One :: Xlist.map morfs render_morf)) |
... | ... | @@ -194,6 +282,10 @@ let render_connected_schema schema = |
194 | 282 | Xlist.map schema (fun p -> |
195 | 283 | {p with morfs=Xlist.map p.morfs (fun morf -> LCG (render_morf morf))}) |
196 | 284 | |
285 | +let render_connected_schema_cat schema = | |
286 | + Xlist.map schema (fun p -> | |
287 | + {p with morfs=Xlist.map (List.flatten (Xlist.map p.morfs (render_morf_cat (extract_sel_prefs p.sel_prefs)))) (fun morf -> LCG morf)}) | |
288 | + | |
197 | 289 | (* FIXME: tu trzeba by dodać zwykłe reguły dla czasowników dotyczące ich negacji, aglutynatu itp. *) |
198 | 290 | let render_lex_entry = function |
199 | 291 | SimpleLexEntry(lemma,pos) -> Tensor([Atom "lex";Atom lemma] @ render_pos_entry pos) |
... | ... |
lexSemantics/ENIAMwalStringOf.ml
... | ... | @@ -138,12 +138,13 @@ let rec phrase = function |
138 | 138 | | PrepNCP(prep,c,ct,co) -> "prepncp(" ^ prep ^ "," ^ case c ^ "," ^ comp_type ct ^ "," ^ comp co ^ ")" |
139 | 139 | | InfP(a) -> "infp(" ^ aspect a (*^ req r*) ^ ")" |
140 | 140 | | AdvP(m) -> "advp(" ^ m ^ ")" |
141 | + | ColonP -> "colonp" | |
141 | 142 | | FixedP s -> "fixed(" ^ s ^ ")" |
142 | 143 | (* | Num(c,a) -> "num(" ^ case c ^ "," ^ acm a ^ ")" *) |
143 | 144 | | Or -> "or" |
144 | 145 | | Qub -> "qub" |
145 | - (* | Pro -> "pro" | |
146 | - | ProNG -> "prong" *) | |
146 | + | Pro -> "pro" | |
147 | + | ProNG -> "prong" | |
147 | 148 | | Null -> "null" |
148 | 149 | (* | GerP c -> "gerp(" ^ case c ^ ")" |
149 | 150 | | PrepGerP(prep,c) -> "prepgerp(" ^ prep ^ "," ^ case c ^ ")" |
... | ... |
lexSemantics/ENIAMwalTypes.ml
... | ... | @@ -74,14 +74,15 @@ type phrase = |
74 | 74 | | PrepNCP of string * case * comp_type * comp |
75 | 75 | | InfP of aspect |
76 | 76 | | AdvP of string |
77 | + | ColonP | |
77 | 78 | | FixedP of string |
78 | 79 | (* | Num of case * acm *) |
79 | 80 | | Or |
80 | 81 | (* | Refl |
81 | 82 | | Recip *) |
82 | 83 | | Qub |
83 | - (* | Pro | |
84 | - | ProNG *) | |
84 | + | Pro | |
85 | + | ProNG | |
85 | 86 | | Null |
86 | 87 | (* | GerP of case |
87 | 88 | | PrepGerP of string * case |
... | ... | @@ -165,8 +166,14 @@ let resource_path = |
165 | 166 | if Sys.file_exists "resources" then "resources" else |
166 | 167 | failwith "resource directory does not exists" |
167 | 168 | |
169 | +let data_path = | |
170 | + try Sys.getenv "ENIAM_USER_DATA_PATH" | |
171 | + with Not_found -> "data" | |
172 | + | |
168 | 173 | let phrases_filename = resource_path ^ "/Walenty/phrases.tab" |
169 | 174 | let entries_filename = resource_path ^ "/Walenty/entries.tab" |
170 | 175 | let schemata_filename = resource_path ^ "/Walenty/schemata.tab" |
171 | 176 | let connected_filename = resource_path ^ "/Walenty/connected.tab" |
172 | 177 | let meanings_filename = resource_path ^ "/Walenty/meanings.tab" |
178 | + | |
179 | +let user_valence_filename = data_path ^ "/valence.dic" | |
... | ... |
lexSemantics/README
1 | -ENIAMsemValence Version 1.0 : | |
1 | +ENIAMlexSemantics Version 1.0 : | |
2 | 2 | ----------------------- |
3 | 3 | |
4 | -ENIAMsemValence is a library that assigns tokens with lexicosemantic information. | |
4 | +ENIAMlexSemantics is a library that assigns tokens with lexicosemantic information. | |
5 | 5 | It assigns thematic roles, word senses, valence and other semantic information to tokens. |
6 | 6 | |
7 | 7 | Install |
8 | 8 | ------- |
9 | 9 | |
10 | -ENIAMsemValence requires OCaml version 4.02.3 compiler | |
10 | +ENIAMlexSemantics requires OCaml version 4.02.3 compiler | |
11 | 11 | together with Xlib library version 3.1 or later, |
12 | 12 | ENIAMtokenizer library version 1.0, ENIAMmorphology library version 1.0 |
13 | 13 | and ENIAMsubsyntax library version 1.0. |
... | ... | @@ -16,14 +16,14 @@ In order to install type: |
16 | 16 | |
17 | 17 | make install |
18 | 18 | |
19 | -by default, ENIAMsemValence is installed in the 'ocamlc -where'/eniam directory. | |
19 | +by default, ENIAMlexSemantics is installed in the 'ocamlc -where'/eniam directory. | |
20 | 20 | you can change it by editing the Makefile. |
21 | 21 | |
22 | 22 | In order to test library type: |
23 | 23 | make test |
24 | 24 | ./test |
25 | 25 | |
26 | -By default ENIAMsemValence looks for resources in /usr/share/eniam directory. | |
26 | +By default ENIAMlexSemantics looks for resources in /usr/share/eniam directory. | |
27 | 27 | However this behaviour may be changed by setting end exporting ENIAM_RESOURCE_PATH |
28 | 28 | environment variable. |
29 | 29 | |
... | ... |
lexSemantics/interface.ml
... | ... | @@ -34,6 +34,8 @@ let spec_list = [ |
34 | 34 | "-x", Arg.Unit (fun () -> output:=Xml), "Output as XML"; |
35 | 35 | "-m", Arg.Unit (fun () -> output:=Marsh), "Output as marshalled Ocaml data structure"; |
36 | 36 | "-h", Arg.Unit (fun () -> output:=Html), "Output as HTML"; |
37 | + "--strong-disamb", Arg.Unit (fun () -> ENIAMsubsyntaxTypes.strong_disambiguate_flag:=true), "Perform strong disambiguation"; | |
38 | + "--no-strong-disamb", Arg.Unit (fun () -> ENIAMsubsyntaxTypes.strong_disambiguate_flag:=false), "Do not perform strong disambiguation (default)"; | |
37 | 39 | "--dep_parser", Arg.Unit (fun () -> |
38 | 40 | ENIAMpreIntegration.concraft_enabled := true; |
39 | 41 | ENIAMpreIntegration.mate_parser_enabled := true; |
... | ... |