Commit 41c4387f authored by Gérard Huet's avatar Gérard Huet

Fixed path problem for UoH interface

parent d3580e73
......@@ -39,8 +39,7 @@ module Ext = UOH Lex (* [print_ext print_nn] *)
(* Mode parameter of the reader. Controled by service Reader for respectively
tagging, shallow parsing, or dependency analysis with the UoH parser. *)
(* Note that Summary/Interface is not a Reader/Parser mode. *)
(* Nyaaya is a deprecated mode for analysing nyaaya compounds. *)
type mode = [ Tag | Parse | Analyse | Nyaaya ]
type mode = [ Tag | Parse | Analyse ]
;
value rpc = remote_server_host
and remote = ref False (* local invocation of cgi by default *)
......@@ -90,7 +89,7 @@ value display limit mode text saved = fun
let kept = List.length best_sols
and max = match limit with
[ Some n -> n | None -> truncation ] in do
{ if mode = Analyse || mode = Nyaaya then ()
{ if mode = Analyse then ()
else do
{ print_sols text (*kept,max*) best_sols
; pl html_break
......@@ -136,12 +135,6 @@ value display limit mode text saved = fun
let zero_pen = List.append best_sols (List.rev min_buck) in
Ext.print_ext zero_pen
]
| Nyaaya -> match saved with
[ [] -> Ext.print_nn best_sols
| [ (_,min_buck) :: _ ] ->
let zero_pen = List.append best_sols (List.rev min_buck) in
Ext.print_nn zero_pen
]
| _ -> ()
]
}
......@@ -173,13 +166,13 @@ value process_input text us mode topic (input:string) encode cpts =
; pl "Sentence: "
; ps (deva16_blue devainput) (* devanagari *)
; pl html_break
; if mode = Analyse || mode = Nyaaya then () else ps "may be analysed as:"
; if mode = Analyse then () else ps "may be analysed as:"
; ps div_end (* Latin16 *)
; let all_chunks = match topic with
[ Some topic -> chunks @ [ code_string topic ]
| None -> chunks
] in
let filter_mode = mode=Parse || mode=Analyse || mode=Nyaaya in
let filter_mode = mode=Parse || mode=Analyse in
try segment_all filter_mode all_chunks cpts with
[ Solutions limit revsols saved ->
let sols = List.rev revsols in
......@@ -235,7 +228,6 @@ value reader_engine () = do
[ "t" -> Tag
| "p" -> Parse
| "o" -> Analyse (* Analyse mode of UoH parser *)
| "n" -> Nyaaya (* Nyaaya Cpds Analysis mode of UoH system *)
| s -> raise (Failure ("Unknown mode " ^ s))
]
(* Contextual information from past discourse *)
......
......@@ -31,12 +31,6 @@ module UOH
(* Interface with Amba Kulkarni's parser at UoH - Analysis mode *)
(****************************************************************)
(* Paths - to move to configuration time *)
value svg_interface_url = "http://localhost/cgi-bin/scl/SHMT/"
and nn_parser_url = "http://localhost/cgi-bin/scl/NN/parser/generate.cgi"
and show_parses_path = "prog/interface/call_parser_summary.cgi"
;
(* Delimitor for offline printing and piping into UoH's parser *)
value delimitor = fun
[ Iic | Iic2 | A | An | Iicv | Iicc | Iik | Iikv | Iikc | Iiif | Iiy -> "-"
......@@ -82,9 +76,9 @@ value print_callback_solution counter solution =
; ps tr_end
; ps (html_latin12 "Verse Order")
; ps table_end
; print_string "<form name=\"word-order\" method=\"get\" action = \"http://localhost/cgi-bin/scl/SHMT/prog/Word_order/call_heritage2anu.cgi\">"
; print_newline
; print_string "<table>"
; ps ("<form name=\"word-order\" method=\"get\" action = \""
^ svg_interface_url ^ "prog/Word_order/call_heritage2anu.cgi\">\n")
; ps "<table>"
; ps tr_begin
; ps td_begin
; ps (html_latin12 "Prose Order")
......@@ -105,18 +99,8 @@ value print_callback_output counter (_,output) =
value print_callback =
List.fold_left print_callback_output 1
;
value print_ext_solutions cho =
List.iter (print_ext_output cho)
value print_ext_solutions cho = List.iter (print_ext_output cho)
;
(* External call-back to Amba Kulkarni's parser (from [Reader.print_ext] *)
(*[value amba_invoke pid = (* Experimental - assumes amrita configuration *)
"mkdir -p " ^ tmp_in ^ pid ^ "; " ^
scl_dir ^ "Heritage_morph_interface/Heritage2anusaaraka_morph.sh <" ^
offline_file ^ " > " ^ tmp_in ^ pid ^ "/in" ^ pid ^ ".out; " ^
scl_dir ^ "kAraka/shabdabodha.sh YES " ^ tmp_in ^ pid ^ " in" ^
pid ^ ".out" ^ " in" ^ pid ^ ".kAraka " ^ default_output_font ^
" Full Prose NOECHO ND 2> " ^ offline ("err" ^ pid) ^ ";"
;]*)
(* Prints all segmentations in [offline_file]
and prepares invocation of UoH's CSL parser for dependency graph display *)
......@@ -129,50 +113,9 @@ value print_ext solutions =
(* System call to Amba Kulkarni's parser - fragile *)
; ps table_end
; ps (xml_begin "table")
(*[; let pid = string_of_int (Unix.getpid ()) in (* stamp with process id *)
let cmd = amba_invoke pid in (* prepare cryptic UNIX command *)
let _ = Sys.command cmd in () (* call it *) ]*)
; let _ = print_callback solutions in () (* print dependency graphs *)
(*[; ps table_end ] (?) *)
}
;
(* Now for processing of navya-nyaaya compounds in Experimental mode *)
value print_nnparser_solution counter solution =
let rec nnsegment acc solution =
match solution with
[ [] -> acc
| [ (phase,rword,_)] -> let word = Morpho_html.visargify rword in
acc ^ (Canon.unidevcode word)
| [ (phase,rword,_) :: t ] ->
let word = Morpho_html.visargify rword in
nnsegment (acc ^ (Canon.unidevcode word) ^ "-") t
] in
let nnstring = nnsegment "" solution in do
{ ps tr_begin
; ps td_begin
; ps ("<a href=\"" ^ nn_parser_url ^ "?text=")
; ps nnstring
; ps ("&encoding=Unicode\">")
; ps (html_latin12 "NN Constituency Parser ")
; ps (xml_end "a")
; ps nnstring
; ps td_end
; ps tr_end
; counter+1
}
;
value print_nnparser_output counter (_,output) =
let solution = List.rev output in
print_nnparser_solution counter solution
;
(* New: processing of NN compounds - called from Reader *)
value print_nnparser solutions = let _ =
List.fold_left print_nnparser_output 1 solutions in ()
;
value print_nn solutions = do
{ ps (xml_begin "table")
; print_nnparser solutions
; ps table_end
}
;
end;
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