Commit fff6fc9e42f3f6bdb7988c1f86883803e1e9ddc0

Authored by Daniel Oklesiński
1 parent ce387d9e

poprawianie drzew zależnościowych: usuwanie znaków interpunkcyjnych i zmienianie…

… zależności słów że i by
diagnostics/LCGfields.ml
... ... @@ -116,5 +116,5 @@ let rec print_fields_rec fields = function
116 116 print_fields_rec fields (snd @@ List.find (fun (m,t) -> m = Struct || m = ENIAM || m = CONLL) l)
117 117  
118 118 let print_fields fields text =
119   - print_fields_rec fields text;
120   - print_field_map ()
  119 + print_fields_rec fields text
  120 + (* ; print_field_map () *)
... ...
diagnostics/treeChange.ml 0 → 100644
  1 +open Xstd
  2 +open PreTypes
  3 +
  4 +let remove_interps paths tokens =
  5 + let paths_ls = Array.to_list paths in
  6 + Array.iter (fun (id,super,label) ->
  7 + if ((ExtArray.get tokens id).orth = "," ||
  8 + (ExtArray.get tokens id).orth = "." ||
  9 + (ExtArray.get tokens id).orth = "-") &&
  10 + not (List.exists (fun (_,super,_) -> super = id) paths_ls)
  11 + then paths.(id) <- (0,-1,"")) paths; paths
  12 +
  13 +let move_comp paths tokens =
  14 + let correct_dep (id,super,label) =
  15 + let is_comp = function
  16 + Lemma(_,"comp",_) -> true
  17 + | _ -> false in
  18 + if ((ExtArray.get tokens id).orth = "by" || (ExtArray.get tokens id).orth = "że")
  19 + && is_comp (ExtArray.get tokens id).token
  20 + then (let id_S, super_S, label_S = paths.(super) in
  21 + paths.(id) <- (id,super_S,label);
  22 + paths.(super) <- (id_S, id, label_S)) in
  23 + Array.iter correct_dep paths; paths
... ...
parser/exec.ml
... ... @@ -191,6 +191,8 @@ let conll_parse_sentence timeout test_only_flag id paths tokens =
191 191 let result = {empty_conll_parse_result with id=id} in
192 192 let time2 = time_fun () in
193 193 try
  194 + let paths = TreeChange.remove_interps paths tokens in
  195 + let paths = TreeChange.move_comp paths tokens in
194 196 let dep_chart = LCGlexicon.dep_create paths tokens in
195 197 let dep_chart,references = LCGchart.dep_lazify dep_chart in
196 198 let result = if test_only_flag then result else {result with dep_chart=dep_chart} in
... ...
parser/makefile
... ... @@ -13,7 +13,7 @@ LCG= LCGtypes.ml LCGstringOf.ml LCGrules.ml LCGrenderer.ml LCGchart.ml LCGlatexO
13 13 DISAMB= disambSelPref.ml disambLemma.ml
14 14 SEM= semGraph.ml semTypes.ml semStringOf.ml semLatexOf.ml semMmlOf.ml semMrl.ml
15 15 #SEM= semGraph.ml semTypes.ml semStringOf.ml semMmlOf.ml semMrl.ml
16   -EXEC= execTypes.ml visualization.ml exec.ml ../diagnostics/LCGfields.ml
  16 +EXEC= execTypes.ml visualization.ml ../diagnostics/treeChange.ml exec.ml ../diagnostics/LCGfields.ml ../diagnostics/compTrees.ml
17 17  
18 18 all:
19 19 $(OCAMLOPT) -o pipe $(OCAMLOPTFLAGS) $(PRE) $(LCG) $(DISAMB) $(SEM) $(EXEC) pipe.ml
... ...
parser/pipe.ml
... ... @@ -201,6 +201,7 @@ let process_conll_corpus filename =
201 201 printf "pre_text:\n%s\n" (Visualization.string_of_text result.pre_text); *)
202 202 (* Exec.print_result stdout result; *)
203 203 LCGfields.print_fields ["arole"] result.parsed_text;
  204 + (* CompTrees.compare_results result.parsed_text; *)
204 205 (* Visualization.print_paths "results/" "paths" result.paths; *)
205 206 ());
206 207 Marshal.to_channel oc (PreTypes.RawText "") [];
... ...