Mentions légales du service

Skip to content
Snippets Groups Projects
Commit 41ca4292 authored by Bruno Guillaume's avatar Bruno Guillaume
Browse files

version 1.9.2

parent bf68a101
No related branches found
No related tags found
No related merge requests found
1.9.1
1.9.2
......@@ -99,8 +99,8 @@ let run_command request =
| _ -> json_error "fail in 'load_grs' command"
end
(* ======================= corpus_load ======================= *)
| Some "corpus_load" ->
(* ======================= load_corpus ======================= *)
| Some "load_corpus" ->
begin
let directory_opt = json |> member "directory" |> to_string_option in
let files = json |> member "files" |> to_list |> filter_string in
......@@ -205,13 +205,14 @@ let run_command request =
begin
try
let corpus_index = json |> member "corpus_index" |> to_int in
let request = Request.of_json ~config (json |> member "request") in
let clustering_keys =
json
|> member "clustering_keys"
|> to_list
|> List.map (fun x -> Key (to_string x)) in
let request = Request.parse ~config (json |> member "pattern" |> to_string) in
let clustering_keys =
try
json
|> member "clustering_keys"
|> to_list
|> List.map (fun x -> Key (to_string x))
with Yojson.Basic.Util.Type_error _ -> [] in
let corpus = Global.corpus_get corpus_index in
let clustered_solutions =
Corpus.search
......@@ -231,7 +232,7 @@ let run_command request =
(fun string_opt sub acc -> (CCOption.get_or ~default:"__undefined__" string_opt, sub) :: acc)
(fun x -> `Assoc x)
clustered_solutions in
Yojson.Basic.to_string
(`Assoc [
("status", `String "OK");
......@@ -246,12 +247,14 @@ let run_command request =
begin
try
let corpus_index = json |> member "corpus_index" |> to_int in
let request = Request.of_json ~config (json |> member "request") in
let clustering_keys =
json
|> member "clustering_keys"
|> to_list
|> List.map (fun x -> Key (to_string x)) in
let request = Request.parse ~config (json |> member "pattern" |> to_string) in
let clustering_keys =
try
json
|> member "clustering_keys"
|> to_list
|> List.map (fun x -> Key (to_string x))
with Yojson.Basic.Util.Type_error _ -> [] in
let corpus = Global.corpus_get corpus_index in
let clustered_count = Corpus.search ~config 0 (fun _ _ _ acc -> acc + 1) request clustering_keys corpus in
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment