CONLL_adapter.ml
3.06 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
let convert_dep_tree id first_try paths tokens lex_sems =
let do_if cond f paths = if cond then f paths tokens else paths in
let paths = Array.copy paths in
let paths = do_if first_try TreeChange.replace_tokens paths in
let paths = do_if first_try (TreeChange.remove_interps ".") paths in
let paths = do_if first_try TreeChange.replace_hyphens paths in
let paths = do_if first_try TreeChange.correct_coordination1 paths in
let paths = do_if first_try TreeChange.correct_interp_with_father_0 paths in
let paths = do_if first_try TreeChange.correct_coordination2 paths in
let paths = do_if first_try (TreeChange.remove_interps ",") paths in
let paths = do_if first_try TreeChange.correct_passive_voice paths in
let paths = do_if first_try TreeChange.praet_qub_aglt paths in
let paths = do_if (not first_try) TreeChange.swap_dep paths in
File.file_out ("results/" ^ id ^ "/pre_text_modified_" ^ (string_of_bool first_try) ^ ".html") (fun file ->
fprintf file "%s\n" Visualization.html_header;
fprintf file "%s\n" (Visualization.html_of_dep_sentence tokens paths);
fprintf file "%s\n" Visualization.html_trailer);
(* let paths = do_if first_try TreeChange.replace_tokens paths in
let paths = do_if first_try TreeChange.replace_hyphens paths in
let paths = do_if first_try (TreeChange.remove_interps ".") paths in
let paths = do_if (not first_try) TreeChange.swap_dep paths in
let paths = do_if first_try TreeChange.correct_coordination1 paths in
let paths = try
do_if first_try TreeChange.correct_coordination2 paths
with
| _ -> (
File.file_out ("results/" ^ id ^ "/pre_text_modified_" ^ (string_of_bool first_try) ^ ".html") (fun file ->
fprintf file "%s\n" Visualization.html_header;
fprintf file "%s\n" (Visualization.html_of_dep_sentence tokens paths);
fprintf file "%s\n" Visualization.html_trailer);
do_if first_try TreeChange.correct_interp_with_father_0 paths;
do_if first_try (TreeChange.remove_interps ",") paths;
File.file_out ("results/" ^ id ^ "/pre_text_modified_" ^ (string_of_bool first_try) ^ "2.html") (fun file ->
fprintf file "%s\n" Visualization.html_header;
fprintf file "%s\n" (Visualization.html_of_dep_sentence tokens paths);
fprintf file "%s\n" Visualization.html_trailer);
do_if first_try TreeChange.correct_coordination2 paths) in
let paths = do_if first_try TreeChange.praet_qub_aglt paths in
let paths = do_if first_try TreeChange.correct_interp_with_father_0 paths in
let paths = do_if first_try (TreeChange.remove_interps ",") paths in
let paths = do_if first_try (TreeChange.remove_interps "-") paths in
let paths = do_if first_try TreeChange.correct_passive_voice paths in
File.file_out ("results/" ^ id ^ "/pre_text_modified_" ^ (string_of_bool first_try) ^ ".html") (fun file ->
fprintf file "%s\n" Visualization.html_header;
fprintf file "%s\n" (Visualization.html_of_dep_sentence tokens paths);
fprintf file "%s\n" Visualization.html_trailer); *)