Commit 9c590695 authored by Gérard Huet's avatar Gérard Huet

Minor cleanups

parent 15455ae9
......@@ -34,37 +34,38 @@ VPATH=$(ZEN)
# CORE package - utilities, transducers, sanskrit and french lexers, dico spec
CORE=$(DISTR_CORE) paths.ml
DISTR_CORE = control.ml version.ml date.ml canon.ml transduction.ml \
encode.ml order.ml padapatha.ml sanskrit.mli \
sanskrit.ml skt_lexer.ml test_stamp.ml dir.mli dir.ml
encode.ml order.ml padapatha.ml sanskrit.mli \
sanskrit.ml skt_lexer.ml test_stamp.ml dir.mli dir.ml
# GRAM package - phonetics, morphology, segmentation and tagging engines
GRAM=index.ml phonetics.ml int_sandhi.ml skt_morph.mli morphology.mli naming.ml \
inflected.mli inflected.ml sandhi.ml sandhier.ml pada.ml nouns.mli nouns.ml \
verbs.mli verbs.ml parts.ml conj_infos.mli morpho_string.ml morpho.ml \
declension.ml conjugation.ml indexer.ml indexerd.ml phases.ml lemmatizer.ml \
auto.mli load_transducers.ml dispatcher.mli dispatcher.ml segmenter.ml \
load_morphs.ml lexer.mli lexer.ml rank.ml scl_parser.ml \
reader.ml parser.ml constraints.mli constraints.ml multilingual.ml \
paraphrase.mli paraphrase.ml bank_lexer.ml regression.ml \
checkpoints.ml graph_segmenter.ml automaton.ml interface.mli interface.ml \
user_aid.ml reset_caches.ml params.mli params.ml
GRAM = index.ml phonetics.ml int_sandhi.ml skt_morph.mli morphology.mli \
naming.ml inflected.mli inflected.ml sandhi.ml sandhier.ml pada.ml \
nouns.mli nouns.ml verbs.mli verbs.ml parts.ml conj_infos.mli \
morpho_string.ml morpho.ml declension.ml conjugation.ml indexer.ml \
indexerd.ml phases.ml lemmatizer.ml auto.mli load_transducers.ml \
dispatcher.mli dispatcher.ml segmenter.ml load_morphs.ml lexer.mli \
lexer.ml rank.ml scl_parser.ml reader.ml parser.ml constraints.mli \
constraints.ml multilingual.ml paraphrase.mli paraphrase.ml \
bank_lexer.ml regression.ml checkpoints.ml graph_segmenter.ml \
automaton.ml interface.mli interface.ml user_aid.ml reset_caches.ml \
params.mli params.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_corpus_page.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_corpus_page.ml
# CORPUS package - corpus manager
CORPUS = corpus.mli corpus.ml web_corpus.mli web_corpus.ml \
corpus_manager.mli corpus_manager.ml corpus_manager_cgi.ml \
save_corpus_params.mli save_corpus_params.ml save_corpus_cgi.ml \
mkdir_corpus_params.mli mkdir_corpus_params.ml \
mkdir_corpus_cgi.ml mk_corpus.ml
corpus_manager.mli corpus_manager.ml corpus_manager_cgi.ml \
save_corpus_params.mli save_corpus_params.ml save_corpus_cgi.ml \
mkdir_corpus_params.mli mkdir_corpus_params.ml \
mkdir_corpus_cgi.ml mk_corpus.ml
# extra file SCLpaths.ml for SCL interfacing - not distributed.
# TREE package - tree bank manager and syntax analyser - legacy
TREE=parse_tree.ml parse_apte.ml stemmer.ml tag_tree.ml tag_apte.ml
TREE = parse_tree.ml parse_apte.ml stemmer.ml tag_tree.ml tag_apte.ml
DEBUG=debug.ml
......
......@@ -66,16 +66,16 @@ value decode_url s =
strip_heading_and_trailing_spaces (copy_decode_in s1 0 0)
else s;
(* ça convertit une chaine venant de l'URL en une a-list; la chaine est
une suite de paires clé=valeur séparées par des ; ou des \& *)
(* converts a string coming from the URL into an a-list; the string is
a sequence of pairs key=vallue separated by ; or \& *)
value create_env s =
let rec get_assoc beg i =
if i == Bytes.length s then
if i == beg then [] else [Bytes.sub s beg (i - beg)]
if i == beg then [] else [ Bytes.sub s beg (i - beg) ]
else if s.[i] == ';' || s.[i] == '&' then
let next_i = succ i in
[Bytes.sub s beg (i - beg) :: get_assoc next_i next_i]
let next_i = succ i in
[ Bytes.sub s beg (i - beg) :: get_assoc next_i next_i ]
else get_assoc beg (succ i) in
let rec separate i s =
if i = Bytes.length s then (s, "")
......@@ -105,18 +105,13 @@ value url_encode s =
(* Unreserved characters *)
[ 'a' .. 'z' | 'A' .. 'Z' | '0' .. '9' | '-' | '.' | '_' | '~' as c ->
String.make 1 c
(* Special case of the space character *)
| ' ' -> "+"
(* Reserved characters *)
| c -> "%" ^ hexa_str c
]
in
] in
let char_of_string s =
if String.length s = 1 then s.[0] else failwith "char_of_string"
in
if String.length s = 1 then s.[0] else failwith "char_of_string" in
let subst s = s |> Str.matched_string |> char_of_string |> url_encode in
let any_char = Str.regexp ".\\|\n" in
Str.global_substitute any_char subst s
......@@ -128,8 +123,7 @@ value url ?query ?fragment path =
let opt_part prefix = fun
[ None -> ""
| Some part -> prefix ^ part
]
in
] in
let query_part = opt_part "?" query in
let fragment_part = opt_part "#" fragment in
path ^ query_part ^ fragment_part
......
......@@ -18,9 +18,9 @@ open Web;
type gap = { start : int; stop : int }
;
(* The following functions assume that the given list is sorted in
increasing order and represents a subset of positive integers. In
particular, the lowest bound of a gap is at least [1] and the
greatest at most [max_int]). We call "group" a list of consecutive
increasing order and represents a subset of positive integers.
In particular, the lowest bound of a gap is at least [1] and the
greatest at most [max_int]). We call "group" a list of consecutive
integers. *)
value max_gap = { start = 1; stop = max_int }
......@@ -230,8 +230,6 @@ value body dir permission =
|> pl
; close_page_with_margin ()
}
| Web_corpus.Sentences sentences ->
let groups = group_sentences dir sentences in
do
......@@ -243,7 +241,6 @@ value body dir permission =
groups |> List.map (htmlify_group dir permission) |> List.iter pl
; close_page_with_margin ()
}
| Web_corpus.Sections sections ->
do
{ center_begin |> pl
......
......@@ -55,8 +55,8 @@ module Machine = Dispatch Transducers Lemmas
;
open Machine (* [cache_phase] *)
;
(* At this point we have a Finite Eilenberg machine ready to instantiate the
Eilenberg component of the Segment module. *)
(* At this point we have a Finite Eilenberg machine ready to instantiate *)
(* the Eilenberg component of the Segment module. *)
(* Viccheda sandhi splitting *)
......@@ -520,15 +520,14 @@ value quit_button corpmode corpdir sentno =
match corpmode with
[ Annotator -> "Abort"
| Reader | Manager -> "Continue reading"
]
)
in
])
and permission = Web_corpus.string_of_permission corpmode in
center_begin ^
cgi_begin (Cgi.url corpus_manager_cgi ~fragment:sentno) "" ^
hidden_input Params.corpus_dir corpdir ^
hidden_input Params.corpus_permission (Web_corpus.string_of_permission corpmode) ^
submit_input submit_button_label ^
cgi_end ^
cgi_begin (Cgi.url corpus_manager_cgi ~fragment:sentno) "" ^
hidden_input Params.corpus_dir corpdir ^
hidden_input Params.corpus_permission permission ^
submit_input submit_button_label ^
cgi_end ^
center_end
;
(* Main body of graph segmenter cgi *)
......@@ -611,7 +610,7 @@ value graph_engine () = do
] in
let word_len = find_word_len 1 chunks in
let new_chunk_len = Word.length (Encode.switch_code translit revised) in
let diff = new_chunk_len - word_len in
let diff = new_chunk_len-word_len in
let revised_check =
let revise (k,sec,sel) =
(if k<word_off then k else k+diff,sec,sel) in
......@@ -629,25 +628,19 @@ value graph_engine () = do
graph_cgi ^ "?" ^ text ^
";cpts=" ^ (string_points checkpoints) ^ "\";}\n</script>")
else ()
(* Save sentence button *)
; if corpus_permission = Web_corpus.Annotator then
(* TODO: use [segment_all] to compute the nb of sols instead of
passing 0 to [nb_sols]. *)
save_button query (Num.num_of_int 0) |> pl
else
()
else ()
; html_break |> pl
(* Quit button: continue reading (reader mode) or quit without
saving (annotator mode). *)
; if sentence_no <> "" then
quit_button corpus_permission
(Cgi.decode_url corpus_dir) (Cgi.decode_url sentence_no) |> pl
else
()
else ()
; close_page_with_margin ()
; page_end lang True
}
......
......@@ -4590,8 +4590,8 @@ value record_ppp_abs_stems entry rstem ppstems =
else ((* taken care of as Tia *))
; (* abs -ya computed whether set or anit *)
match entry with
[ "av" -> record_abs_ya entry rstem rstem (* -avya *)
| _ -> record_abs_ya entry rstem w
[ "av" -> record_abs_ya entry rstem (revcode "aav") (* -aavya *)
| _ -> record_abs_ya entry rstem w
]
}
| Tia w -> let (ita,itvaa) = if entry="grah" then ("iita","iitvaa")
......
......@@ -8,4 +8,4 @@
(**************************************************************************)
(* Generated by make version - see main Makefile *)
value version="3.02" and version_date="2017-10-19";
value version="3.02" and version_date="2017-10-26";
VERSION='3.02'
DATE='2017-10-19'
DATE='2017-10-26'
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