Commit 88095ac7 authored by Bruno Guillaume's avatar Bruno Guillaume

add graph casting

parent 56a459cb
......@@ -991,6 +991,9 @@ 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)
end (* module G_graph *)
......
......@@ -195,6 +195,8 @@ module G_graph: sig
val to_dep: ?filter: (string -> bool) -> ?main_feat:string -> ?deco:G_deco.t -> t -> string
val to_conll: t -> Conll.t
val to_conll_string: t -> string
val cast: Domain.t -> t -> t
end (* module G_graph *)
module Delta : sig
......
......@@ -1138,7 +1138,10 @@ module Grs = struct
let gwh_simple_rewrite grs strat graph =
let domain = domain grs in
let gwh = Graph_with_history.from_graph graph in
let casted_graph = match domain with
| None -> graph
| Some dom -> G_graph.cast dom 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
(fun gwh -> gwh.Graph_with_history.graph)
......
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