Commit 49964a3b authored by bguillaum's avatar bguillaum

handling of extra-fs given in column 10 in UD conll

git-svn-id: svn+ssh://scm.gforge.inria.fr/svn/semagramme/libcaml-grew/trunk@9135 7838e531-6607-4d57-9587-6c381814729c
parent 04e0864d
......@@ -945,7 +945,7 @@ module G_graph = struct
) gov_labs in
let (govs,labs) = List.split sorted_gov_labs in
let fs = G_node.get_fs node in
bprintf buff "%g\t%s\t%s\t%s\t%s\t%s\t%s\t%s\t_\t_\n"
bprintf buff "%g\t%s\t%s\t%s\t%s\t%s\t%s\t%s\t_\t%s\n"
(get_num gid)
(match G_fs.get_string_atom "phon" fs with Some p -> p | None -> "_")
(match G_fs.get_string_atom "lemma" fs with Some p -> p | None -> "_")
......@@ -954,6 +954,7 @@ module G_graph = struct
(G_fs.to_conll ~exclude: ["phon"; "lemma"; "cat"; "pos"; "position"] fs)
(match govs with [] -> "_" | _ -> String.concat "|" govs)
(match labs with [] -> "_" | _ -> String.concat "|" labs)
(G_node.string_efs node)
)
snodes;
Buffer.contents buff
......
......@@ -28,6 +28,7 @@ module G_node = struct
prec: Gid.t option;
position: float;
conll_root: bool;
efs: (string * string) list;
}
let get_fs t = t.fs
......@@ -52,7 +53,7 @@ module G_node = struct
| Some n -> n
| None -> sprintf "_%s_" (Gid.to_string gid)
let empty = { name=None; fs = G_fs.empty; next = Massoc_gid.empty; succ = None; prec = None; position = -1.; conll_root=false }
let empty = { name=None; fs = G_fs.empty; next = Massoc_gid.empty; succ = None; prec = None; position = -1.; conll_root=false; efs=[] }
let is_conll_root t = t.conll_root
......@@ -68,6 +69,10 @@ module G_node = struct
| Some l -> Some {t with next = l}
| None -> None
let string_efs n = match n.efs with
| [] -> "_"
| list -> String.concat "|" (List.map (fun (f,v) -> sprintf "%s=%s" f v) list)
let get_annot_info t = G_fs.get_annot_info t.fs
let build ?domain ?prec ?succ position (ast_node, loc) =
......@@ -77,7 +82,7 @@ module G_node = struct
let of_conll ?loc ?prec ?succ ?domain line =
if line = Conll.root
then { empty with conll_root=true; succ}
else { empty with fs = G_fs.of_conll ?loc ?domain line; position = float line.Conll.id; prec; succ }
else { empty with fs = G_fs.of_conll ?loc ?domain line; position = float line.Conll.id; prec; succ; efs=line.Conll.efs }
let pst_leaf ?loc ?domain phon position =
{ empty with fs = G_fs.pst_leaf ?loc ?domain phon; position = float position }
......
......@@ -43,6 +43,7 @@ module G_node: sig
val get_name: Gid.t -> t -> string
val string_efs: t -> string
val is_conll_root: t -> bool
val remove: Gid.t -> G_edge.t -> t -> t
......
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