Commit 7d0951b7 authored by Gérard Huet's avatar Gérard Huet

Morpho_ext becomes Morpho_scl

parent 36d69f4e
This diff is collapsed.
...@@ -49,9 +49,8 @@ checkpoints.ml graph_segmenter.ml automaton.ml interface.mli interface.ml \ ...@@ -49,9 +49,8 @@ checkpoints.ml graph_segmenter.ml automaton.ml interface.mli interface.ml \
user_aid.ml reset_caches.ml user_aid.ml reset_caches.ml
# WEB package - HTML, HTTP, CGI utilities for Web interface # WEB package - HTML, HTTP, CGI utilities for Web interface
WEB=html.ml web.ml css.ml cgi.ml morpho_html.ml chapters.ml \ WEB=html.ml web.ml css.ml cgi.ml morpho_html.ml chapters.ml morpho_scl.ml \
mk_index_page.ml mk_grammar_page.ml mk_reader_page.ml mk_sandhi_page.ml \ mk_index_page.ml mk_grammar_page.ml mk_reader_page.ml mk_sandhi_page.ml
morpho_ext.ml
# extra file SCLpaths.ml for SCL interfacing - not distributed. # extra file SCLpaths.ml for SCL interfacing - not distributed.
# TREE package - tree bank manager and syntax analyser - legacy # TREE package - tree bank manager and syntax analyser - legacy
...@@ -91,10 +90,11 @@ all: engine static_pages reset_caches sandhi_test ...@@ -91,10 +90,11 @@ all: engine static_pages reset_caches sandhi_test
# legacy in need of re-design # legacy in need of re-design
regression: rank.cmx regression.cmx regression: rank.cmx regression.cmx
$(LINK) $(CORENATIVES) unix.cmxa date.cmx control.cmx deco.cmx \ $(LINK) $(CORENATIVES) unix.cmxa date.cmx control.cmx deco.cmx \
lexmap.cmx inflected.cmx html.cmx SCLpaths.cmx web.cmx naming.cmx morpho_string.cmx \ lexmap.cmx inflected.cmx html.cmx SCLpaths.cmx web.cmx naming.cmx \
morpho.cmx load_transducers.cmx pada.cmx phases.cmx dispatcher.cmx chapters.cmx \ morpho_string.cmx morpho.cmx load_transducers.cmx pada.cmx phases.cmx \
morpho_html.cmx bank_lexer.cmx cgi.cmx segmenter.cmx morpho_ext.cmx \ dispatcher.cmx chapters.cmx morpho_html.cmx bank_lexer.cmx cgi.cmx \
load_morphs.cmx lexer.cmx constraints.cmx rank.cmx regression.cmx -o regression segmenter.cmx morpho_scl.cmx load_morphs.cmx lexer.cmx constraints.cmx \
rank.cmx regression.cmx -o regression
obsolete: tagger panini obsolete: tagger panini
...@@ -183,7 +183,7 @@ control.cmx word.cmx canon.cmx zen_lexer.cmx phonetics.cmx transduction.cmx \ ...@@ -183,7 +183,7 @@ control.cmx word.cmx canon.cmx zen_lexer.cmx phonetics.cmx transduction.cmx \
encode.cmx skt_lexer.cmx padapatha.cmx sanskrit.cmx deco.cmx lexmap.cmx \ encode.cmx skt_lexer.cmx padapatha.cmx sanskrit.cmx deco.cmx lexmap.cmx \
inflected.cmx html.cmx SCLpaths.cmx web.cmx naming.cmx morpho_string.cmx morpho.cmx \ inflected.cmx html.cmx SCLpaths.cmx web.cmx naming.cmx morpho_string.cmx morpho.cmx \
load_transducers.cmx pada.cmx phases.cmx dispatcher.cmx order.cmx \ load_transducers.cmx pada.cmx phases.cmx dispatcher.cmx order.cmx \
chapters.cmx morpho_html.cmx cgi.cmx segmenter.cmx morpho_ext.cmx \ chapters.cmx morpho_html.cmx cgi.cmx segmenter.cmx morpho_scl.cmx \
load_morphs.cmx lexer.cmx constraints.cmx rank.cmx bank_lexer.cmx \ load_morphs.cmx lexer.cmx constraints.cmx rank.cmx bank_lexer.cmx \
scl_parser.cmx checkpoints.cmx reader.cmx -o reader scl_parser.cmx checkpoints.cmx reader.cmx -o reader
...@@ -212,17 +212,9 @@ encode.cmx skt_lexer.cmx padapatha.cmx sanskrit.cmx deco.cmx lexmap.cmx \ ...@@ -212,17 +212,9 @@ encode.cmx skt_lexer.cmx padapatha.cmx sanskrit.cmx deco.cmx lexmap.cmx \
inflected.cmx html.cmx SCLpaths.cmx web.cmx naming.cmx morpho_string.cmx morpho.cmx \ inflected.cmx html.cmx SCLpaths.cmx web.cmx naming.cmx morpho_string.cmx morpho.cmx \
load_transducers.cmx pada.cmx phases.cmx dispatcher.cmx order.cmx \ load_transducers.cmx pada.cmx phases.cmx dispatcher.cmx order.cmx \
chapters.cmx morpho_html.cmx bank_lexer.cmx cgi.cmx segmenter.cmx \ chapters.cmx morpho_html.cmx bank_lexer.cmx cgi.cmx segmenter.cmx \
morpho_ext.cmx load_morphs.cmx lexer.cmx constraints.cmx checkpoints.cmx \ morpho_scl.cmx load_morphs.cmx lexer.cmx constraints.cmx checkpoints.cmx \
paraphrase.cmx scl_parser.cmx parser.cmx -o parser paraphrase.cmx scl_parser.cmx parser.cmx -o parser
tagger: tagger.cmx
$(LINK) list2.cmx gen.cmx paths.cmx version.cmx date.cmx install.cmx \
word.cmx canon.cmx zen_lexer.cmx phonetics.cmx transduction.cmx encode.cmx \
skt_lexer.cmx padapatha.cmx sanskrit.cmx deco.cmx lexmap.cmx inflected.cmx \
html.cmx SCLpaths.cmx web.cmx naming.cmx morpho_string.cmx morpho.cmx pada.cmx \
dispatcher.cmx order.cmx chapters.cmx morpho_html.cmx cgi.cmx \
segmenter.cmx morpho_ext.cmx lexer.cmx constraints.cmx tagger.cmx -o tagger
css: css.cmx css: css.cmx
$(LINK) gen.cmx paths.cmx version.cmx date.cmx html.cmx \ $(LINK) gen.cmx paths.cmx version.cmx date.cmx html.cmx \
SCLpaths.cmx web.cmx css.cmx -o css SCLpaths.cmx web.cmx css.cmx -o css
...@@ -314,7 +306,7 @@ Heritage_Platform.pdf: $(ENGINE) ...@@ -314,7 +306,7 @@ Heritage_Platform.pdf: $(ENGINE)
clean: clean:
rm -f *.cmo *.cmi *.cmx *.ppi *.ppo *.o rm -f *.cmo *.cmi *.cmx *.ppi *.ppo *.o
rm -f css indexer indexerd sandhier reader parser tagger lemmatizer \ rm -f css indexer indexerd sandhier reader parser lemmatizer \
declension conjugation mk_index_page mk_grammar_page mk_reader_page regression \ declension conjugation mk_index_page mk_grammar_page mk_reader_page regression \
mk_sandhi_page sandhi_test reset_caches interface user_aid \ mk_sandhi_page sandhi_test reset_caches interface user_aid \
parse_apte tag_apte parse_apte tag_apte
......
...@@ -48,6 +48,7 @@ and td_end = xml_end "td" ...@@ -48,6 +48,7 @@ and td_end = xml_end "td"
and td = xml_empty_with_att "td" and td = xml_empty_with_att "td"
; ;
value td_wrap text = td_begin ^ text ^ td_end value td_wrap text = td_begin ^ text ^ td_end
and cell item = tr_begin ^ th_begin ^ item ^ th_end ^ tr_end
; ;
(* Dynamic colors depending on mouse position *) (* Dynamic colors depending on mouse position *)
value tr_mouse_begin color_over color_out = value tr_mouse_begin color_over color_out =
......
...@@ -36,7 +36,7 @@ open Web; (* ps pl abort etc. *) ...@@ -36,7 +36,7 @@ open Web; (* ps pl abort etc. *)
open Cgi; open Cgi;
open Phases; (* Phases *) open Phases; (* Phases *)
open Phases; (* [phase] *) open Phases; (* phase *)
module Lemmas = Load_morphs.Morphs Prel Phases module Lemmas = Load_morphs.Morphs Prel Phases
; ;
...@@ -129,21 +129,21 @@ value rec str_phase = fun ...@@ -129,21 +129,21 @@ value rec str_phase = fun
| Tad (ph,_) _ _ -> "taddhita " ^ str_phase ph | Tad (ph,_) _ _ -> "taddhita " ^ str_phase ph
] ]
; ;
value print_ext_morph pvs gen form tag = do value print_scl_morph pvs gen form tag = do
{ ps (xml_begin "tag") { ps (xml_begin "tag")
; Morpho_ext.print_ext_inflected_link pvs form gen tag ; Morpho_scl.print_ext_inflected_link pvs form gen tag
; ps (xml_end "tag") ; ps (xml_end "tag")
} }
; ;
value print_ext_tags pvs phase form tags = value print_scl_tags pvs phase form tags =
let table_ext phase = let table_ext phase =
xml_begin_with_att "tags" [ ("phase",str_phase phase) ] in do xml_begin_with_att "tags" [ ("phase",str_phase phase) ] in do
{ ps (table_ext phase) { ps (table_ext phase)
; List.iter (print_ext_morph pvs (generative phase) form) tags ; List.iter (print_scl_morph pvs (generative phase) form) tags
; ps (xml_end "tags") ; ps (xml_end "tags")
} }
; ;
(* used in Parser *) (* Used in Parser *)
value extract_lemma phase word = value extract_lemma phase word =
match tags_of phase word with match tags_of phase word with
[ Atomic tags -> tags [ Atomic tags -> tags
...@@ -153,7 +153,7 @@ value extract_lemma phase word = ...@@ -153,7 +153,7 @@ value extract_lemma phase word =
| Taddhita _ _ _ tags -> tags | Taddhita _ _ _ tags -> tags
] ]
; ;
(* returns the offset correction (used by SL interface) *) (* Returns the offset correction (used by SL interface) *)
value process_transition = fun value process_transition = fun
[ Euphony (w,u,v) -> [ Euphony (w,u,v) ->
let off = if w=[] then 1 (* amui/lopa from Lopa/Lopak *) let off = if w=[] then 1 (* amui/lopa from Lopa/Lopak *)
...@@ -239,8 +239,8 @@ value print_segment offset (phase,rword,transition) = do ...@@ -239,8 +239,8 @@ value print_segment offset (phase,rword,transition) = do
} }
} }
; ;
(* Similarly for [Reader_plugin] mode (without offset) *) (* Similarly for [Reader_plugin] mode (without offset and transitions) *)
value print_ext_segment counter (phase,rword) = value print_scl_segment counter (phase,rword) =
let print_pada rword = let print_pada rword =
let word = Morpho_html.visargify rword in let word = Morpho_html.visargify rword in
let ic = string_of_int counter in let ic = string_of_int counter in
...@@ -252,41 +252,33 @@ value print_ext_segment counter (phase,rword) = ...@@ -252,41 +252,33 @@ value print_ext_segment counter (phase,rword) =
; let word = mirror rword in ; let word = mirror rword in
match tags_of phase word with match tags_of phase word with
[ Atomic tags -> [ Atomic tags ->
print_ext_tags [] phase word tags print_scl_tags [] phase word tags
| Preverbed (_,phase) pvs form tags -> | Preverbed (_,phase) pvs form tags ->
let ok_tags = let ok_tags =
if pvs = [] then tags if pvs = [] then tags
else trim_tags (generative phase) form (Canon.decode pvs) tags in else trim_tags (generative phase) form (Canon.decode pvs) tags in
print_ext_tags pvs phase form ok_tags print_scl_tags pvs phase form ok_tags
| Taddhita _ _ sfx_phase sfx_tags -> | Taddhita _ _ sfx_phase sfx_tags ->
let taddhita_phase = match sfx_phase with let taddhita_phase = match sfx_phase with
[ Sfx -> Noun [ Sfx -> Noun
| Isfx -> Iic | Isfx -> Iic
| _ -> failwith "Wrong taddhita structure" | _ -> failwith "Wrong taddhita structure"
] in ] in
print_ext_tags [] taddhita_phase word sfx_tags print_scl_tags [] taddhita_phase word sfx_tags
] ]
; ps "'>" (* closes <input *) ; ps "'>" (* closes <input *)
; let word = Morpho_html.visargify rword in ; let word = Morpho_html.visargify rword in
ps (Canon.unidevcode word) ps (Canon.unidevcode word)
; ps td_end ; ps td_end
; ps "\n" ; ps "\n"
; counter+1 ; counter+1
} }
; ;
value cell item = do (* residual of Html *)
{ ps tr_begin
; ps th_begin
; ps item
; ps th_end
; pl tr_end
}
;
value print_labels tags seg_num = do value print_labels tags seg_num = do
{ ps th_begin (* begin labels *) { ps th_begin (* begin labels *)
; pl table_labels ; pl table_labels
; let print_label n _ = do ; let print_label n _ = do
{ cell (html_red (string_of_int seg_num ^ "." ^ string_of_int n)) { ps (cell (html_red (string_of_int seg_num ^ "." ^ string_of_int n)))
; n+1 ; n+1
} in } in
let _ = List.fold_left print_label 1 tags in () let _ = List.fold_left print_label 1 tags in ()
......
...@@ -52,7 +52,7 @@ module Lexer : functor (* takes its prelude and iterator control as parameters * ...@@ -52,7 +52,7 @@ module Lexer : functor (* takes its prelude and iterator control as parameters *
value all_checks : ref (list Viccheda.check); value all_checks : ref (list Viccheda.check);
value un_analyzable : Word.word -> (list Disp.segment * Viccheda.resumption); value un_analyzable : Word.word -> (list Disp.segment * Viccheda.resumption);
value set_offset : (int * list Viccheda.check) -> unit; value set_offset : (int * list Viccheda.check) -> unit;
value print_ext_segment : int -> (Phases.phase * Word.word) -> int; value print_scl_segment : int -> (Phases.phase * Word.word) -> int;
value record_tagging : bool -> bool -> string -> int -> string -> value record_tagging : bool -> bool -> string -> int -> string ->
list (Phases.phase * Word.word * 'a) -> list (int * int) -> unit; list (Phases.phase * Word.word * 'a) -> list (int * int) -> unit;
value return_tagging : value return_tagging :
......
...@@ -7,7 +7,7 @@ ...@@ -7,7 +7,7 @@
(* ©2017 Institut National de Recherche en Informatique et en Automatique *) (* ©2017 Institut National de Recherche en Informatique et en Automatique *)
(**************************************************************************) (**************************************************************************)
(*i module Morpho_ext = struct i*) (*i module Morpho_scl = struct i*)
(* Prints lists of inflected forms in XML for use by external Web services. *) (* Prints lists of inflected forms in XML for use by external Web services. *)
(* Adapted from [Morpho_xml] *) (* Adapted from [Morpho_xml] *)
......
...@@ -274,11 +274,7 @@ value process_until sol_index query topic mode_sent translit sentence ...@@ -274,11 +274,7 @@ value process_until sol_index query topic mode_sent translit sentence
| Some p -> () | Some p -> ()
] ]
} }
with [ Truncation -> do with [ Truncation -> pl (html_red "Solution not found" ^ html_break) ]
{ pl (html_red "Solution not found")
; pl html_break
}
]
} }
; ;
...@@ -322,12 +318,13 @@ value parser_engine () = do ...@@ -322,12 +318,13 @@ value parser_engine () = do
| "f" -> Some "saa" | "f" -> Some "saa"
| "n" -> Some "tat" | "n" -> Some "tat"
| _ -> None | _ -> None
] ] in
(* File where to store locally the taggings - only for [Station] platform *) (* Corpus interaction disabled
and corpus_file = (* optionally transmitted by argument "out_file" *) (* File where to store locally the taggings - only for [Station] platform *)
[let corpus_file = (* optionally transmitted by argument "out_file" *)
try let file_name = List.assoc "out_file" alist (* do not use get *) in try let file_name = List.assoc "out_file" alist (* do not use get *) in
Some file_name Some file_name
with [ Not_found -> Some regression_file_name ] in with [ Not_found -> Some regression_file_name ] in] *)
(* Regression disabled (* Regression disabled
[let () = if Paths.platform = "Station" then match corpus_file with [let () = if Paths.platform = "Station" then match corpus_file with
[ Some file_name -> [ Some file_name ->
......
...@@ -127,13 +127,13 @@ value display limit mode text saved = fun ...@@ -127,13 +127,13 @@ value display limit mode text saved = fun
] ]
} }
| Analyse -> (* [best_sols: list (int * list Rank.Lex.Disp.segment)] *) | Analyse -> (* [best_sols: list (int * list Rank.Lex.Disp.segment)] *)
let solutions = match saved with let solutions = match saved with
[ [] -> best_sols [ [] -> best_sols
| [ (_,min_buck) :: _ ] -> List.append best_sols (List.rev min_buck) | [ (_,min_buck) :: _ ] -> List.append best_sols (List.rev min_buck)
] in ] in
let forget_transitions (phase,word,_) = (phase,word) in let forget_transitions (phase,word,_) = (phase,word) in
let forget_index (_,segments) = List.map forget_transitions segments in let forget_index (_,segments) = List.map forget_transitions segments in
let segmentations = List.map forget_index best_sols in let segmentations = List.map forget_index solutions in
Scl_parser.print_scl segmentations Scl_parser.print_scl segmentations
| _ -> () | _ -> ()
] ]
......
...@@ -34,12 +34,10 @@ module Lexer_control = struct ...@@ -34,12 +34,10 @@ module Lexer_control = struct
end (* [Lexer_control] *) end (* [Lexer_control] *)
; ;
(* Multi-phase lexer *) (* Multi-phase lexer *)
module Lex = Lexer.Lexer Prel Lexer_control (* [print_ext] *) module Lex = Lexer.Lexer Prel Lexer_control (* [print_scl_segment] *)
;
value print_scl_segment = Lex.print_ext_segment
; ;
value print_scl_output output = value print_scl_output output =
List.fold_left print_scl_segment 1 (List.rev output) List.fold_left Lex.print_scl_segment 1 (List.rev output)
; ;
value print_scl_solutions s = value print_scl_solutions s =
let _ = print_scl_output s in () let _ = print_scl_output s in ()
...@@ -53,6 +51,7 @@ value print_scl1 (solutions : list (Phases.phase * Word.word)) = ...@@ -53,6 +51,7 @@ value print_scl1 (solutions : list (Phases.phase * Word.word)) =
; ps ("<table class=\"draggable\">") ; ps ("<table class=\"draggable\">")
; ps tr_begin ; ps tr_begin
; print_scl_solutions solutions ; print_scl_solutions solutions
; ps ("<td><input type=\"hidden\" name=\"DISPLAY\" value=\"" ^ default_output_font ^"\"/></td>")
; ps tr_end ; ps tr_end
; ps table_end ; ps table_end
; ps (submit_input "Submit") ; ps (submit_input "Submit")
......
...@@ -305,26 +305,10 @@ and sandhi_page_url l = dico_page_url (dico_sandhi_page l) ...@@ -305,26 +305,10 @@ and sandhi_page_url l = dico_page_url (dico_sandhi_page l)
; ;
value image name = web_images_url ^ name value image name = web_images_url ^ name
; ;
value ocaml_logo = image "icon_ocaml.png" value ocaml_logo = image "icon_ocaml.png"
and inria_logo = image "logo_inria.png" and inria_logo = image "logo_inria.png"
; and favicon = image "favicon.ico"
(* miscellaneous graphics - check rights before distributing *) ;
value sanskrit_gif = image "sanskrit.gif"
and ganesh_gif = image "ganesh.gif"
and jagannath_jpg = image "jagannath.jpg"
and ganeshgannath_jpg = image "ganeshgannath.jpg"
and krishnagannath_jpg = image "krishnagannath.jpg"
and sarasvati_jpg = image "sarasvati.jpg"
and kadambari_png = image "kaadambarii.png"
and om_jpg = image "om.jpg"
and om2_jpg = image "om2.jpg"
and om3_jpg = image "om3.jpg"
and om4_jpg = image "om4.jpg"
and favicon = image "favicon.ico"
and hare_jpg = image "hare.jpg" (* http://www.bvml.org/grfx/chadar.jpg *)
and geo_gif = image "geopattern.gif" (* http://www.unc.edu/%7Ecernst/geopattern1.gif *)
;
(* was in html *)
value reader_meta_title = title "Sanskrit Reader Companion" value reader_meta_title = title "Sanskrit Reader Companion"
and parser_meta_title = title "Sanskrit Reader Assistant" and parser_meta_title = title "Sanskrit Reader Assistant"
and dico_title_fr = h1_title "Dictionnaire H&eacute;ritage du Sanscrit" and dico_title_fr = h1_title "Dictionnaire H&eacute;ritage du Sanscrit"
...@@ -632,7 +616,7 @@ value javascript_tooltip ="wz_tooltip.js" ...@@ -632,7 +616,7 @@ value javascript_tooltip ="wz_tooltip.js"
value remote_server_host = "http://sanskrit.inria.fr/" value remote_server_host = "http://sanskrit.inria.fr/"
; ;
(* This toogle controls accessibility of University of Hyderabad tools *) (* This toogle controls accessibility of University of Hyderabad tools *)
value scl_toggle = (* should be [exists scl_profile] *) value scl_toggle =
not (SCLpaths.scl_url="") (* True if SCL tools are installed *) not (SCLpaths.scl_url="") (* True if SCL tools are installed *)
; ;
value interaction_modes_default mode = value interaction_modes_default mode =
......
...@@ -236,7 +236,7 @@ ML/reset_caches.ml ...@@ -236,7 +236,7 @@ ML/reset_caches.ml
# WEB package - HTML, HTTP, CGI ad-hoc utilities for Web interface # WEB package - HTML, HTTP, CGI ad-hoc utilities for Web interface
WEB=ML/html.ml ML/web.ml ML/css.ml ML/cgi.ml ML/morpho_html.ml ML/chapters.ml \ WEB=ML/html.ml ML/web.ml ML/css.ml ML/cgi.ml ML/morpho_html.ml ML/chapters.ml \
ML/mk_index_page.ml ML/mk_grammar_page.ml ML/mk_reader_page.ml \ ML/mk_index_page.ml ML/mk_grammar_page.ml ML/mk_reader_page.ml \
ML/mk_sandhi_page.ml ML/morpho_ext.ml ML/compute_mw_links.ml ML/mk_sandhi_page.ml ML/morpho_scl.ml ML/compute_mw_links.ml
# TREE package - tree bank manager and syntax analyser - deprecated # TREE package - tree bank manager and syntax analyser - deprecated
TREE=ML/stemmer.ml ML/parse_tree.ml ML/parse_apte.ml ML/tag_tree.ml \ TREE=ML/stemmer.ml ML/parse_tree.ml ML/parse_apte.ml ML/tag_tree.ml \
......
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