Commit 301bb358 authored by Bruno Guillaume's avatar Bruno Guillaume
Browse files

add quiet optionnal arg

parent d986d1a9
......@@ -1650,7 +1650,7 @@ module Conllx_corpus = struct
with Conllx_error json ->
begin
match log_file with
| None -> Printf.eprintf "%s\n" (Yojson.Basic.pretty_to_string json)
| None -> raise (Conllx_error json)
| Some f when Sys.file_exists f ->
let out_ch = open_out_gen [Open_append] 0o755 f in
Printf.fprintf out_ch "%s" (Yojson.Basic.pretty_to_string json);
......@@ -1681,13 +1681,13 @@ module Conllx_corpus = struct
{ columns; data=Array.of_list (List.rev !res) }
(* ---------------------------------------------------------------------------------------------------- *)
let load ?(config=Conllx_config.basic) ?log_file ?columns file =
let load ?(config=Conllx_config.basic) ?quiet ?log_file ?columns file =
let lines = CCIO.(with_in file read_lines_l) in
of_lines ~config ?log_file ?columns ~file lines
of_lines ~config ?quiet ?log_file ?columns ~file lines
(* ---------------------------------------------------------------------------------------------------- *)
let load_list ?(config=Conllx_config.basic) ?log_file ?columns file_list =
match List.map (load ~config ?columns ?log_file) file_list with
let load_list ?(config=Conllx_config.basic) ?quiet ?log_file ?columns file_list =
match List.map (load ~config ?quiet ?columns ?log_file) file_list with
| [] -> empty
| ({ columns }::tail) as l ->
if List.for_all (fun {columns=p} -> p = columns) tail
......
......@@ -75,9 +75,9 @@ end
module Conllx_corpus : sig
type t
val load: ?config: Conllx_config.t -> ?log_file: string -> ?columns: Conllx_columns.t -> string -> t
val load: ?config: Conllx_config.t -> ?quiet:bool -> ?log_file: string -> ?columns: Conllx_columns.t -> string -> t
val load_list: ?config: Conllx_config.t -> ?log_file: string -> ?columns: Conllx_columns.t -> string list -> t
val load_list: ?config: Conllx_config.t -> ?quiet:bool -> ?log_file: string -> ?columns: Conllx_columns.t -> string list -> t
val of_lines: ?config: Conllx_config.t -> ?quiet:bool -> ?log_file: string -> ?columns: Conllx_columns.t -> ?file: string -> string list -> t
......
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