grew_graph.mli 2.6 KB
Newer Older
bguillaum's avatar
bguillaum committed
1
open Grew_ast
2
open Grew_fs
pj2m's avatar
pj2m committed
3 4
open Grew_edge
open Grew_node
bguillaum's avatar
bguillaum committed
5 6
open Grew_utils
open Grew_command
pj2m's avatar
pj2m committed
7 8 9 10 11 12 13 14 15

module Deco: sig
  type t = 
      { nodes: int list;
	edges: (int * Label.t * int) list;
      }
  val empty:t
end

16 17
module P_graph: sig
  type t = P_node.t Pid_map.t
18

pj2m's avatar
pj2m committed
19
  val empty: t
20 21 22 23 24 25
  val find: Pid.t -> t -> P_node.t

  type extension = {
      ext_map: P_node.t Pid_map.t; (* node description for new nodes and for edge "Old -> New"  *)
      old_map: P_node.t Pid_map.t; (* a partial map for new constraints on old nodes "Old [...]" *) 	
    }
pj2m's avatar
pj2m committed
26 27

  val build:
bguillaum's avatar
bguillaum committed
28
      ?pat_vars: string list ->
pj2m's avatar
pj2m committed
29 30 31
      ?locals: Label.decl array -> 
      Ast.node list -> 
      Ast.edge list -> 
32
	(t * Id.table * (Id.t * P_fs.t) list )
pj2m's avatar
pj2m committed
33

34
  val build_extension:
pj2m's avatar
pj2m committed
35 36 37 38
      ?locals: Label.decl array -> 
      Id.table ->
      Ast.node list -> 
      Ast.edge list -> 
39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54
	(extension * Id.table)

  val roots: t -> Pid.t list

end



module G_graph: sig
  type t = {
      map: G_node.t Gid_map.t; (* node description *)
      lub: int;             (* least upper bound *)
    }


  val empty: t
pj2m's avatar
pj2m committed
55

56 57 58 59 60 61 62
  val find: Gid.t -> t -> G_node.t

  val build:
      ?locals: Label.decl array -> 
      Ast.node list -> 
      Ast.edge list -> 
	t
bguillaum's avatar
bguillaum committed
63

bguillaum's avatar
bguillaum committed
64
  val of_conll: ?loc:Loc.t -> Conll.line list -> t
bguillaum's avatar
bguillaum committed
65

bguillaum's avatar
bguillaum committed
66
  val to_gr: t -> string
67
  val to_dot: ?main_feat:string -> ?deco:Deco.t -> t -> string
68
  val to_sentence: ?main_feat:string -> t -> string
pj2m's avatar
pj2m committed
69 70
  val to_dep: ?main_feat:string -> ?deco:Deco.t -> t -> string

71 72 73 74 75 76 77

  type concat_item =
    | Feat of (Gid.t * string)
    | String of string

  val add_edge: t -> int -> G_edge.t -> int -> t option
  val del_edge : ?edge_ident: string -> Loc.t -> t -> int -> G_edge.t -> int -> t
pj2m's avatar
pj2m committed
78 79
  val del_node : t -> int -> t

80
  val add_neighbour : Loc.t -> t -> int -> G_edge.t -> (int * t) 
pj2m's avatar
pj2m committed
81
  val merge_node : Loc.t -> t -> int -> int -> t option
82 83 84

  val shift_in : Loc.t -> t -> int -> int -> t
  val shift_out : Loc.t -> t -> int -> int -> t
pj2m's avatar
pj2m committed
85 86
  val shift_edges : Loc.t -> t -> int -> int -> t

87 88 89
  (** [update_feat tar_id tar_feat_name concat_items] sets the feature of the node [tar_id] 
      with feature name [tar_feat_name] to be the contatenation of values described by the [concat_items].
      It returns both the new graph and the new feature value produced as the second element *)
90
  val update_feat: ?loc:Loc.t -> t -> int -> string -> concat_item list -> (t * string)
pj2m's avatar
pj2m committed
91

92
  val set_feat: ?loc:Loc.t -> t -> int -> string -> string -> t
bguillaum's avatar
bguillaum committed
93

94
  val del_feat: t -> int -> string -> t
pj2m's avatar
pj2m committed
95

bguillaum's avatar
bguillaum committed
96
  (** [edge_out t id edge] returns true iff there is an out-edge from the node [id] with a label compatible with [edge] *)
97 98 99
  val edge_out: t -> int -> P_edge.t -> bool

  val equals: t -> t -> bool
pj2m's avatar
pj2m committed
100 101 102

end