dispatcher.mli 2.38 KB
Newer Older
huet's avatar
huet committed
1 2 3 4 5 6
(**************************************************************************)
(*                                                                        *)
(*                     The Sanskrit Heritage Platform                     *)
(*                                                                        *)
(*                              Gérard Huet                               *)
(*                                                                        *)
7
(* ©2018 Institut National de Recherche en Informatique et en Automatique *)
huet's avatar
huet committed
8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55
(**************************************************************************)

(* Dispatcher: Sanskrit Engine in 55 phases automaton (plus 2 fake ones) *)

(* The Dispatch functor maps a transducer vector of 39 aums into     *)
(*  - a dispatch automaton implementing a regular description over   *)
(*    45 phases of lexical analysis                                  *)
(*  - an initial vector of initial resumptions                       *)
(*  - a final test for lexical acceptance                            *)
(*  - a consistency check of the output of the segmenting transducer *)

(* Dispatch, instantiated by Transducers, is used as parameter of the 
   Segment functor from Segmenter or Interface.   *)

open Auto.Auto; 
open Load_transducers; (* [transducer_vect] *)
open Morphology; (* [inflexion_tag Verb_form pada_tag morphology] *)
open Phases.Phases; (* phase etc. *)

module Dispatch : functor 
  (Trans: sig value transducers : transducer_vect; 
              value roots_usage : Deco.deco string; end) -> functor
  (Lem: sig value morpho : morphology; end) -> sig

value transducer : phase -> auto  
; 
value initial: bool -> phases 
;
value dispatch: bool -> Word.word -> phase -> phases 
;
value accepting: phase -> bool 
;
type input = Word.word (* input sentence represented as a word *) 
and transition = (* Reflexive relation *) 
    [ Euphony of rule (* [(w,rev u,v)] such that [u|v -> w] *)
    | Id              (* identity or no sandhi *)
    ]
and segment = (phase * Word.word * transition)
and output = list segment;

value valid_morpho : 
  bool -> string -> Word.word -> Morphology.inflexion_tag -> bool
;
value trim_tags : 
  bool -> Word.word -> string -> Morphology.multitag -> Morphology.multitag 
;
value validate : output -> output (* consistency check and glueing *) 
;
56 57 58 59
value terminal_sa : output -> bool
;
value color_of_phase : phase -> Html.color
;  
huet's avatar
huet committed
60 61
end;