Commit 6f112b30 authored by Bruno Guillaume's avatar Bruno Guillaume

remove Dep2pict / Html code

parent f9efdaec
......@@ -41,24 +41,6 @@ module Rewrite_history = struct
| { good_nf = [] } -> 1
| { good_nf = l} -> List.fold_left (fun acc t -> acc + (num_sol t)) 0 l
let save_nfs ?domain ?filter ?main_feat ~dot base_name t =
let rec loop file_name rules t =
match t.good_nf with
| [] when dot -> Instance.save_dot_png ?domain ?filter ?main_feat file_name t.instance; [rules, file_name]
| [] -> ignore (Instance.save_dep_png ?domain ?filter ?main_feat file_name t.instance); [rules, file_name]
| l ->
List_.foldi_left
(fun i acc son ->
(* Instance.save_dep_png ?main_feat (sprintf "%s_%d" file_name i) son.instance; *)
let nfs = loop
(sprintf "%s_%d" file_name i)
(rules @ [t.module_name, son.instance.Instance.rules])
son in
nfs @ acc
)
[] l in
loop base_name [] t
let save_gr ?domain base t =
let rec loop file_name t =
match t.good_nf with
......
......@@ -29,19 +29,6 @@ module Rewrite_history: sig
val num_sol: t -> int
(** [save_nfs ?main_feat base_name t] does two things:
- write PNG files of normal forms
- returns a list of couples (rules, file)
*)
val save_nfs:
?domain:Domain.t ->
?filter: string list ->
?main_feat: string ->
dot: bool ->
string ->
t ->
((string * string list) list * string) list
(** [save_gr base_name t] saves one gr_file for each normal form defined in [t].
Output files are named according to [base_name] and the Gorn adress in the rewriting tree. *)
val save_gr: ?domain:Domain.t -> string -> t -> unit
......
This diff is collapsed.
(**********************************************************************************)
(* Libcaml-grew - a Graph Rewriting library dedicated to NLP applications *)
(* *)
(* Copyright 2011-2013 Inria, Université de Lorraine *)
(* *)
(* Webpage: http://grew.loria.fr *)
(* License: CeCILL (see LICENSE folder or "http://www.cecill.info") *)
(* Authors: see AUTHORS file *)
(**********************************************************************************)
open Grew_types
open Grew_domain
open Grew_rule
open Grew_grs
open Grew_graph
(* ================================================================================ *)
module Html_doc : sig
(* dep is a flag which is true iff dep file are shown in doc (iff dep2pict is available) *)
val build: dep:bool -> corpus:bool -> string -> Old_grs.t -> unit
end (* module Html_doc *)
(* ================================================================================ *)
module Html_sentences : sig
val build: title:string -> string -> (bool * string * int * string) list -> unit
end (* module Html_sentences *)
(* ================================================================================ *)
module Html_rh: sig
val build:
?domain:Domain.t ->
?filter: string list ->
?main_feat: string ->
?dot: bool ->
?init_graph:bool ->
?out_gr:bool ->
?header:string ->
?graph_file:string ->
string ->
Rewrite_history.t ->
unit
val error:
?domain: Domain.t ->
?main_feat: string ->
?dot: bool ->
?init_graph:bool ->
?header:string ->
string ->
string ->
G_graph.t option ->
unit
end (* module Html_rh *)
(* ================================================================================ *)
module Gr_stat: sig
type t
val from_rew_history: Rewrite_history.t -> t
val save: string -> t -> unit
val load: string -> t
end (* module Gr_stat *)
(* ================================================================================ *)
module Corpus_stat: sig
type t
val empty: grs:Old_grs.t -> seq:string -> t
val add_gr_stat: string -> Gr_stat.t -> t -> t
val save_html:
title: string ->
grs_file: string ->
input_dir:string ->
output_dir:string ->
t -> unit
end (* module Corpus_stat *)
......@@ -11,8 +11,6 @@
open Log
open Printf
open Dep2pict
open Grew_base
open Grew_types
open Grew_ast
......@@ -59,18 +57,6 @@ module Instance = struct
let save_dot_png ?domain ?filter ?main_feat base t =
ignore (Dot.to_png_file (G_graph.to_dot ?domain ?main_feat t.graph) (base^".png"))
let save_dep_png ?domain ?filter ?main_feat base t =
let dep = G_graph.to_dep ?domain ?filter ?main_feat t.graph in
let d2p = Dep2pict.from_dep ~dep in
let _ = Dep2pict.save_png ~filename: (base^".png") d2p in
Dep2pict.highlight_shift ()
let save_dep_svg ?domain ?filter ?main_feat base t =
let dep = G_graph.to_dep ?domain ?filter ?main_feat t.graph in
let d2p = Dep2pict.from_dep ~dep in
let _ = Dep2pict.save_svg ~filename: (base^".png") d2p in
Dep2pict.highlight_shift ()
end (* module Instance *)
(* ================================================================================ *)
......
......@@ -45,11 +45,6 @@ module Instance : sig
(** [to_conll_string t] returns a string which contains the "conll" code of the current graph *)
val to_conll_string: ?domain:Domain.t -> t -> string
(** [save_dep_png base t] writes a file "base.png" with the dep representation of [t].
NB: if the Dep2pict is not available, nothing is done *)
val save_dep_png: ?domain:Domain.t -> ?filter: string list -> ?main_feat: string -> string -> t -> float option
val save_dep_svg: ?domain:Domain.t -> ?filter: string list -> ?main_feat: string -> string -> t -> float option
(** [save_dot_png base t] writes a file "base.png" with the dot representation of [t] *)
val save_dot_png: ?domain:Domain.t -> ?filter: string list -> ?main_feat: string -> string -> t -> unit
end (* module Instance *)
......
......@@ -251,20 +251,6 @@ module Old_grs = struct
Grew_grs.Old_grs.sequence_names grs
) ()
let build_html_doc ?(corpus=false) dir (grs : Grew_grs.Old_grs.t) =
handle ~name:"Old_grs.build_doc [with Dep2pict]"
(fun () ->
Grew_html.Html_doc.build ~corpus ~dep:true dir grs;
(* draw pattern graphs for all rules *)
let fct module_ rule_ =
let dep_code = Grew_rule.Rule.to_dep ?domain:(Grew_grs.Old_grs.get_domain grs) rule_ in
let dep_png_file = sprintf "%s/%s_%s-patt.png" dir module_ (Grew_rule.Rule.get_name rule_) in
let d2p = Dep2pict.Dep2pict.from_dep ~dep:dep_code in
Dep2pict.Dep2pict.save_png ~filename:dep_png_file d2p in
Grew_grs.Old_grs.rule_iter fct grs
) ()
let get_domain grs = Grew_grs.Old_grs.get_domain grs
let to_json t =
......@@ -357,9 +343,6 @@ module Rewrite = struct
let num_sol rh =
handle ~name:"Rewrite.num_sol" (fun () -> Grew_grs.Rewrite_history.num_sol rh) ()
let write_stat filename rew_hist =
handle ~name:"Rewrite.write_stat" (fun () -> Grew_html.Gr_stat.save filename (Grew_html.Gr_stat.from_rew_history rew_hist)) ()
let save_index ~dirname ~base_names =
handle ~name:"Rewrite.save_index" (fun () ->
let out_ch = open_out (Filename.concat dirname "index") in
......@@ -387,31 +370,4 @@ module Rewrite = struct
let conll_dep_string ?domain ?keep_empty_rh rew_hist =
handle ~name:"Rewrite.conll_dep_string" (fun () -> Grew_grs.Rewrite_history.conll_dep_string ?domain ?keep_empty_rh rew_hist) ()
let write_html ?domain ?(no_init=false) ?(out_gr=false) ?filter ?main_feat ?dot ~header ?graph_file rew_hist output_base =
handle ~name:"Rewrite.write_html" (fun () ->
ignore (
Grew_html.Html_rh.build ?domain ?filter ?main_feat ?dot ~out_gr ~init_graph: (not no_init) ~header ?graph_file output_base rew_hist
)
) ()
let error_html ?domain ?(no_init=false) ?main_feat ?dot ~header msg ?init output_base =
handle ~name:"Rewrite.error_html" (fun () ->
ignore (
Grew_html.Html_rh.error ?domain ?main_feat ?dot ~init_graph: (not no_init) ~header output_base msg init
)
) ()
let make_index ~title ~grs_file ~html ~grs ~seq ~input_dir ~output_dir ~base_names =
handle ~name:"Rewrite.make_index" (fun () ->
let init = Grew_html.Corpus_stat.empty grs seq in
let corpus_stat =
Array.fold_left
(fun acc base_name ->
Grew_html.Corpus_stat.add_gr_stat base_name (Grew_html.Gr_stat.load (Filename.concat output_dir (base_name^".stat"))) acc
) init base_names in
Grew_html.Corpus_stat.save_html title grs_file input_dir output_dir corpus_stat
) ()
let html_sentences ~title = handle ~name:"Rewrite.html_sentences" (fun () -> Grew_html.Html_sentences.build ~title) ()
end
......@@ -122,10 +122,6 @@ module Old_grs: sig
(** [get_sequence_names t] returns the list of sequence names defined in a GRS *)
val get_sequence_names: t -> string list
(** [build_html_doc ?corpus directory t]
@[corpus] is a flag (default is [false]) for complete html doc with corpus sentence. *)
val build_html_doc: ?corpus:bool -> string -> t -> unit
val get_domain: t -> Domain.t option
val to_json: t -> string
......@@ -168,8 +164,6 @@ module Rewrite: sig
@param gr the grapth to rewrite
@param grs the graph rewriting system
@param seq the name of the sequence to apply *)
(* OBSOLETE val old_display: gr:Graph.t -> grs:Old_grs.t -> seq:string -> display *)
val display: gr:Graph.t -> grs:Grs.t -> strat:string -> display
val at_least_one: grs:Grs.t -> strat:string -> bool
......@@ -177,17 +171,12 @@ module Rewrite: sig
val set_timeout: float option -> unit
(* OBSOLETE val rewrite: gr:Graph.t -> grs:Old_grs.t -> seq:string -> history *)
(* OBSOLETE val old_simple_rewrite: gr:Graph.t -> grs:Old_grs.t -> strat:string -> Graph.t list *)
val simple_rewrite: gr:Graph.t -> grs:Grs.t -> strat:string -> Graph.t list
val is_empty: history -> bool
val num_sol: history -> int
val write_stat: string -> history -> unit
val save_gr: ?domain:Domain.t -> string -> history -> unit
val save_conll: ?domain:Domain.t -> string -> history -> unit
......@@ -210,12 +199,4 @@ module Rewrite: sig
val conll_dep_string: ?domain:Domain.t -> ?keep_empty_rh:bool -> history -> string option
val save_index: dirname:string -> base_names: string array -> unit
val write_html: ?domain:Domain.t -> ?no_init: bool -> ?out_gr: bool -> ?filter: string list -> ?main_feat: string -> ?dot: bool -> header: string -> ?graph_file: string -> history -> string -> unit
val error_html: ?domain:Domain.t -> ?no_init:bool -> ?main_feat:string -> ?dot: bool -> header: string -> string -> ?init:Graph.t -> string -> unit
(* OBSOLETE val make_index: title: string -> grs_file: string -> html: bool -> grs: Old_grs.t -> seq: string -> input_dir: string -> output_dir: string -> base_names: string array -> unit *)
val html_sentences: title:string -> string -> (bool * string * int * string) list -> unit
end
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