Commit 7766145f authored by Bruno Guillaume's avatar Bruno Guillaume

Change cast function

parent 026a168b
......@@ -990,9 +990,10 @@ module G_graph = struct
bprintf buff "}\n";
Buffer.contents buff
let cast new_domain graph = match graph.domain with
| Some dom when dom == new_domain -> (* ====== NO CAST NEEDED ====== *) graph
| _ -> (* ====== CASTING NEEDED ====== *) of_conll ~domain:new_domain (to_conll graph)
let cast ?domain graph = match (domain, graph.domain) with
| (None, _) -> graph
| (Some new_domain, Some dom) when dom == new_domain -> (* ====== NO CAST NEEDED ====== *) graph
| _ -> (* ====== CASTING NEEDED ====== *) of_conll ?domain (to_conll graph)
end (* module G_graph *)
......
......@@ -193,7 +193,7 @@ module G_graph: sig
val to_conll: t -> Conll.t
val to_conll_string: t -> string
val cast: Domain.t -> t -> t
val cast: ?domain:Domain.t -> t -> t
end (* module G_graph *)
module Delta : sig
......
......@@ -1146,9 +1146,7 @@ module Grs = struct
let gwh_simple_rewrite grs strat graph =
let domain = domain grs in
let casted_graph = match domain with
| None -> graph
| Some dom -> G_graph.cast dom graph in
let casted_graph = G_graph.cast ?domain graph in
let gwh = Graph_with_history.from_graph casted_graph in
let set = gwh_strat_simple_rewrite ?domain (top grs) (Parser.strategy strat) gwh in
List.map
......@@ -1262,9 +1260,7 @@ module Grs = struct
let wrd_rewrite grs strat graph =
let domain = domain grs in
let casted_graph = match domain with
| None -> graph
| Some dom -> G_graph.cast dom graph in
let casted_graph = G_graph.cast ?domain graph in
match wrd_strat_simple_rewrite ?domain false (top grs) (Parser.strategy strat) {graph=casted_graph; steps=[]} with
| None -> Libgrew_types.Leaf graph
| Some linear_rd -> build_rew_display_from_linear_rd linear_rd
......
......@@ -1159,6 +1159,7 @@ module Rule = struct
(* ---------------------------------------------------------------------- *)
let match_in_graph ?domain ?param (pos, negs) graph =
let casted_graph = G_graph.cast ?domain graph in
let pos_graph = pos.graph in
(* get the list of partial matching for positive part of the pattern *)
......@@ -1166,7 +1167,7 @@ module Rule = struct
extend_matching
?domain
(pos_graph,P_graph.empty)
graph
casted_graph
(init param pos) in
let filtered_matching_list =
......
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