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); *)