Commit a612bbc7 authored by Bruno Guillaume's avatar Bruno Guillaume

put sent_id in meta data in function of_brown

parent 51f5b973
......@@ -429,16 +429,14 @@ module G_graph = struct
let of_brown ?domain ?sentid brown =
let units = Str.split (Str.regexp " ") brown in
let conll_lines = List.mapi
(fun i item -> match Str.full_split re item with
(fun i item -> match Str.full_split re item with
| [Str.Text form; Str.Delim pos; Str.Text lemma] ->
let pos = String.sub pos 1 ((String.length pos)-2) in
let feats = match (i,sentid) with
| (0,Some id) -> [("sentid", id)]
| _ -> [] in
Conll.build_line ~id:(i+1,None) ~form ~lemma ~xpos:pos ~feats ~deps:([(i, "SUC")]) ()
Conll.build_line ~id:(i+1,None) ~form ~lemma ~xpos:pos ~feats:[] ~deps:([(i, "SUC")]) ()
| _ -> Error.build "[Graph.of_brown] Cannot parse Brown item >>>%s<<< (expected \"phon/POS/lemma\") in >>>%s<<<" item brown
) units in
of_conll ?domain { Conll.file=None; meta=[]; lines=conll_lines; multiwords=[] }
let meta = match sentid with Some id -> ["# sent_id = "^id] | None -> [] in
of_conll ?domain { Conll.file=None; meta; lines=conll_lines; multiwords=[] }
(* -------------------------------------------------------------------------------- *)
let of_pst ?domain pst =
......
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