grew_fs.mli 1.82 KB
Newer Older
bguillaum's avatar
bguillaum committed
1 2
open Grew_utils
open Grew_ast
pj2m's avatar
pj2m committed
3

4 5 6 7
module Domain: sig
  val reset: unit -> unit

  val init: Ast.domain -> unit
pj2m's avatar
pj2m committed
8 9
end

10 11
(* [G_fs] define the ferute srtuctures that are used in graphs *)
module G_fs: sig
pj2m's avatar
pj2m committed
12 13
  type t

14 15 16 17 18 19 20 21 22
  val empty: t
  
  (** [set_feat feature_name atom t] adds the feature ([feature_name],[atom]) in [t].
      If [t] already contains a feature named [feature_name], the old value is erased by the new one. *)
  val set_feat: ?loc:Loc.t -> string -> string -> t ->  t

  (** [del_feat feature_name t] remove the feature with name [feature_name] in [t].
      If [t] does not contain such a feature, [t] is returned unchanged. *)
  val del_feat:  string -> t ->  t
bguillaum's avatar
bguillaum committed
23

24 25
  (** [get_atom f t] returns [Some v] if the fs [t] contains the feature (f,v).
      It returns [None] if there is no feature named [f] in [t] *)
bguillaum's avatar
bguillaum committed
26 27
  val get_atom: string -> t -> string option

28 29 30 31 32 33 34
  val to_gr: t -> string
  val to_dot: ?main_feat: string -> t -> string
  val to_dep: ?main_feat: string -> t -> string

  val to_string: t -> string

  val build: Ast.feature list -> t
bguillaum's avatar
bguillaum committed
35

36
  val of_conll: Conll.line -> t
bguillaum's avatar
bguillaum committed
37

38 39 40 41 42 43 44
  (** [unif t1 t2] returns [Some t] if [t] is the unification of two graph feature structures
      [None] is returned if the two feature structures cannot be unified. *)
  val unif: t -> t -> t option
end
  
module P_fs: sig
  type t
bguillaum's avatar
bguillaum committed
45

46 47 48 49 50
  val empty: t
  
  val build: ?pat_vars: string list -> Ast.feature list -> t
  
  val to_string: t -> string
pj2m's avatar
pj2m committed
51

52
  val to_dot: t -> string
pj2m's avatar
pj2m committed
53

54
  exception Fail
pj2m's avatar
pj2m committed
55

56 57 58 59 60 61 62 63
  (** [match_ ?param t gfs] tries to match the pattern fs [pfs] with the graph fs [gfs] 
      If [param] is [None], it returns [None] if matching succeeds and else raise [Fail].
      If [param] is [Some p], it returns [Some p'] if matching succeeds and else raise [Fail].
   *) 
  val match_: ?param:Lex_par.t -> t -> G_fs.t -> Lex_par.t option

  val filter: t -> G_fs.t -> bool
end