Commit 07406e97 authored by bguillaum's avatar bguillaum
Browse files

version 0.22.1

- fix in dot output
- better error handling in conll parsing

git-svn-id: svn+ssh://scm.gforge.inria.fr/svn/semagramme/libcaml-grew/trunk@8171 7838e531-6607-4d57-9587-6c381814729c
parent d40e5328
VERSION = 0.22.0 VERSION = 0.22.1
INSTALL_DIR_LIB = @OCAMLLIB@ INSTALL_DIR_LIB = @OCAMLLIB@
INSTALL_DIR = @prefix@/bin/ INSTALL_DIR = @prefix@/bin/
......
...@@ -111,7 +111,7 @@ module Label = struct ...@@ -111,7 +111,7 @@ module Label = struct
| Dash -> ["style=dashed"] | Dash -> ["style=dashed"]
| Solid when deco -> ["style=dotted"] | Solid when deco -> ["style=dotted"]
| Solid -> []) in | Solid -> []) in
sprintf "[label=\"%s\", %s}" style.text (String.concat ", " dot_items) sprintf "[label=\"%s\", %s]" style.text (String.concat ", " dot_items)
let from_string ?loc ?(locals=[||]) string = let from_string ?loc ?(locals=[||]) string =
match !full with match !full with
......
...@@ -656,24 +656,25 @@ module Conll = struct ...@@ -656,24 +656,25 @@ module Conll = struct
let underscore s = if s = "" then "_" else s let underscore s = if s = "" then "_" else s
let parse_line file_name (line_num, line) = let parse_line file_name (line_num, line) =
try match Str.split (Str.regexp "\t") line with
match Str.split (Str.regexp "\t") line with | [ num; phon; lemma; pos1; pos2; morph; govs; dep_labs; _; _ ] ->
| [ num; phon; lemma; pos1; pos2; morph; govs; dep_labs; _; _ ] -> begin
let gov_list = if govs = "_" then [] else Str.split (Str.regexp "|") govs try
and lab_list = if dep_labs = "_" then [] else Str.split (Str.regexp "|") dep_labs in let gov_list = if govs = "_" then [] else Str.split (Str.regexp "|") govs
let deps = List.combine gov_list lab_list in and lab_list = if dep_labs = "_" then [] else Str.split (Str.regexp "|") dep_labs in
{line_num = line_num; let deps = List.combine gov_list lab_list in
num = num; {line_num = line_num;
phon = underscore phon; num = num;
lemma = underscore lemma; phon = underscore phon;
pos1 = underscore pos1; lemma = underscore lemma;
pos2 = underscore pos2; pos1 = underscore pos1;
morph = parse_morph file_name line_num morph; pos2 = underscore pos2;
deps = deps; morph = parse_morph file_name line_num morph;
} deps = deps;
| l -> }
Error.build ~loc:(file_name,line_num) "[Conll.load] illegal line, %d fields (10 are expected)\n>>>>>%s<<<<<<" (List.length l) line with exc -> Error.build ~loc:(file_name,line_num) "[Conll.load] illegal line, exc=%s\n>>>>>%s<<<<<<" (Printexc.to_string exc) line
with exc -> Error.build ~loc:(file_name,line_num) "[Conll.load] illegal line, exc=%s\n>>>>>%s<<<<<<" (Printexc.to_string exc) line end
| l -> Error.build ~loc:(file_name,line_num) "[Conll.load] illegal line, %d fields (10 are expected)\n>>>>>%s<<<<<<" (List.length l) line
let load file_name = let load file_name =
let lines = File.read_ln file_name in let lines = File.read_ln file_name in
......
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