Commit a843ce53 authored by bguillaum's avatar bguillaum
Browse files

improve search for a sequence:

1) search for the sequence with the requested name
2) search for the module with the requested name
3) select the first sequence defined in the GRS file

git-svn-id: svn+ssh:// 7838e531-6607-4d57-9587-6c381814729c
parent 5a43e342
......@@ -263,19 +263,21 @@ module Grs = struct
check grs;
(* compute the list of modules to apply for a requested sentence *)
let modules_of_sequence grs sequence =
let module_names =
let seq = List.find (fun s -> = sequence) grs.sequences in (fun name -> List.find (fun m -> grs.modules) seq.Sequence.def
with Not_found ->
let seq = List.find (fun s -> = sequence) grs.sequences in
with Not_found -> [sequence] in (* a module name can be used as a singleton sequence *)
(fun name ->
try List.find (fun m -> grs.modules
with Not_found -> Log.fcritical "No sequence or module named '%s'" name
let modul = List.find (fun m -> grs.modules in
Log.fwarning "\"%s\" is a module but not a senquence, only this module is used" sequence; [modul]
with Not_found ->
match grs.sequences with
| head::_ ->
Log.fwarning "No sequence and no module named \"%s\", the first sequence \"%s\" is used" sequence; (fun name -> List.find (fun m -> grs.modules) head.Sequence.def
| _ -> "No sequence defined and no module named \"%s\", cannot go on" sequence
let rewrite grs sequence graph =
let instance = Instance.from_graph graph 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