Attention une mise à jour du serveur va être effectuée le vendredi 16 avril entre 12h et 12h30. Cette mise à jour va générer une interruption du service de quelques minutes.

Commit befa6bb9 authored by bguillaum's avatar bguillaum

Add modules structure to libgrew

git-svn-id: svn+ssh://scm.gforge.inria.fr/svn/semagramme/libcaml-grew/trunk@8839 7838e531-6607-4d57-9587-6c381814729c
parent d747112c
This diff is collapsed.
......@@ -8,189 +8,185 @@
(* Authors: see AUTHORS file *)
(**********************************************************************************)
(** {2 Grew's core} *)
open Libgrew_types
open Grew_base
open Grew_types
open Grew_graph
open Grew_rule
open Grew_grs
(* -------------------------------------------------------------------------------- *)
(* ==================================================================================================== *)
(** {2 Location} *)
type loc
val line_of_loc: loc -> int
val string_of_loc: loc -> string
(* -------------------------------------------------------------------------------- *)
(* ==================================================================================================== *)
module Loc : sig
type t = Grew_base.Loc.t
val to_line: t -> int
val to_string: t -> string
end
(* ==================================================================================================== *)
(** {2 Exceptions} *)
(* ==================================================================================================== *)
exception File_dont_exists of string
exception Parsing_err of string * loc option
exception Parsing_err of string * Loc.t option
(** raised when a Gr/Grs structure fails to build *)
exception Build of string * loc option
exception Build of string * Loc.t option
(** raised during rewriting when a command is undefined *)
exception Run of string * loc option
exception Run of string * Loc.t option
exception Bug of string * loc option
exception Bug of string * Loc.t option
(* -------------------------------------------------------------------------------- *)
(* ==================================================================================================== *)
(** {2 Domain} *)
type domain
val load_domain: string -> domain
(* -------------------------------------------------------------------------------- *)
(* ==================================================================================================== *)
module Domain : sig
type t
val load: string -> t
val feature_names: t -> string list option
end
(* ==================================================================================================== *)
(** {2 Patterns} *)
(* ==================================================================================================== *)
module Pattern : sig
type t
(** [load_pattern domain filename] returns the pattern described in the file *)
val load: Domain.t -> string -> t
end
(* ==================================================================================================== *)
(** {2 Matching} *)
(* ==================================================================================================== *)
module Matching: sig
type t
end
(* ==================================================================================================== *)
(** {2 Deco} *)
(* ==================================================================================================== *)
module Deco: sig
type t = Grew_graph.G_deco.t
(** [build pattern matching] returns the deco to be used in the graphical representation.
WARNING: the function supposes that [matching] was find with the given [pattern]! *)
val build: Pattern.t -> Matching.t -> t
end
(* ==================================================================================================== *)
(** {2 Graph} *)
(* ==================================================================================================== *)
module Graph : sig
(** get a graph from a file either in 'gr' or 'conll' format.
File extension should be '.gr' or '.conll'.
@raise Parsing_err if libgrew can't parse the file
@raise File_dont_exists if the file doesn't exists. *)
val load_graph: domain -> string -> graph
type t = Grew_graph.G_graph.t
(** get a graph from a file either in 'gr' or 'conll' format.
File extension should be '.gr' or '.conll'.
@raise Parsing_err if libgrew can't parse the file
@raise File_dont_exists if the file doesn't exists. *)
val load: Domain.t -> string -> t
(** [of_conll filename line_list] *)
val of_conll: domain -> string -> (int * string) list -> graph
(** [of_conll filename line_list] *)
val of_conll: Domain.t -> string -> (int * string) list -> t
val of_brown: domain -> ?sentid:string -> string -> graph
val of_brown: Domain.t -> ?sentid:string -> string -> t
val to_sentence: ?main_feat:string -> graph -> string
val to_sentence: ?main_feat:string -> t -> string
(** [raw_graph instance] returns all graph information with a triple of elementary caml types:
- the meta data
- the list of node (node is a list of feature (feature is string * string))
- the list of edge (src, label, tar) where src and tar refers to the position in the node list
*)
val raw_graph: domain -> graph ->
(string * string) list *
(string * string) list list *
(int * string * int) list
(** [raw_graph instance] returns all graph information with a triple of elementary caml types:
- the meta data
- the list of node (node is a list of feature (feature is string * string))
- the list of edge (src, label, tar) where src and tar refers to the position in the node list
*)
val raw: Domain.t -> t ->
(string * string) list *
(string * string) list list *
(int * string * int) list
val to_dot_graph : domain -> ?main_feat:string -> ?deco:deco -> graph -> string
val to_dot : Domain.t -> ?main_feat:string -> ?deco:Deco.t -> t -> string
val to_dep_graph : domain -> ?filter: string list -> ?main_feat:string -> ?deco:deco -> graph -> string
val to_dep : Domain.t -> ?filter: string list -> ?main_feat:string -> ?deco:Deco.t -> t -> string
val to_gr_graph: domain -> graph -> string
val to_gr: Domain.t -> t -> string
val to_conll_graph: domain -> graph -> string
val to_conll: Domain.t -> t -> string
(** [search_pattern pattern graph] returns the list of the possible matching of [pattern] in [graph] *)
val search_pattern: Domain.t -> Pattern.t -> t -> Matching.t list
end
(* -------------------------------------------------------------------------------- *)
(* ==================================================================================================== *)
(** {2 Graph Rewriting System} *)
type grs
val empty_grs: grs
(* ==================================================================================================== *)
module Grs: sig
(** [load_grs filename] loads a graph rewriting system from [filename]
@raise Parsing_err if libgrew can't parse the file
@raise File_dont_exists if the file doesn't exists *)
val load_grs: string -> grs
type t
val empty: t
(** [get_sequence_names grs] returns the list of sequence names defined in a GRS *)
val get_sequence_names: grs -> string list
(** [load filename] loads a graph rewriting system from [filename]
@raise Parsing_err if libgrew can't parse the file
@raise File_dont_exists if the file doesn't exists *)
val load: string -> t
(** [build_html_doc ?corpus directory grs]
@[corpus] is a flag (default is [false]) for complete html doc with corpus sentence. *)
val build_html_doc: ?corpus:bool -> string -> grs -> unit
(** [get_sequence_names t] returns the list of sequence names defined in a GRS *)
val get_sequence_names: t -> string list
val feature_names: domain -> string list option
(** [build_html_doc ?corpus directory t]
@[corpus] is a flag (default is [false]) for complete html doc with corpus sentence. *)
val build_html_doc: ?corpus:bool -> string -> t -> unit
(* -------------------------------------------------------------------------------- *)
(** {2 rew_display: data for the GUI } *)
(** [display gr grs seq] builds the [rew_display] given by
the rewriting of graph [gr] with the sequence [seq] of [grs].
@param gr the grapth to rewrite
@param grs the graph rewriting system
@param seq the name of the sequence to apply *)
val display: gr:graph -> grs:grs -> seq:string -> rew_display
val get_domain: t -> Domain.t
end
(* -------------------------------------------------------------------------------- *)
(* ==================================================================================================== *)
(** {2 Rewrite history} *)
type rewrite_history
val set_timeout: float option -> unit
(* ==================================================================================================== *)
module Rewrite: sig
type display = Libgrew_types.rew_display
type history
val rewrite: gr:graph -> grs:grs -> seq:string -> rewrite_history
(** [display gr grs seq] builds the [display] (datatype used by the GUI) given by
the rewriting of graph [gr] with the sequence [seq] of [grs].
@param gr the grapth to rewrite
@param grs the graph rewriting system
@param seq the name of the sequence to apply *)
val display: gr:Graph.t -> grs:Grs.t -> seq:string -> display
val is_empty: rewrite_history -> bool
val set_timeout: float option -> unit
val num_sol: rewrite_history -> int
val rewrite: gr:Graph.t -> grs:Grs.t -> seq:string -> history
val write_stat: string -> rewrite_history -> unit
val is_empty: history -> bool
val save_gr: domain -> string -> rewrite_history -> unit
val num_sol: history -> int
val save_conll: domain -> string -> rewrite_history -> unit
val write_stat: string -> history -> unit
(** [save_full_conll base_name rh] saves one conll_file for each normal form defined in [rh].
Output files are named according to [base_name] and a secondary index after "__".
The number of conll file produced is returned. *)
val save_full_conll: domain -> string -> rewrite_history -> int
val save_gr: Domain.t -> string -> history -> unit
val save_det_gr: domain -> string -> rewrite_history -> unit
val save_conll: Domain.t -> string -> history -> unit
val save_det_conll: domain -> ?header:string -> string -> rewrite_history -> unit
(** [save_full_conll base_name rh] saves one conll_file for each normal form defined in [rh].
Output files are named according to [base_name] and a secondary index after "__".
The number of conll file produced is returned. *)
val save_full_conll: Domain.t -> string -> history -> int
val det_dep_string: domain -> rewrite_history -> string option
val save_det_gr: Domain.t -> string -> history -> unit
val conll_dep_string: domain -> ?keep_empty_rh:bool -> rewrite_history -> string option
val save_det_conll: Domain.t -> ?header:string -> string -> history -> unit
val save_index: dirname:string -> base_names: string list -> unit
val det_dep_string: Domain.t -> history -> string option
val write_annot: domain -> title:string -> string -> string -> (string * rewrite_history) list -> unit
val conll_dep_string: Domain.t -> ?keep_empty_rh:bool -> history -> string option
val write_html:
domain ->
?no_init: bool ->
?out_gr: bool ->
?filter: string list ->
?main_feat: string ->
?dot: bool ->
header: string ->
?graph_file: string ->
rewrite_history ->
string ->
unit
val save_index: dirname:string -> base_names: string list -> unit
val error_html:
domain ->
?no_init:bool ->
?main_feat:string ->
?dot: bool ->
header: string ->
string ->
?init:graph ->
string ->
unit
val write_annot: Domain.t -> title:string -> string -> string -> (string * history) list -> unit
val make_index:
title: string ->
grs_file: string ->
html: bool ->
grs: grs ->
seq: string ->
input_dir: string ->
output_dir: string ->
base_names: string list ->
unit
val write_html: Domain.t -> ?no_init: bool -> ?out_gr: bool -> ?filter: string list -> ?main_feat: string -> ?dot: bool -> header: string -> ?graph_file: string -> history -> string -> unit
val html_sentences: title:string -> string -> (bool * string * int * string) list -> unit
(* -------------------------------------------------------------------------------- *)
(** {2 Patterns} *)
val error_html: Domain.t -> ?no_init:bool -> ?main_feat:string -> ?dot: bool -> header: string -> string -> ?init:Graph.t -> string -> unit
(* type and function added for the grep mode of grew *)
type pattern
type matching
val make_index: title: string -> grs_file: string -> html: bool -> grs: Grs.t -> seq: string -> input_dir: string -> output_dir: string -> base_names: string list -> unit
(** [load_pattern filename] returns the pattern described in the file *)
val load_pattern: domain -> string -> pattern
val html_sentences: title:string -> string -> (bool * string * int * string) list -> unit
end
(** [match_in_graph pattern graph] returns the list of the possible matching og [pattern] in [graph] *)
val match_in_graph: domain -> pattern -> graph -> matching list
(** [match_deco pattern matching] returns the deco to be used in the graphical representation.
WARNING: the function supposes that [matching] was find with the given [pattern]! *)
val match_deco: pattern -> matching -> deco
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