diff --git a/src_ocaml/grewpy.ml b/src_ocaml/grewpy.ml index ebc4a8a65a28ebc0de872f40bba01181451e1317..9a469c250d5e1e158285bea66344d95f891bc163 100644 --- a/src_ocaml/grewpy.ml +++ b/src_ocaml/grewpy.ml @@ -260,6 +260,25 @@ let run_command request = | _ -> json_error "incomplete 'json_grs' command" end + (* ======================= conll_graph ======================= *) + | Some "conll_graph" -> + begin + match json |> member "graph" |> to_string_option with + | Some graph -> + let conll_string = + graph + |> Yojson.Basic.from_string + |> (fun x -> printf "==========================\n%s\n======================\n%!" (Yojson.Basic.pretty_to_string x); x) + |> Conllx.of_json + |> Conllx.to_string ~config in + Yojson.Basic.to_string + (`Assoc [ + ("status", `String "OK"); + ("data", `String conll_string) + ]) + | _ -> json_error "cannot execute `conll_graph' command" + end + (* ======================= dot_graph ======================= *) | Some "dot_to_png" -> begin