Commit 1a7e5282 authored by Bruno Guillaume's avatar Bruno Guillaume

Clean unused code

parent b4be27ed
This diff is collapsed.
......@@ -49,64 +49,18 @@ module Rewrite_history: sig
val conll_dep_string: ?keep_empty_rh:bool -> t -> string option
end (* module Rewrite_history *)
(* ================================================================================ *)
module Modul: sig
type t = {
name: string;
rules: Rule.t list;
deterministic: bool;
loc: Loc.t;
}
val to_json: ?domain:Domain.t -> t -> Yojson.Basic.json
end (* module Modul *)
(* ================================================================================ *)
module Old_grs: sig
type t
val empty: t
val get_modules: t -> Modul.t list
val get_ast: t -> Ast.grs
val get_domain: t -> Domain.t option
val get_filename: t -> string
val sequence_names: t -> string list
val domain_build: Ast.domain -> Domain.t
(** [build filename] returns the GRS defined in the file [filename] *)
val build: string -> t
val rewrite: t -> string -> G_graph.t -> Rewrite_history.t
val simple_rewrite: t -> string -> G_graph.t -> G_graph.t list
(* only external structure is returned, each edge contains a "dummy" big_step *)
val build_rew_display: t -> string -> G_graph.t -> Libgrew_types.rew_display
val rule_iter: (string -> Rule.t -> unit) -> t -> unit
(* val modules_of_sequence: t -> string -> Modul.t list*)
val to_json: t -> Yojson.Basic.json
end (* module Grs *)
module Grs : sig
type t
val load: string -> t
val load_old: string -> t
val dump: t -> unit
val to_json: t -> Yojson.Basic.json
val domain: t -> Domain.t option
val domain_build: Ast.domain -> Domain.t
val simple_rewrite: t -> string -> G_graph.t -> G_graph.t list
val det_rew_display: t -> string -> G_graph.t -> Libgrew_types.rew_display
......
......@@ -64,7 +64,7 @@ module Domain = struct
Libgrew.handle ~name:"Domain.load"
(fun () ->
let ast = Grew_loader.Loader.domain filename in
Grew_grs.Old_grs.domain_build ast
Grew_grs.Grs.domain_build ast
) ()
let feature_names domain =
......@@ -238,35 +238,6 @@ module Graph = struct
) ()
end
(* ==================================================================================================== *)
(** {2 Graph Rewriting System} *)
(* ==================================================================================================== *)
module Old_grs = struct
type t = Grew_grs.Old_grs.t
let empty = Grew_grs.Old_grs.empty
let load file =
Libgrew.handle ~name:"Old_grs.load" ~file
(fun () ->
if not (Sys.file_exists file)
then raise (Libgrew.Error ("File_not_found: " ^ file))
else Grew_grs.Old_grs.build file
) ()
let get_sequence_names grs =
Libgrew.handle ~name:"Old_grs.get_sequence_names"
(fun () ->
Grew_grs.Old_grs.sequence_names grs
) ()
let get_domain grs = Grew_grs.Old_grs.get_domain grs
let to_json t =
let json = Grew_grs.Old_grs.to_json t in
Yojson.Basic.pretty_to_string json
end
(* ==================================================================================================== *)
(** {2 New Graph Rewriting System} *)
(* ==================================================================================================== *)
......@@ -279,12 +250,6 @@ module Grs = struct
Grew_grs.Grs.load file
) ()
let load_old file =
Libgrew.handle ~name:"Grs.load" ~file
(fun () ->
Grew_grs.Grs.load_old file
) ()
let dump grs =
Libgrew.handle ~name:"Grs.dump"
(fun () ->
......@@ -315,7 +280,6 @@ end
(* ==================================================================================================== *)
module Rewrite = struct
type display = Libgrew_types.rew_display
type history = Grew_grs.Rewrite_history.t
let size = Libgrew_types.rew_display_size
......@@ -324,23 +288,11 @@ module Rewrite = struct
let set_debug_loop () = Grew_rule.Rule.set_debug_loop ()
let old_old_display ~gr ~grs ~seq =
Libgrew.handle ~name:"Rewrite.old_old_display" (fun () -> Grew_grs.Old_grs.build_rew_display grs seq gr) ()
let old_display ~gr ~grs ~strat =
Libgrew.handle ~name:"Rewrite.old_display" (fun () -> Grew_grs.Grs.det_rew_display grs strat gr) ()
let display ~gr ~grs ~strat =
Libgrew.handle ~name:"Rewrite.display" (fun () -> Grew_grs.Grs.wrd_rewrite grs strat gr) ()
let set_timeout t = Grew_base.Timeout.timeout := t
let rewrite ~gr ~grs ~seq =
Libgrew.handle ~name:"Rewrite.rewrite" (fun () -> Grew_grs.Old_grs.rewrite grs seq gr) ()
let old_simple_rewrite ~gr ~grs ~strat =
Libgrew.handle ~name:"Rewrite.old_simple_rewrite" (fun () -> Grew_grs.Old_grs.simple_rewrite grs strat gr) ()
let simple_rewrite ~gr ~grs ~strat =
Libgrew.handle ~name:"Rewrite.simple_rewrite" (fun () -> Grew_grs.Grs.gwh_simple_rewrite grs strat gr) ()
......@@ -348,38 +300,4 @@ module Rewrite = struct
Libgrew.handle ~name:"Rewrite.at_least_one" (fun () -> Grew_grs.Grs.at_least_one grs strat) ()
let at_most_one ~grs ~strat =
Libgrew.handle ~name:"Rewrite.at_most_one" (fun () -> Grew_grs.Grs.at_most_one grs strat) ()
let is_empty rh =
Libgrew.handle ~name:"Rewrite.is_empty" (fun () -> Grew_grs.Rewrite_history.is_empty rh) ()
let num_sol rh =
Libgrew.handle ~name:"Rewrite.num_sol" (fun () -> Grew_grs.Rewrite_history.num_sol rh) ()
let save_index ~dirname ~base_names =
Libgrew.handle ~name:"Rewrite.save_index" (fun () ->
let out_ch = open_out (Filename.concat dirname "index") in
Array.iter (fun f -> fprintf out_ch "%s\n" f) base_names;
close_out out_ch
) ()
let save_gr base rew_hist =
Libgrew.handle ~name:"Rewrite.save_gr" (fun () -> Grew_grs.Rewrite_history.save_gr base rew_hist) ()
let save_conll base rew_hist =
Libgrew.handle ~name:"Rewrite.save_conll" (fun () -> Grew_grs.Rewrite_history.save_conll base rew_hist) ()
let save_full_conll base rew_hist =
Libgrew.handle ~name:"Rewrite.save_full_conll" (fun () -> Grew_grs.Rewrite_history.save_full_conll base rew_hist) ()
let save_det_gr base rew_hist =
Libgrew.handle ~name:"Rewrite.save_det_gr" (fun () -> Grew_grs.Rewrite_history.save_det_gr base rew_hist) ()
let save_det_conll ?header base rew_hist =
Libgrew.handle ~name:"Rewrite.save_det_conll" (fun () -> Grew_grs.Rewrite_history.save_det_conll ?header base rew_hist) ()
let det_dep_string rew_hist =
Libgrew.handle ~name:"Rewrite.det_dep_string" (fun () -> Grew_grs.Rewrite_history.det_dep_string rew_hist) ()
let conll_dep_string ?keep_empty_rh rew_hist =
Libgrew.handle ~name:"Rewrite.conll_dep_string" (fun () -> Grew_grs.Rewrite_history.conll_dep_string ?keep_empty_rh rew_hist) ()
end
......@@ -113,29 +113,6 @@ module Graph : sig
val node_matching: Pattern.t -> t -> Matching.t -> (string * float) list
end
(* OBSOLETE
(* ==================================================================================================== *)
(** {2 Graph Rewriting System} *)
(* ==================================================================================================== *)
module Old_grs: sig
type t
val empty: t
(** [load filename] loads a graph rewriting system from [filename]
@raise Parsing_err if libgrew can't parse the file
@raise File_not_found if the file doesn't exists *)
val load: string -> t
(** [get_sequence_names t] returns the list of sequence names defined in a GRS *)
val get_sequence_names: t -> string list
val get_domain: t -> Domain.t option
val to_json: t -> string
end
*)
(* ==================================================================================================== *)
(** {2 New Graph Rewriting System} *)
(* ==================================================================================================== *)
......@@ -143,7 +120,6 @@ module Grs : sig
type t
val load: string -> t
val load_old: string -> t
val dump: t -> unit
......@@ -160,7 +136,6 @@ end
module Rewrite: sig
type display = Libgrew_types.rew_display
type history
val size: display -> int
val set_max_depth_det: int -> unit
......@@ -172,7 +147,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 *)
val old_display: gr:Graph.t -> grs:Grs.t -> strat:string -> display
val display: gr:Graph.t -> grs:Grs.t -> strat:string -> display
val at_least_one: grs:Grs.t -> strat:string -> bool
......@@ -182,30 +156,6 @@ module Rewrite: sig
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 save_gr: string -> history -> unit
val save_conll: string -> history -> unit
(** [save_full_conll base_name rh] saves one conll_file for each normal form defined in [rh].
Output files are named according to [base_name] and a secondary index after "__".
The number of conll file produced is returned. *)
val save_full_conll: string -> history -> int
val save_det_gr: string -> history -> unit
val save_index: dirname:string -> base_names: string list -> unit
val save_index: dirname:string -> base_names: string list -> unit
val save_det_conll: ?header:string -> string -> history -> unit
val det_dep_string: history -> string option
val conll_dep_string: ?keep_empty_rh:bool -> history -> string option
val save_index: dirname:string -> base_names: string array -> 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