Commit afc55084 authored by Idir Lankri's avatar Idir Lankri

Add CGI for corpus manager (first draft)

parent 6473d6b1
......@@ -12,6 +12,7 @@ ML/indexer
ML/indexerd
ML/interface
ML/lemmatizer
ML/manager
ML/mk_grammar_page
ML/mk_index_page
ML/mk_reader_page
......
......@@ -277,3 +277,5 @@ mk_reader_page.cmo : web.cmo paths.cmo html.cmo control.cmo cgi.cmo
mk_reader_page.cmx : web.cmx paths.cmx html.cmx control.cmx cgi.cmx
mk_sandhi_page.cmo : web.cmo html.cmo
mk_sandhi_page.cmx : web.cmx html.cmx
manager.cmo : web.cmo html.cmo dir.cmi cgi.cmo
manager.cmx : web.cmx html.cmx dir.cmx cgi.cmx
......@@ -51,7 +51,8 @@ user_aid.ml reset_caches.ml
# WEB package - HTML, HTTP, CGI utilities for Web interface
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 \
manager.ml
# extra file SCLpaths.ml for SCL interfacing - not distributed.
# TREE package - tree bank manager and syntax analyser - legacy
......@@ -135,7 +136,7 @@ bank_lexer.cmo tag_tree.cmo tag_apte.cmo
(cat debug_apte.ml ; cat -) | ocaml -I +camlp4 -I . -I $(ZEN)
cgis: skt_morph.cmi auto.cmi indexer indexerd declension conjugation \
lemmatizer reader parser sandhier reader interface user_aid
lemmatizer reader parser sandhier reader interface user_aid manager
indexer: indexer.cmx
$(LINK) list2.cmx gen.cmx paths.cmx version.cmx date.cmx \
......@@ -216,6 +217,10 @@ chapters.cmx morpho_html.cmx bank_lexer.cmx cgi.cmx segmenter.cmx \
morpho_scl.cmx load_morphs.cmx lexer.cmx constraints.cmx checkpoints.cmx \
paraphrase.cmx scl_parser.cmx parser.cmx -o parser
manager: manager.cmx
$(LINK) paths.cmx version.cmx date.cmx html.cmx SCLpaths.cmx \
web.cmx cgi.cmx dir.cmx $< -o $@
css: css.cmx
$(LINK) gen.cmx paths.cmx version.cmx date.cmx html.cmx \
SCLpaths.cmx web.cmx css.cmx -o css
......@@ -309,7 +314,7 @@ clean:
rm -f *.cmo *.cmi *.cmx *.ppi *.ppo *.o
rm -f css indexer indexerd sandhier reader parser lemmatizer \
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 manager \
parse_apte tag_apte
# make dico.cmi auto.cmi conj_infos.cmi # needed to get dependencies right
......
(* CGI script [manager] for corpus management, i.e. for listing and
adding sentences to the corpus. *)
(*i module Manager = struct i*)
value dir_key = "q"
;
value sentence_links dir =
let to_anchor_ref file = Html.anchor_ref (Web.corpus_url ^ dir ^ file) file in
let files = Dir.files_with_ext "html" (Web.corpus_dir ^ dir) in
List.map to_anchor_ref files
;
value subdir_selection dir subdirs =
let prefixed_subdirs = List.map (fun x -> dir ^ x ^ "/") subdirs in
Html.option_select_label dir_key (List.combine prefixed_subdirs subdirs)
;
value body dir subdirs =
match subdirs with
[ [] -> sentence_links dir |> List.iter Web.pl
| _ ->
do
{ Web.cgi_begin Web.manager_cgi "" |> Web.pl
; subdir_selection dir subdirs |> Web.pl
; Html.submit_input "Submit" |> Web.pl
; Web.cgi_end |> Web.pl }]
;
value make () =
let title = "Corpus Manager" in
let meta_title = Html.title title in
let style = Html.background Html.Chamois in
let query = Cgi.query_string () in
let env = Cgi.create_env query in
let dir = Cgi.decode_url (Cgi.get dir_key env "") in
let subdirs = Dir.subdirs (Web.corpus_dir ^ dir) in
do
{ Web.http_header |> Web.pl
; Web.page_begin meta_title
; Html.body_begin style |> Web.pl
; Html.h1_title title |> Web.pl
; body dir subdirs
; Web.page_end Html.default_language True }
;
(***************)
(* Entry point *)
(***************)
value main = make ()
;
(*i end; i*)
......@@ -51,6 +51,7 @@ and parser_cgi = cgi_bin Paths.cgi_parser (* parser *)
and graph_cgi = cgi_bin Paths.cgi_graph (* summarizer graphical interface *)
and user_aid_cgi = cgi_bin Paths.cgi_user_aid (* unknown chunks processing *)
and sandhier_cgi = cgi_bin Paths.cgi_sandhier (* sandhier *)
and manager_cgi = cgi_bin Paths.cgi_manager (* Corpus manager *)
;
(* Absolute paths on development site *)
value resources name = Paths.skt_resources_dir ^ name ^ "/"
......@@ -70,6 +71,7 @@ value top_site_dir name = Paths.public_skt_dir ^ name ^ "/"
value public_dico_dir = top_site_dir "DICO" (* hypertext dictionary *)
and public_data_dir = top_site_dir "DATA" (* linguistic data for cgis *)
and var_dir = top_site_dir "VAR" (* Parser dynamic regression suites *)
and corpus_dir = top_site_dir "CORPUS" (* Corpus tree *)
;
(* This file is accessible only from Station clients in [var_dir] *)
value regression_file_name = "regression" (* regression analysis stuff *)
......@@ -281,6 +283,7 @@ value skt_dir_url = Paths.skt_dir_url
value web_dico_url = skt_dir_url ^ "DICO/"
and mw_dico_url = skt_dir_url ^ "MW/"
and web_images_url = skt_dir_url ^ "IMAGES/"
and corpus_url = skt_dir_url ^ "CORPUS/"
and sanskrit_page_url l = skt_dir_url ^ (site_entry_page l)
and faq_page_url l = skt_dir_url ^ (faq_page l)
and portal_page_url l = skt_dir_url ^ (portal_page l)
......
......@@ -180,6 +180,9 @@ CGISANDHI=sktsandhier$(CGIEXT)
CGIGRAPH=sktgraph$(CGIEXT)
# cgi name under which the user aid for unknown chunks is installed on the server
CGIUSER=sktuser$(CGIEXT)
# CGI name under which the corpus manager is installed on the server.
CGIMANAGER = manager$(CGIEXT)
# what mouse action to use for viewing lemmatization
MOUSEACTION=#MOUSEACTION
# MOUSEACTION='CLICK'#amrita
......@@ -216,7 +219,8 @@ UTIL=ML/Makefile $(ML_COPYRIGHT) ML/.ocamlinit ML/.depend
# CORE package - utilities, transducers, sanskrit and french lexers, dico spec
DISTR_CORE=ML/control.ml ML/dico.mli ML/version.ml ML/date.ml ML/install.ml \
ML/canon.ml ML/transduction.ml ML/encode.ml ML/order.ml ML/padapatha \
ML/sanskrit.mli ML/sanskrit.ml ML/french.mli ML/french.ml ML/skt_lexer.ml
ML/sanskrit.mli ML/sanskrit.ml ML/french.mli ML/french.ml ML/skt_lexer.ml \
ML/dir.mli ML/dir.ml
CORE=$(DISTR_CORE) ML/paths.ml
# GRAM package - phonetics, morphology, segmentation and tagging engines
......@@ -236,7 +240,7 @@ ML/reset_caches.ml
# 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 \
ML/mk_index_page.ml ML/mk_grammar_page.ml ML/mk_reader_page.ml \
ML/mk_sandhi_page.ml ML/morpho_scl.ml ML/compute_mw_links.ml
ML/mk_sandhi_page.ml ML/morpho_scl.ml ML/compute_mw_links.ml ML/manager.ml
# 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 \
......@@ -406,6 +410,7 @@ echo 'and cgi_conj = "$(CGICONJ)"'; \
echo 'and cgi_sandhier = "$(CGISANDHI)"'; \
echo 'and cgi_graph = "$(CGIGRAPH)"'; \
echo 'and cgi_user_aid = "$(CGIUSER)"'; \
echo 'and cgi_manager = "$(CGIMANAGER)"'; \
echo 'and mouse_action = "$(MOUSEACTION)";') > ML/paths.ml
$(MAKE) version
......@@ -469,6 +474,7 @@ releasecgi:
$(MAKE) stemmer
$(MAKE) analyser
$(MAKE) sandhi
$(MAKE) manager
abrevs:
cp $(BOOK)/abrevs.pdf SITE # for documenting the Website with abbreviations
......@@ -550,6 +556,10 @@ indexers: ML/indexer ML/indexerd
cp ML/indexer $(CGIDIR)$(CGIINDEX)
cp ML/indexerd $(CGIDIR)$(CGIINDEXD)
.PHONY: manager
manager: ML/manager
cp $< $(CGIDIR)$(CGIMANAGER)
#### Version Management and Distribution are now managed by Git ####
##############################
......
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