Commit dd2d4df3 authored by bguillaum's avatar bguillaum

Fix a bug introduced in 01f7b589 for handling...

Fix a bug introduced in 01f7b589 for handling the feature names ordering

git-svn-id: svn+ssh://scm.gforge.inria.fr/svn/semagramme/libcaml-grew/trunk@9197 7838e531-6607-4d57-9587-6c381814729c
parent 22fa7718
Version 0.40.1 (2017/01/17)
* Fix a bug introduced in 01f7b589e2024d7a86fbf8c52dc48d73b6e318d2 for handling the feature names ordering
Version 0.40.0 (2016/11/10)
* Change strategies syntax: “pick(S)”, “try(S)” and “S!”
* Simplification of exported exceptions: only two exception are raised by libgrew: Error and Bug
......
......@@ -37,7 +37,7 @@ module G_feature = struct
let get_name = fst
let compare feat1 feat2 = Pervasives.compare (String.lowercase_ascii (get_name feat1)) (String.lowercase_ascii (get_name feat2))
let compare feat1 feat2 = Pervasives.compare (get_name feat1) (get_name feat2)
(* another order used for printing purpose only *)
let print_order = ["phon"; "cat"; "lemma"; "pos"]
......@@ -346,12 +346,18 @@ module G_fs = struct
let reduced_t = match exclude with
| None -> t
| Some list -> List.filter (fun (fn,_) -> not (List.mem fn list || fn.[0]='_')) t in
let ud_ordering = (* In UD CoNLL-U format, features are sorted wrt lowercase form *)
List.sort
(fun feat1 feat2 -> Pervasives.compare (String.lowercase_ascii (G_feature.get_name feat1)) (String.lowercase_ascii (G_feature.get_name feat2)))
reduced_t in
match reduced_t with
| [] -> "_"
| _ -> String.concat "|"
(List.map
(function (fn, String "true") -> fn | (fn, fv) -> (decode_feat_name fn)^"="^(string_of_value fv))
reduced_t
(function
| (fn, String "true") -> fn
| (fn, fv) -> (decode_feat_name fn)^"="^(string_of_value fv))
ud_ordering
)
end (* module G_fs *)
......
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