Commit 35895eda authored by Bruno Guillaume's avatar Bruno Guillaume
Browse files

update code for new containers (3.6)

parent 41b1016b
......@@ -183,7 +183,7 @@ module Corpus = struct
let items = List.mapi (fun i line -> {
sent_id= sprintf "%05d" (i + 1);
text= "__No_text__";
graph= G_graph.of_brown config line;
graph= G_graph.of_brown ~config line;
}) lines |> Array.of_list in
{ items; kind=Conll }
| ext -> Error.run "Cannot load file `%s`, unknown extension `%s`" file ext
......@@ -319,7 +319,7 @@ module Corpus_desc = struct
with Type_error _ -> Error.run "[Corpus.load_json, file \"%s\"] \"config\" field must be a string" json_file in
let columns =
try json |> member "columns" |> to_string_option |> (CCOpt.map Conllx_columns.build)
try json |> member "columns" |> to_string_option |> (CCOption.map Conllx_columns.build)
with Type_error _ -> Error.run "[Corpus.load_json, file \"%s\"] \"columns\" field must be a string" json_file in
let directory =
......
......@@ -1398,7 +1398,7 @@ module G_graph = struct
let layers = Gid_map.fold
(fun id node acc ->
let layer_opt = G_fs.get_value_opt "layer" (G_node.get_fs node) |> CCOpt.map string_of_value in
let layer_opt = G_fs.get_value_opt "layer" (G_node.get_fs node) |> CCOption.map string_of_value in
let prev = match Layers.find_opt layer_opt acc with
| None -> []
| Some l -> l in
......@@ -1408,7 +1408,7 @@ module G_graph = struct
(* nodes *)
Layers.iter
(fun layer_opt node_list ->
CCOpt.iter (fun l -> bprintf buff " subgraph cluster_%s {\n" l) layer_opt;
CCOption.iter (fun l -> bprintf buff " subgraph cluster_%s {\n" l) layer_opt;
List.iter (
fun (id,node) ->
let decorated_feat =
......@@ -1422,7 +1422,7 @@ module G_graph = struct
(Gid.to_string id)
s
) node_list;
CCOpt.iter (fun _ -> bprintf buff " }\n") layer_opt
CCOption.iter (fun _ -> bprintf buff " }\n") layer_opt
) layers;
(* edges *)
......@@ -1713,7 +1713,7 @@ module Delta = struct
| ((g,f),_)::tail (* when (g,f)=(gid,feat_name) *) -> ((g,f), new_val_opt) :: tail in
{ t with feats = loop t.feats }
let unorder gid t = { t with ordered_nodes = CCList.remove (=) gid t.ordered_nodes }
let unorder gid t = { t with ordered_nodes = CCList.remove ~eq:(=) ~key:gid t.ordered_nodes }
let insert_after inserted_gid site_gid t =
let rec loop = function
......
......@@ -9,7 +9,7 @@
(**********************************************************************************)
open Printf
open CCOpt.Infix
open CCOption.Infix
open Grew_base
open Grew_types
......@@ -123,14 +123,14 @@ module G_node = struct
let shift user_id delta t =
{ t with
name = CCOpt.map (fun n -> user_id ^ "_" ^ n) t.name;
name = CCOption.map (fun n -> user_id ^ "_" ^ n) t.name;
fs = G_fs.set_atom "user" user_id t.fs;
next = Massoc_gid.map_key ((+) delta) t.next;
}
let unshift user_id t =
match (
CCOpt.map (fun x -> CCString.chop_prefix ~pre:(user_id^"_") x) t.name,
CCOption.map (fun x -> CCString.chop_prefix ~pre:(user_id^"_") x) t.name,
G_fs.del_feat_opt "user" t.fs
) with
| (Some name, Some fs) -> { t with name; fs }
......
......@@ -7,7 +7,7 @@
(* License: CeCILL (see LICENSE folder or "http://cecill.info/") *)
(* Authors: see AUTHORS file *)
(**********************************************************************************)
open CCOpt.Infix
open CCOption.Infix
open Log
open Printf
......@@ -368,7 +368,7 @@ module Matching = struct
let gid = Pid_map.find pid matching.n_match in
let node = G_graph.find gid graph in
let fs = G_node.get_fs node in
CCOpt.map string_of_value (G_fs.get_value_opt feature_name fs)
CCOption.map string_of_value (G_fs.get_value_opt feature_name fs)
end
end
| _ -> Error.run "[Matching.get_string_value_opt] unable to handled request %s" request
......
......@@ -121,7 +121,7 @@ module Lexicon = struct
let items = Str.split (Str.regexp "\t") norm_line in
if List.length items <> l then
begin
let loc = CCOpt.map (Loc.set_line linenum) loc in
let loc = CCOption.map (Loc.set_line linenum) loc in
Error.build ?loc "[Lexicon.of_ast] line with %d items (%d expected!!)" (List.length items) l
end;
items :: (loop tail) in
......@@ -133,7 +133,7 @@ module Lexicon = struct
| [] -> Error.bug ?loc "[Lexicon.of_ast] inconsistent data"
| header :: lines_list -> { header; lines = List.fold_right Line_set.add lines_list Line_set.empty; loc }
with Equal v ->
let loc = CCOpt.map (Loc.set_line linenum_h) loc in
let loc = CCOption.map (Loc.set_line linenum_h) loc in
Error.build ?loc "[Lexicon.of_ast] the field name \"%s\" is used twice" v
let load ?loc file =
......
Supports Markdown
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