Commit 4b97e9bb authored by Bruno Guillaume's avatar Bruno Guillaume

version 0.16.1:

  * remove all code refering to Dep2pict
parent 7de084c8
## 0.46.1 (2017/12/14)
* remove all code refering to Dep2pict
# 0.46.0 (2017/12/14)
* Remove GUI (now available in a different opam package `grew_gui`)
* New command line parsing of arguments, see `grew help`
......
true: package(yojson, containers, str, ANSITerminal, camomile, cairo2, log, svg, conll, dep2pict)
true: package(yojson, containers, str, ANSITerminal, log, conll)
true: bin_annot
\ No newline at end of file
......@@ -22,7 +22,6 @@ module Grew_args = struct
let old_grs = ref false
let (input_data : string option ref) = ref None
let (output_dir : string option ref) = ref None
let (output_file : string option ref) = ref None
let strat = ref "main"
let quiet = ref false
......
......@@ -13,7 +13,6 @@ open Log
open Conll
open Libgrew
open Dep2pict
open Grew_utils
open Grew_args
......@@ -90,46 +89,14 @@ let transform () =
(* get the array of graphs to explore *)
let graph_array = Corpus.get_graphs ?domain data_file in
match !Grew_args.output_dir with
| None ->
Array.iter
(fun (name,graph) ->
let matchings = Graph.search_pattern ?domain pattern graph in
List.iter
(fun matching ->
let node_matching = Graph.node_matching pattern graph matching in
let graph_node_id = List.assoc node_id node_matching in
printf "%s\t%g\n" name graph_node_id
) matchings
) graph_array
| Some dir ->
if Sys.file_exists dir && not (Sys.is_directory dir)
then (Log.fmessage "\"%s\" is a file" dir; exit 1);
if not (Sys.file_exists dir) then Unix.mkdir dir 0o755;
let buff = Buffer.create 32 in
Array.iter
(fun (name,graph) ->
let matchings = Graph.search_pattern ?domain pattern graph in
List.iter
(fun matching ->
let node_matching = Graph.node_matching pattern graph matching in
let graph_node_id = List.assoc node_id node_matching in
let filename = Filename.concat dir (sprintf "%s__%g.svg" name graph_node_id) in
if Sys.file_exists filename
then (Log.message "Try to erase a previous file"; exit 1)
else
begin
let deco = Deco.build pattern matching in
let dep = Graph.to_dep ?domain ~deco graph in
let _ = Dep2pict.save_svg ~filename (Dep2pict.from_dep ~dep) in
let shift = Dep2pict.highlight_shift () in
bprintf buff "%s@%f\n" (Filename.basename filename) (match shift with None -> 0. | Some v -> v)
end
) matchings
) graph_array;
let out_ch = open_out (Filename.concat dir "list") in
fprintf out_ch "%s" (Buffer.contents buff);
close_out out_ch
Array.iter
(fun (name,graph) ->
let matchings = Graph.search_pattern ?domain pattern graph in
List.iter
(fun matching ->
let node_matching = Graph.node_matching pattern graph matching in
let graph_node_id = List.assoc node_id node_matching in
printf "%s\t%g\n" name graph_node_id
) matchings
) graph_array
) ()
......@@ -13,8 +13,6 @@ open Log
open Conll
open Libgrew
open Dep2pict
open Grew_args
(* ================================================================================ *)
......@@ -129,29 +127,6 @@ module Pdf = struct
ignore (Sys.command(sprintf "dot -Tpdf -o %s %s " output_file temp_file_name))
end (* module Pdf *)
(* ================================================================================ *)
module Svg = struct
let dot_to_tmp dot =
let temp_file_name,out_ch = Filename.open_temp_file ~mode:[Open_rdonly;Open_wronly;Open_text] "grew_" ".dot" in
fprintf out_ch "%s" dot;
close_out out_ch;
let svg_file_name = Str.global_replace (Str.regexp ".dot") ".svg" temp_file_name in
ignore (Sys.command(sprintf "dot -Tsvg -o %s %s " svg_file_name temp_file_name));
svg_file_name
let dot_to_file dot output_file =
let temp_file_name,out_ch = Filename.open_temp_file ~mode:[Open_rdonly;Open_wronly;Open_text] "grew_" ".dot" in
fprintf out_ch "%s" dot;
close_out out_ch;
ignore (Sys.command(sprintf "dot -Tsvg -o %s %s " output_file temp_file_name))
let dep_to_tmp dep =
let temp_file_name = Filename.temp_file "grew_" ".svg" in
let d2p = Dep2pict.from_dep ~dep in
let () = Dep2pict.save_svg ~filename:temp_file_name d2p in
temp_file_name
end (* module Svg *)
(* ================================================================================ *)
module Corpus = struct
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment