libgrew_.mli 3.06 KB
Newer Older
1

pj2m's avatar
pj2m committed
2 3

(** {2 Grew's core} *)
bguillaum's avatar
bguillaum committed
4 5 6 7
open Grew_utils
open Grew_graph
open Grew_rule
open Grew_grs
pj2m's avatar
pj2m committed
8 9 10 11 12 13 14 15 16 17

exception Parsing_err of string
exception File_dont_exists of string

(** raised when a Gr/Grs structure fails to build *)
exception Build of string * (string * int) option

(** raised during rewriting when a command is undefined *) 
exception Run of string * (string * int) option

bguillaum's avatar
bguillaum committed
18
exception Bug of string * (string * int) option
pj2m's avatar
pj2m committed
19

bguillaum's avatar
bguillaum committed
20
val set_timeout: float option -> unit
pj2m's avatar
pj2m committed
21

bguillaum's avatar
bguillaum committed
22
val rewrite: gr:Instance.t -> grs:Grs.t -> seq:string -> Rewrite_history.t
bguillaum's avatar
bguillaum committed
23

bguillaum's avatar
bguillaum committed
24
val is_empty: Rewrite_history.t -> bool
bguillaum's avatar
bguillaum committed
25

bguillaum's avatar
bguillaum committed
26 27
val num_sol: Rewrite_history.t -> int

bguillaum's avatar
bguillaum committed
28 29 30 31 32
(** display a gr with a grs in a rew_display 
@param gr the grapth to rewrite
@param grs the graph rewriting system
@param seq the name of the sequence to apply
@return a structure {b {i easily}} displayable *)
bguillaum's avatar
bguillaum committed
33
val display: gr:Instance.t -> grs:Grs.t -> seq:string -> rew_display
bguillaum's avatar
bguillaum committed
34

bguillaum's avatar
bguillaum committed
35
val write_stat: string -> Rewrite_history.t -> unit
bguillaum's avatar
bguillaum committed
36

bguillaum's avatar
bguillaum committed
37
val empty_grs: Grs.t
pj2m's avatar
pj2m committed
38 39 40 41 42 43

(** get a graph rewriting system from a file 
@return a graph rewriting system
@raise Parsing_err if libgrew can't parse the file
@raise File_dont_exists if the file doesn't exists
*)
bguillaum's avatar
bguillaum committed
44
val load_grs : ?doc_output_dir:string -> string -> Grs.t
pj2m's avatar
pj2m committed
45

46 47 48
(** give the list of sequence names defined in a GRS 
@return a string list
*)
bguillaum's avatar
bguillaum committed
49
val get_sequence_names: Grs.t -> string list
50

bguillaum's avatar
bguillaum committed
51
val to_sentence: ?main_feat:string -> Instance.t -> string
pj2m's avatar
pj2m committed
52

53 54
val save_gr: string -> Rewrite_history.t -> unit

bguillaum's avatar
bguillaum committed
55 56
val save_conll: string -> Rewrite_history.t -> unit

57 58
val save_det_gr: string -> Rewrite_history.t -> unit

bguillaum's avatar
bguillaum committed
59 60
val save_det_conll: string -> Rewrite_history.t -> unit

61 62
(** get a graph from a file either in 'gr' or 'conll' format.
File extension should be '.gr' or '.conll'.
pj2m's avatar
pj2m committed
63 64 65
@raise Parsing_err if libgrew can't parse the file
@raise File_dont_exists if the file doesn't exists
*)
66
val load_graph: string -> Instance.t
bguillaum's avatar
bguillaum committed
67

bguillaum's avatar
bguillaum committed
68 69 70 71 72 73 74 75 76 77
(** [raw_graph instance] returns all graph information with a triple of basic 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: Instance.t ->
    (string * string) list *
    (string * string) list list *
    (int * string * int) list

bguillaum's avatar
bguillaum committed
78 79
val save_index: dirname:string -> base_names: string list -> unit

bguillaum's avatar
bguillaum committed
80
val write_html: 
81 82 83 84
    ?no_init: bool ->
    ?out_gr: bool ->
    ?main_feat: string -> 
    ?dot: bool ->
85 86 87
    header: string ->
    graph_file: string ->
    Rewrite_history.t -> string -> unit
pj2m's avatar
pj2m committed
88

89
val error_html: 
90 91 92 93 94 95 96 97
    ?no_init:bool -> 
    ?main_feat:string -> 
    ?dot: bool ->
    header: string -> 
    string -> 
    ?init:Instance.t -> 
    string -> 
    unit
98

bguillaum's avatar
bguillaum committed
99 100 101 102
val make_index: 
    title: string ->
    grs_file: string -> 
    html: bool -> 
bguillaum's avatar
bguillaum committed
103
    grs: Grs.t -> 
bguillaum's avatar
bguillaum committed
104
    seq: string ->
105
    input_dir: string -> 
bguillaum's avatar
bguillaum committed
106 107 108
    output_dir: string -> 
    base_names: string list -> 
      unit
pj2m's avatar
pj2m committed
109

bguillaum's avatar
bguillaum committed
110
val html_sentences: title:string -> string -> (bool * string * int * string) list -> unit
bguillaum's avatar
bguillaum committed
111

pj2m's avatar
pj2m committed
112
val get_css_file: string
bguillaum's avatar
bguillaum committed
113 114

val graph_of_instance: Instance.t -> G_graph.t
115 116

val feature_names: unit -> string list option