Commit c9aff367 authored by Gérard Huet's avatar Gérard Huet

Version 3.09 adapted to OCaml version 4.07.0 - ocaml upgrade needed -

parent 72b89b4c
This diff is collapsed.
...@@ -11,7 +11,7 @@ ...@@ -11,7 +11,7 @@
This is just a reminder for quick installation. This is just a reminder for quick installation.
A more complete installation procedure is described in file SETUP/INSTALL. A more complete installation procedure is described in file SETUP/INSTALL.
0) Install OCaml (>= 4.02). See http://ocaml.org for installation 0) Install OCaml (>= 4.07). See http://ocaml.org for installation
instructions. instructions.
Then install the Camplp4 processor in the corresponding distribution. Then install the Camplp4 processor in the corresponding distribution.
...@@ -20,7 +20,8 @@ If OCaml has been installed through the OPAM package manager, then: ...@@ -20,7 +20,8 @@ If OCaml has been installed through the OPAM package manager, then:
opam install camlp4 opam install camlp4
should do the job. Alternatively, see https://github.com/ocaml/camlp4 should do the job. Alternatively, see https://github.com/ocaml/camlp4
for download and installation instructions. for download and installation instructions. You may have to install
the auxiliary package ocamlbuild.
Beware: camlp4 is not updated at every Ocaml distribution, so you may have Beware: camlp4 is not updated at every Ocaml distribution, so you may have
to settle for a somewhat ancient version of Ocaml, such as 4.02.2, which is to settle for a somewhat ancient version of Ocaml, such as 4.02.2, which is
......
...@@ -40,13 +40,13 @@ order.cmo : ...@@ -40,13 +40,13 @@ order.cmo :
order.cmx : order.cmx :
padapatha.cmo : ../ZEN/word.cmo phonetics.cmo encode.cmo padapatha.cmo : ../ZEN/word.cmo phonetics.cmo encode.cmo
padapatha.cmx : ../ZEN/word.cmx phonetics.cmx encode.cmx padapatha.cmx : ../ZEN/word.cmx phonetics.cmx encode.cmx
skt_lexer.cmo : encode.cmo
skt_lexer.cmx : encode.cmx
sanskrit.cmi : ../ZEN/word.cmo sanskrit.cmi : ../ZEN/word.cmo
sanskrit.cmo : transduction.cmo skt_lexer.cmo padapatha.cmo encode.cmo \ sanskrit.cmo : transduction.cmo skt_lexer.cmo padapatha.cmo encode.cmo \
canon.cmo sanskrit.cmi canon.cmo sanskrit.cmi
sanskrit.cmx : transduction.cmx skt_lexer.cmx padapatha.cmx encode.cmx \ sanskrit.cmx : transduction.cmx skt_lexer.cmx padapatha.cmx encode.cmx \
canon.cmx sanskrit.cmi canon.cmx sanskrit.cmi
skt_lexer.cmo : encode.cmo
skt_lexer.cmx : encode.cmx
test_stamp.cmo : version.cmo paths.cmo ../ZEN/gen.cmo control.cmo test_stamp.cmo : version.cmo paths.cmo ../ZEN/gen.cmo control.cmo
test_stamp.cmx : version.cmx paths.cmx ../ZEN/gen.cmx control.cmx test_stamp.cmx : version.cmx paths.cmx ../ZEN/gen.cmx control.cmx
dir.cmi : dir.cmi :
...@@ -152,12 +152,12 @@ dispatcher.cmi : ../ZEN/word.cmo phases.cmo morphology.cmi \ ...@@ -152,12 +152,12 @@ dispatcher.cmi : ../ZEN/word.cmo phases.cmo morphology.cmi \
load_transducers.cmo html.cmo ../ZEN/deco.cmo auto.cmi load_transducers.cmo html.cmo ../ZEN/deco.cmo auto.cmi
dispatcher.cmo : ../ZEN/word.cmo web.cmo skt_morph.cmi phonetics.cmo \ dispatcher.cmo : ../ZEN/word.cmo web.cmo skt_morph.cmi phonetics.cmo \
phases.cmo pada.cmo naming.cmo morphology.cmi load_transducers.cmo \ phases.cmo pada.cmo naming.cmo morphology.cmi load_transducers.cmo \
../ZEN/list2.cmo html.cmo ../ZEN/gen.cmo encode.cmo ../ZEN/deco.cmo \ ../ZEN/list2.cmo html.cmo encode.cmo ../ZEN/deco.cmo control.cmo \
control.cmo canon.cmo auto.cmi dispatcher.cmi canon.cmo auto.cmi dispatcher.cmi
dispatcher.cmx : ../ZEN/word.cmx web.cmx skt_morph.cmi phonetics.cmx \ dispatcher.cmx : ../ZEN/word.cmx web.cmx skt_morph.cmi phonetics.cmx \
phases.cmx pada.cmx naming.cmx morphology.cmi load_transducers.cmx \ phases.cmx pada.cmx naming.cmx morphology.cmi load_transducers.cmx \
../ZEN/list2.cmx html.cmx ../ZEN/gen.cmx encode.cmx ../ZEN/deco.cmx \ ../ZEN/list2.cmx html.cmx encode.cmx ../ZEN/deco.cmx control.cmx \
control.cmx canon.cmx auto.cmi dispatcher.cmi canon.cmx auto.cmi dispatcher.cmi
segmenter.cmo : ../ZEN/word.cmo web.cmo phonetics.cmo ../ZEN/list2.cmo \ segmenter.cmo : ../ZEN/word.cmo web.cmo phonetics.cmo ../ZEN/list2.cmo \
../ZEN/gen.cmo encode.cmo ../ZEN/deco.cmo auto.cmi ../ZEN/gen.cmo encode.cmo ../ZEN/deco.cmo auto.cmi
segmenter.cmx : ../ZEN/word.cmx web.cmx phonetics.cmx ../ZEN/list2.cmx \ segmenter.cmx : ../ZEN/word.cmx web.cmx phonetics.cmx ../ZEN/list2.cmx \
...@@ -167,7 +167,7 @@ load_morphs.cmo : ../ZEN/word.cmo web.cmo morphology.cmi html.cmo \ ...@@ -167,7 +167,7 @@ load_morphs.cmo : ../ZEN/word.cmo web.cmo morphology.cmi html.cmo \
load_morphs.cmx : ../ZEN/word.cmx web.cmx morphology.cmi html.cmx \ load_morphs.cmx : ../ZEN/word.cmx web.cmx morphology.cmi html.cmx \
../ZEN/gen.cmx ../ZEN/deco.cmx control.cmx ../ZEN/gen.cmx ../ZEN/deco.cmx control.cmx
lexer.cmi : ../ZEN/word.cmo phases.cmo morphology.cmi load_transducers.cmo \ lexer.cmi : ../ZEN/word.cmo phases.cmo morphology.cmi load_transducers.cmo \
html.cmo dispatcher.cmi load_morphs.cmo html.cmo dispatcher.cmi
lexer.cmo : ../ZEN/word.cmo web.cmo transduction.cmo skt_morph.cmi \ lexer.cmo : ../ZEN/word.cmo web.cmo transduction.cmo skt_morph.cmi \
segmenter.cmo phases.cmo naming.cmo morphology.cmi morpho_string.cmo \ segmenter.cmo phases.cmo naming.cmo morphology.cmi morpho_string.cmo \
morpho_scl.cmo morpho_html.cmo morpho.cmo load_transducers.cmo \ morpho_scl.cmo morpho_html.cmo morpho.cmo load_transducers.cmo \
...@@ -193,13 +193,15 @@ reader.cmx : web.cmx scl_parser.cmx sanskrit.cmx rank.cmx phases.cmx \ ...@@ -193,13 +193,15 @@ reader.cmx : web.cmx scl_parser.cmx sanskrit.cmx rank.cmx phases.cmx \
paths.cmx html.cmx encode.cmx control.cmx checkpoints.cmx cgi.cmx \ paths.cmx html.cmx encode.cmx control.cmx checkpoints.cmx cgi.cmx \
canon.cmx canon.cmx
parser.cmo : ../ZEN/word.cmo web.cmo skt_morph.cmi scl_parser.cmo \ parser.cmo : ../ZEN/word.cmo web.cmo skt_morph.cmi scl_parser.cmo \
sanskrit.cmi SCLpaths.cmo paths.cmo paraphrase.cmi ../ZEN/list2.cmo \ sanskrit.cmi SCLpaths.cmo phases.cmo paths.cmo paraphrase.cmi \
lexer.cmi inflected.cmi html.cmo ../ZEN/gen.cmo encode.cmo date.cmo \ morpho_html.cmo ../ZEN/list2.cmo lexer.cmi inflected.cmi html.cmo \
control.cmo constraints.cmi checkpoints.cmo cgi.cmo canon.cmo ../ZEN/gen.cmo encode.cmo date.cmo control.cmo constraints.cmi \
checkpoints.cmo cgi.cmo canon.cmo
parser.cmx : ../ZEN/word.cmx web.cmx skt_morph.cmi scl_parser.cmx \ parser.cmx : ../ZEN/word.cmx web.cmx skt_morph.cmi scl_parser.cmx \
sanskrit.cmx SCLpaths.cmx paths.cmx paraphrase.cmx ../ZEN/list2.cmx \ sanskrit.cmx SCLpaths.cmx phases.cmx paths.cmx paraphrase.cmx \
lexer.cmx inflected.cmx html.cmx ../ZEN/gen.cmx encode.cmx date.cmx \ morpho_html.cmx ../ZEN/list2.cmx lexer.cmx inflected.cmx html.cmx \
control.cmx constraints.cmx checkpoints.cmx cgi.cmx canon.cmx ../ZEN/gen.cmx encode.cmx date.cmx control.cmx constraints.cmx \
checkpoints.cmx cgi.cmx canon.cmx
constraints.cmi : skt_morph.cmi morphology.cmi constraints.cmi : skt_morph.cmi morphology.cmi
constraints.cmo : ../ZEN/word.cmo skt_morph.cmi morphology.cmi \ constraints.cmo : ../ZEN/word.cmo skt_morph.cmi morphology.cmi \
../ZEN/list2.cmo html.cmo canon.cmo constraints.cmi ../ZEN/list2.cmo html.cmo canon.cmo constraints.cmi
...@@ -214,10 +216,6 @@ paraphrase.cmx : web.cmx skt_morph.cmi morphology.cmi html.cmx \ ...@@ -214,10 +216,6 @@ paraphrase.cmx : web.cmx skt_morph.cmi morphology.cmi html.cmx \
constraints.cmx paraphrase.cmi constraints.cmx paraphrase.cmi
bank_lexer.cmo : bank_lexer.cmo :
bank_lexer.cmx : bank_lexer.cmx :
regression.cmo : web.cmo version.cmo sanskrit.cmi rank.cmo encode.cmo \
date.cmo constraints.cmi bank_lexer.cmo
regression.cmx : web.cmx version.cmx sanskrit.cmx rank.cmx encode.cmx \
date.cmx constraints.cmx bank_lexer.cmx
checkpoints.cmo : phases.cmo encode.cmo control.cmo canon.cmo bank_lexer.cmo checkpoints.cmo : phases.cmo encode.cmo control.cmo canon.cmo bank_lexer.cmo
checkpoints.cmx : phases.cmx encode.cmx control.cmx canon.cmx bank_lexer.cmx checkpoints.cmx : phases.cmx encode.cmx control.cmx canon.cmx bank_lexer.cmx
graph_segmenter.cmo : ../ZEN/word.cmo web.cmo phonetics.cmo ../ZEN/list2.cmo \ graph_segmenter.cmo : ../ZEN/word.cmo web.cmo phonetics.cmo ../ZEN/list2.cmo \
......
#load "dynlink.cma";; #load "dynlink.cma";;
#load "camlp4r.cma";; #load "camlp4/camlp4r.cma";;
...@@ -5,9 +5,9 @@ ...@@ -5,9 +5,9 @@
# Gérard Huet & Pawan Goyal # # Gérard Huet & Pawan Goyal #
# # # #
############################################################################ ############################################################################
# Makefile of Sanskrit Heritage Software 21-01-2018 Copyright INRIA 2018 # # Makefile of Sanskrit Heritage Software 09-09-2018 Copyright INRIA 2018 #
############################################################################ ############################################################################
# Prerequisites: Ocaml and Camlp4 preprocessor # Prerequisites: Ocaml 4.07 and Camlp4 preprocessor
# For change of make in all recursive Makefiles # For change of make in all recursive Makefiles
MAKE=make MAKE=make
...@@ -33,9 +33,9 @@ VPATH=$(ZEN) ...@@ -33,9 +33,9 @@ VPATH=$(ZEN)
# CORE package - utilities, transducers, sanskrit and french lexers, dico spec # CORE package - utilities, transducers, sanskrit and french lexers, dico spec
CORE=$(DISTR_CORE) paths.ml CORE=$(DISTR_CORE) paths.ml
DISTR_CORE = control.ml version.ml date.ml canon.ml transduction.ml \ DISTR_CORE = control.ml version.ml date.ml canon.ml transduction.ml encode.ml \
encode.ml order.ml padapatha.ml sanskrit.mli \ order.ml padapatha.ml skt_lexer.ml sanskrit.mli sanskrit.ml \
sanskrit.ml skt_lexer.ml test_stamp.ml dir.mli dir.ml test_stamp.ml dir.mli dir.ml
# GRAM package - phonetics, morphology, segmentation and tagging engines # GRAM package - phonetics, morphology, segmentation and tagging engines
GRAM = index.ml phonetics.ml int_sandhi.ml skt_morph.mli morphology.mli \ GRAM = index.ml phonetics.ml int_sandhi.ml skt_morph.mli morphology.mli \
...@@ -86,7 +86,7 @@ COMPILE=ocamlopt -pp "camlp4r pa_extend.cmo" -I $(ZEN) -I +camlp4 -c \ ...@@ -86,7 +86,7 @@ COMPILE=ocamlopt -pp "camlp4r pa_extend.cmo" -I $(ZEN) -I +camlp4 -c \
COMPILEI=ocamlc -pp "camlp4r pa_extend.cmo" -I $(ZEN) -I +camlp4 -c \ COMPILEI=ocamlc -pp "camlp4r pa_extend.cmo" -I $(ZEN) -I +camlp4 -c \
$(ANNOTFLAGS) $(ANNOTFLAGS)
LINK=ocamlopt -I $(ZEN) -I +camlp4 dynlink.cmxa camlp4lib.cmxa LINK=ocamlopt -I $(ZEN) -I +camlp4 dynlink.cmxa camlp4lib.cmxa
# standard installation of Sanskrit Heritage platform - assumes ZEN library # standard installation of Sanskrit Heritage platform - assumes ZEN library
...@@ -172,7 +172,7 @@ word.cmx deco.cmx zen_lexer.cmx canon.cmx phonetics.cmx transduction.cmx \ ...@@ -172,7 +172,7 @@ word.cmx deco.cmx zen_lexer.cmx canon.cmx phonetics.cmx transduction.cmx \
encode.cmx html.cmx SCLpaths.cmx web.cmx cgi.cmx naming.cmx morpho_string.cmx \ encode.cmx html.cmx SCLpaths.cmx web.cmx cgi.cmx naming.cmx morpho_string.cmx \
morpho.cmx order.cmx chapters.cmx morpho_html.cmx lemmatizer.cmx -o lemmatizer morpho.cmx order.cmx chapters.cmx morpho_html.cmx lemmatizer.cmx -o lemmatizer
declension: declension.cmx declension: declension.cmx share.cmx
$(LINK) str.cmxa list2.cmx gen.cmx paths.cmx version.cmx date.cmx control.cmx \ $(LINK) str.cmxa list2.cmx gen.cmx paths.cmx version.cmx date.cmx control.cmx \
word.cmx canon.cmx zen_lexer.cmx phonetics.cmx transduction.cmx encode.cmx \ word.cmx canon.cmx zen_lexer.cmx phonetics.cmx transduction.cmx encode.cmx \
deco.cmx int_sandhi.cmx lexmap.cmx inflected.cmx bank_lexer.cmx html.cmx \ deco.cmx int_sandhi.cmx lexmap.cmx inflected.cmx bank_lexer.cmx html.cmx \
...@@ -204,14 +204,17 @@ chapters.cmx morpho_html.cmx cgi.cmx segmenter.cmx morpho_scl.cmx \ ...@@ -204,14 +204,17 @@ 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
interface: interface.cmx LEGACY=
# LEGACY= nums.cmxa
interface: interface.cmx minimap.cmx
$(LINK) str.cmxa unix.cmxa list2.cmx gen.cmx paths.cmx version.cmx date.cmx \ $(LINK) str.cmxa unix.cmxa list2.cmx gen.cmx paths.cmx version.cmx date.cmx \
control.cmx word.cmx canon.cmx zen_lexer.cmx phonetics.cmx transduction.cmx \ 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 bank_lexer.cmx cgi.cmx load_morphs.cmx \ chapters.cmx morpho_html.cmx bank_lexer.cmx cgi.cmx load_morphs.cmx \
int_sandhi.cmx nouns.cmx share.cmx minimap.cmx mini.cmx nums.cmxa \ int_sandhi.cmx nouns.cmx share.cmx minimap.cmx mini.cmx $(LEGACY) \
graph_segmenter.cmx checkpoints.cmx automaton.cmx params.cmx \ graph_segmenter.cmx checkpoints.cmx automaton.cmx params.cmx \
save_corpus_params.cmx dir.cmx corpus.cmx web_corpus.cmx interface.cmx -o interface save_corpus_params.cmx dir.cmx corpus.cmx web_corpus.cmx interface.cmx -o interface
...@@ -244,7 +247,7 @@ corpus_manager: corpus_manager_cgi.cmx ...@@ -244,7 +247,7 @@ corpus_manager: corpus_manager_cgi.cmx
load_transducers.cmx pada.cmx phases.cmx dispatcher.cmx \ load_transducers.cmx pada.cmx phases.cmx dispatcher.cmx \
order.cmx chapters.cmx morpho_html.cmx bank_lexer.cmx \ order.cmx chapters.cmx morpho_html.cmx bank_lexer.cmx \
cgi.cmx load_morphs.cmx int_sandhi.cmx nouns.cmx \ cgi.cmx load_morphs.cmx int_sandhi.cmx nouns.cmx \
share.cmx minimap.cmx mini.cmx nums.cmxa \ share.cmx minimap.cmx mini.cmx $(LEGACY) \
graph_segmenter.cmx checkpoints.cmx automaton.cmx \ graph_segmenter.cmx checkpoints.cmx automaton.cmx \
params.cmx save_corpus_params.cmx dir.cmx corpus.cmx \ params.cmx save_corpus_params.cmx dir.cmx corpus.cmx \
web_corpus.cmx multilingual.cmx \ web_corpus.cmx multilingual.cmx \
...@@ -260,7 +263,7 @@ save_corpus: save_corpus_cgi.cmx ...@@ -260,7 +263,7 @@ save_corpus: save_corpus_cgi.cmx
load_transducers.cmx pada.cmx phases.cmx dispatcher.cmx \ load_transducers.cmx pada.cmx phases.cmx dispatcher.cmx \
order.cmx chapters.cmx morpho_html.cmx bank_lexer.cmx \ order.cmx chapters.cmx morpho_html.cmx bank_lexer.cmx \
cgi.cmx load_morphs.cmx int_sandhi.cmx nouns.cmx \ cgi.cmx load_morphs.cmx int_sandhi.cmx nouns.cmx \
share.cmx minimap.cmx mini.cmx nums.cmxa \ share.cmx minimap.cmx mini.cmx $(LEGACY) \
graph_segmenter.cmx checkpoints.cmx automaton.cmx \ graph_segmenter.cmx checkpoints.cmx automaton.cmx \
params.cmx save_corpus_params.cmx dir.cmx corpus.cmx \ params.cmx save_corpus_params.cmx dir.cmx corpus.cmx \
web_corpus.cmx multilingual.cmx \ web_corpus.cmx multilingual.cmx \
...@@ -276,7 +279,7 @@ mkdir_corpus: mkdir_corpus_cgi.cmx ...@@ -276,7 +279,7 @@ mkdir_corpus: mkdir_corpus_cgi.cmx
load_transducers.cmx pada.cmx phases.cmx dispatcher.cmx \ load_transducers.cmx pada.cmx phases.cmx dispatcher.cmx \
order.cmx chapters.cmx morpho_html.cmx bank_lexer.cmx \ order.cmx chapters.cmx morpho_html.cmx bank_lexer.cmx \
cgi.cmx load_morphs.cmx int_sandhi.cmx nouns.cmx \ cgi.cmx load_morphs.cmx int_sandhi.cmx nouns.cmx \
share.cmx minimap.cmx mini.cmx nums.cmxa \ share.cmx minimap.cmx mini.cmx $(LEGACY) \
graph_segmenter.cmx checkpoints.cmx automaton.cmx \ graph_segmenter.cmx checkpoints.cmx automaton.cmx \
params.cmx save_corpus_params.cmx dir.cmx corpus.cmx \ params.cmx save_corpus_params.cmx dir.cmx corpus.cmx \
web_corpus.cmx multilingual.cmx \ web_corpus.cmx multilingual.cmx \
...@@ -292,7 +295,7 @@ mk_corpus: mk_corpus.cmx ...@@ -292,7 +295,7 @@ mk_corpus: mk_corpus.cmx
load_transducers.cmx pada.cmx phases.cmx dispatcher.cmx \ load_transducers.cmx pada.cmx phases.cmx dispatcher.cmx \
order.cmx chapters.cmx morpho_html.cmx bank_lexer.cmx \ order.cmx chapters.cmx morpho_html.cmx bank_lexer.cmx \
cgi.cmx load_morphs.cmx int_sandhi.cmx nouns.cmx \ cgi.cmx load_morphs.cmx int_sandhi.cmx nouns.cmx \
share.cmx minimap.cmx mini.cmx nums.cmxa \ share.cmx minimap.cmx mini.cmx $(LEGACY) \
graph_segmenter.cmx checkpoints.cmx automaton.cmx \ graph_segmenter.cmx checkpoints.cmx automaton.cmx \
params.cmx save_corpus_params.cmx dir.cmx corpus.cmx \ params.cmx save_corpus_params.cmx dir.cmx corpus.cmx \
web_corpus.cmx multilingual.cmx \ web_corpus.cmx multilingual.cmx \
......
...@@ -24,63 +24,63 @@ value hexa_val conf = ...@@ -24,63 +24,63 @@ value hexa_val conf =
; ;
value decode_url s = value decode_url s =
let rec need_decode i = let rec need_decode i =
if i < Bytes.length s then if i < String.length s then
match s.[i] with match s.[i] with
[ '%' | '+' -> True [ '%' | '+' -> True
| _ -> need_decode (succ i) | _ -> need_decode (succ i)
] ]
else False in else False in
let rec compute_len i i1 = let rec compute_len i i1 =
if i < Bytes.length s then if i < String.length s then
let i = let i =
match s.[i] with match s.[i] with
[ '%' when i + 2 < Bytes.length s -> i + 3 [ '%' when i + 2 < String.length s -> i + 3
| _ -> succ i | _ -> succ i
] ]
in in
compute_len i (succ i1) compute_len i (succ i1)
else i1 in else i1 in
let rec copy_decode_in s1 i i1 = let rec copy_decode_in s1 i i1 =
if i < Bytes.length s then if i < String.length s then
let i = let i =
match s.[i] with match s.[i] with
[ '%' when i + 2 < Bytes.length s -> [ '%' when i + 2 < String.length s ->
let v = hexa_val s.[i + 1] * 16 + hexa_val s.[i + 2] let v = hexa_val s.[i+1] * 16 + hexa_val s.[i+2] in
in do {Bytes.set s1 i1 (Char.chr v); i + 3} do {Bytes.set s1 i1 (Char.chr v); i + 3}
| '+' -> do {Bytes.set s1 i1 ' '; succ i} | '+' -> do {Bytes.set s1 i1 ' '; succ i}
| x -> do {Bytes.set s1 i1 x; succ i} | x -> do {Bytes.set s1 i1 x; succ i}
] in ] in
copy_decode_in s1 i (succ i1) copy_decode_in s1 i (succ i1)
else s1 in else s1 in
let rec strip_heading_and_trailing_spaces s = let rec strip_heading_and_trailing_spaces s =
if Bytes.length s > 0 then if String.length s > 0 then
if s.[0] == ' ' then if s.[0] == ' ' then
strip_heading_and_trailing_spaces (Bytes.sub s 1 (Bytes.length s - 1)) strip_heading_and_trailing_spaces (String.sub s 1 (String.length s - 1))
else if s.[Bytes.length s - 1] == ' ' then else if s.[String.length s - 1] == ' ' then
strip_heading_and_trailing_spaces (Bytes.sub s 0 (Bytes.length s - 1)) strip_heading_and_trailing_spaces (String.sub s 0 (String.length s - 1))
else s else s
else s in else s in
if need_decode 0 then if need_decode 0 then
let len = compute_len 0 0 in let len = compute_len 0 0 in
let s1 = Bytes.create len in let s1 = Bytes.create len in
strip_heading_and_trailing_spaces (copy_decode_in s1 0 0) strip_heading_and_trailing_spaces (Bytes.to_string (copy_decode_in s1 0 0))
else s; else s
;
(* converts a string coming from the URL into an a-list; the string is (* converts a string coming from the URL into an a-list; the string is
a sequence of pairs key=vallue separated by ; or \& *) a sequence of pairs key=value separated by ; or \& *)
value create_env s = value create_env s =
let rec get_assoc beg i = let rec get_assoc beg i =
if i == Bytes.length s then if i == String.length s then
if i == beg then [] else [ Bytes.sub s beg (i - beg) ] if i == beg then [] else [String.sub s beg (i - beg)]
else if s.[i] == ';' || s.[i] == '&' then else if s.[i] == ';' || s.[i] == '&' then
let next_i = succ i in let next_i = succ i in
[ Bytes.sub s beg (i - beg) :: get_assoc next_i next_i ] [String.sub s beg (i - beg) :: get_assoc next_i next_i]
else get_assoc beg (succ i) in else get_assoc beg (succ i) in
let rec separate i s = let rec separate i s =
if i = Bytes.length s then (s, "") if i = String.length s then (s, "")
else if s.[i] == '=' then else if s.[i] == '=' then
(Bytes.sub s 0 i, Bytes.sub s (succ i) (Bytes.length s - succ i)) (String.sub s 0 i, String.sub s (succ i) (String.length s - succ i))
else separate (succ i) s in else separate (succ i) s in
List.map (separate 0) (get_assoc 0 0) List.map (separate 0) (get_assoc 0 0)
; ;
......
...@@ -46,7 +46,7 @@ module Analysis : sig ...@@ -46,7 +46,7 @@ module Analysis : sig
type t type t
; ;
value make : value make :
Analyzer.t -> Html.language -> string -> Num.num -> t Analyzer.t -> Html.language -> string -> int (* Num.num *) -> t
; ;
value analyzer : t -> Analyzer.t value analyzer : t -> Analyzer.t
; ;
...@@ -54,14 +54,14 @@ module Analysis : sig ...@@ -54,14 +54,14 @@ module Analysis : sig
; ;
value checkpoints : t -> string value checkpoints : t -> string
; ;
value nb_sols : t -> Num.num value nb_sols : t -> int (* Num.num *)
; ;
end = struct end = struct
type t = type t =
{ analyzer : Analyzer.t { analyzer : Analyzer.t
; lang : Html.language ; lang : Html.language
; checkpoints : string ; checkpoints : string
; nb_sols : Num.num ; nb_sols : int (* Num.num *)
} }
; ;
value make analyzer lang checkpoints nb_sols = value make analyzer lang checkpoints nb_sols =
......
...@@ -28,7 +28,7 @@ end ...@@ -28,7 +28,7 @@ end
module Analysis : sig module Analysis : sig
type t type t
; ;
value make : Analyzer.t -> Html.language -> string -> Num.num -> t value make : Analyzer.t -> Html.language -> string -> int (* Num.num *) -> t
; ;
value analyzer : t -> Analyzer.t value analyzer : t -> Analyzer.t
; ;
...@@ -36,7 +36,7 @@ module Analysis : sig ...@@ -36,7 +36,7 @@ module Analysis : sig
; ;
value checkpoints : t -> string value checkpoints : t -> string
; ;
value nb_sols : t -> Num.num value nb_sols : t -> int (* Num.num *)
; ;
end end
; ;
......
...@@ -528,7 +528,7 @@ value segment_chunk (full,count) chunk last = ...@@ -528,7 +528,7 @@ value segment_chunk (full,count) chunk last =
; set_offset (succ extremity,future) ; set_offset (succ extremity,future)
; if segmentable then do ; if segmentable then do
{ reset_counter () { reset_counter ()
; (full,Num.mult_num count (Num.Int local_count)) ; (full,count*local_count) (* overflow may compute modulo *)
(* we have [local_count] segmentations of the local [chunk], and, (* we have [local_count] segmentations of the local [chunk], and,
chunks being independent, the total number of solutions multiply *) chunks being independent, the total number of solutions multiply *)
} }
...@@ -536,8 +536,8 @@ value segment_chunk (full,count) chunk last = ...@@ -536,8 +536,8 @@ value segment_chunk (full,count) chunk last =
} }
} }
; ;
value segment_iter chunks = segment_chunks (True,Num.Int 1) chunks value segment_iter chunks = segment_chunks (True,1) chunks
where rec segment_chunks acc = fun (* terminal recursion *) where rec segment_chunks acc = fun (* terminal recursion *)
[ [ (* last *) chunk ] -> segment_chunk acc chunk True [ [ (* last *) chunk ] -> segment_chunk acc chunk True
| [ chunk :: rest ] -> segment_chunks (segment_chunk acc chunk False) rest | [ chunk :: rest ] -> segment_chunks (segment_chunk acc chunk False) rest
| [] -> acc | [] -> acc
......
...@@ -392,10 +392,7 @@ value invoke_SL text cpts corpus_id count sent_id link_num = ...@@ -392,10 +392,7 @@ value invoke_SL text cpts corpus_id count sent_id link_num =
ps (td_wrap (call_SL text cpts "t" corpus_id count sent_id link_num ps (td_wrap (call_SL text cpts "t" corpus_id count sent_id link_num
^ "Sanskrit Library Interface")) ^ "Sanskrit Library Interface"))
; ;
value update_text_with_sol text count = text ^ ";allSol=" ^ match count with value update_text_with_sol text count = text ^ ";allSol=" ^ string_of_int count
[ Num.Int n -> string_of_int n
| _ -> "2147483648" (* [2^31] *)
]
; ;
value call_undo text cpts = value call_undo text cpts =
let string_pts = match cpts with let string_pts = match cpts with
...@@ -435,22 +432,19 @@ value check_sentence translit us text_orig checkpoints sentence ...@@ -435,22 +432,19 @@ value check_sentence translit us text_orig checkpoints sentence
if scl_toggle then if scl_toggle then
td_wrap (call_reader text cpts "o" ^ "UoH Analysis Mode") |> ps td_wrap (call_reader text cpts "o" ^ "UoH Analysis Mode") |> ps
else () (* [scl_parser] is not visible unless toggle is set *) in else () (* [scl_parser] is not visible unless toggle is set *) in
match count with if count > max_count then
[ Num.Int n -> if n > max_count then (* too many solutions would choke the parsers *)
(* too many solutions would choke the parsers *) td_wrap ("(" ^ string_of_int count ^ " Solutions)") |> ps
td_wrap ("(" ^ string_of_int n ^ " Solutions)") |> ps else if count=1 (* Unique remaining solution *) then do
else if n=1 (* Unique remaining solution *) then do { td_wrap (call_parser text cpts ^ "Unique Solution") |> ps
{ td_wrap (call_parser text cpts ^ "Unique Solution") |> ps ; call_scl_parser 1
; call_scl_parser 1 }
} else do
else do
{ td_wrap (call_reader text cpts "p" ^ "Filtered Solutions") |> ps { td_wrap (call_reader text cpts "p" ^ "Filtered Solutions") |> ps
; let info = string_of_int n ^ if full then "" else " Partial" in ; let info = string_of_int count ^ if full then "" else " Partial" in
td_wrap (call_reader text cpts "t" ^ "All " ^ info ^ " Solutions") |> ps td_wrap (call_reader text cpts "t" ^ "All " ^ info ^ " Solutions") |> ps
; call_scl_parser n ; call_scl_parser count
} }
| _ -> td_wrap "(More than 2^32 Solutions!)" |> ps
]
; tr_end |> pl (* tr end *) ; tr_end |> pl (* tr end *)
; table_end |> pl ; table_end |> pl
; div_end |> ps (* Latin16 *) ; div_end |> ps (* Latin16 *)
...@@ -510,8 +504,8 @@ value save_button query nb_sols = ...@@ -510,8 +504,8 @@ value save_button query nb_sols =
center_begin ^ center_begin ^
cgi_begin save_corpus_cgi "" ^ cgi_begin save_corpus_cgi "" ^
hidden_input Save_corpus_params.state (escape query) ^ hidden_input Save_corpus_params.state (escape query) ^
hidden_input Save_corpus_params.nb_sols (nb_sols |> Num.string_of_num |> escape) ^ hidden_input Save_corpus_params.nb_sols (nb_sols |> string_of_int |> escape) ^
submit_input "Save" ^ submit_input "Save" ^
cgi_end ^ cgi_end ^
center_end center_end
; ;
...@@ -637,8 +631,8 @@ value graph_engine () = do ...@@ -637,8 +631,8 @@ value graph_engine () = do
; if corpus_permission = Web_corpus.Annotator then ; if corpus_permission = Web_corpus.Annotator then
(* TODO: use [segment_iter] to compute the nb of sols instead of (* TODO: use [segment_iter] to compute the nb of sols instead of
passing 0 to [nb_sols]. *) passing 0 to [nb_sols]. *)
save_button query (Num.num_of_int 0) |> pl save_button query 0 |> pl
else () else ()
; html_break |> pl ; html_break |> pl
(* Quit button: continue reading (reader mode) (* Quit button: continue reading (reader mode)
or quit without saving (annotator mode) *) or quit without saving (annotator mode) *)
......
...@@ -103,8 +103,8 @@ value insert ((pen,min),sol) ((min_pen,sols,saved) as current) = ...@@ -103,8 +103,8 @@ value insert ((pen,min),sol) ((min_pen,sols,saved) as current) =
let rescue = List.fold_right save sols [] in let rescue = List.fold_right save sols [] in
if rescue=[] then saved else [ (min_pen,rescue) :: saved ] if rescue=[] then saved else [ (min_pen,rescue) :: saved ]
; ;
(* Forget absolute penalties of solutions with minimal length penalty *) (* Forget absolute penalties of solutions with minimal length penalty. *)
(* also used to erase constraints - thus do not eta-reduce !!! *) (* Also used to erase constraints - thus do not eta-reduce !!! *)
value trim x = List.map snd x value trim x = List.map snd x
; ;
(* overflow is None or (Some n) when n solutions with n<Web.truncation *) (* overflow is None or (Some n) when n solutions with n<Web.truncation *)
......
...@@ -62,7 +62,7 @@ value analysis_of_env env = ...@@ -62,7 +62,7 @@ value analysis_of_env env =
let nb_sols = let nb_sols =
env env
|> Cgi.decoded_get Save_corpus_params.nb_sols "0" |> Cgi.decoded_get Save_corpus_params.nb_sols "0"
|> Num.num_of_string |> int_of_string
in in
Corpus.Analysis.make Corpus.Analyzer.Graph lang cpts nb_sols Corpus.Analysis.make Corpus.Analyzer.Graph lang cpts nb_sols
; ;
......
...@@ -8,4 +8,4 @@ ...@@ -8,4 +8,4 @@
(**************************************************************************) (**************************************************************************)
(* Generated by make version - see main Makefile *) (* Generated by make version - see main Makefile *)
value version="3.08" and version_date="2018-08-29"; value version="3.09" and version_date="2018-09-09";
...@@ -16,16 +16,21 @@ install the site. ...@@ -16,16 +16,21 @@ install the site.
Installation assumes prior installation of Objective Caml available Installation assumes prior installation of Objective Caml available
from site http://ocaml.org. The distribution version from site http://ocaml.org. The distribution version
4.02 ought to be used, available at"http://ocaml.org/releases/4.02.html". 4.07 ought to be used, available at "http://ocaml.org/releases/".
More recent distributions may work too, but this has not been tested.
The proper sequence of commands is: The proper sequence of commands is:
./configure ./configure
make world.opt make world.opt
sudo make install sudo make install
Then install Camlp4 from GitHub, in the 4.02 branch, available from Then install package Ocamlbuild from https://github.com/ocaml/ocamlbuild/releases
https://github.com/ocaml/camlp4/releases; take for instance 4.02+6. for instance OCamlbuild 0.12.0:
make configure
make
make install
Then install Camlp4 from GitHub, in the 4.07 branch, available from
https://github.com/ocaml/camlp4/releases; take for instance 4.07+1.
This should be installed by: This should be installed by:
./configure ./configure
make all make all
......
VERSION='3.08' VERSION='3.09'
DATE='2018-08-29' DATE='2018-09-09'
...@@ -50,7 +50,7 @@ published recently as ...@@ -50,7 +50,7 @@ published recently as
<a href="http://jlm.ipipan.waw.pl/index.php/JLM/article/view/108/140">Design and <a href="http://jlm.ipipan.waw.pl/index.php/JLM/article/view/108/140">Design and
analysis of a lean interface for Sanskrit corpus annotation</a>. analysis of a lean interface for Sanskrit corpus annotation</a>.
<p> <p>
Written on July 22nd 2018, for Sanskrit Engine Version 3.08. Written on September 9th 2018, for Sanskrit Engine Version 3.09.
<h2 class="b2" id="tour">First approach to using the Sanskrit Heritage engine</h2> <h2 class="b2" id="tour">First approach to using the Sanskrit Heritage engine</h2>
...@@ -264,7 +264,7 @@ The Sanskrit Heritage Dictionary is the latest edition of a Sanskrit ...@@ -264,7 +264,7 @@ The Sanskrit Heritage Dictionary is the latest edition of a Sanskrit
to French Dictionary to French Dictionary
"Dictionnaire Français de l'H&eacute;ritage Sanskrit" compiled by "Dictionnaire Français de l'H&eacute;ritage Sanskrit" compiled by
G&eacute;rard Huet since 1994. This dictionary is freely available G&eacute;rard Huet since 1994. This dictionary is freely available
as a 936 pages <a href="Heritage.pdf">book</a> under the pdf format, as a 945 pages <a href="Heritage.pdf">book</a> under the pdf format,
easily readable with Acrobat Reader, a free Adobe product. easily readable with Acrobat Reader, a free Adobe product.
This dictionary is still under development, and is This dictionary is still under development, and is
automatically updated along with the site, automatically updated along with the site,
...@@ -489,7 +489,7 @@ Thus at best this representation is some approximation of syntax. ...@@ -489,7 +489,7 @@ Thus at best this representation is some approximation of syntax.
Below the three columns you find a button labeled Submit. You may press it Below the three columns you find a button labeled Submit. You may press it
to validate the morphological choices, and the resulting page gives you to validate the morphological choices, and the resulting page gives you
a unique parse as a hypertext <i>padapāṭha</i> which you may save in user space. a unique parse as a hypertext <i>padapāṭha</i> which you may save in user space.
<!-- <!-- Deprecated
Actually, if you install the software on your own workstation, by configuring it Actually, if you install the software on your own workstation, by configuring it
in mode Station you will have in the page a Validate button in mode Station you will have in the page a Validate button
usable to record this solution in a non-regression suite. --> usable to record this solution in a non-regression suite. -->
...@@ -867,7 +867,7 @@ first verse should not be glued by sandhi to the second one. ...@@ -867,7 +867,7 @@ first verse should not be glued by sandhi to the second one.
preserving the current mode, you can click on the title of any page of preserving the current mode, you can click on the title of any page of
the corpus browser. the corpus browser.
<!-- Undocumented <!-- Deprecated
<h2 class="b2" id="regression">Regression analysis</h2> <h2 class="b2" id="regression">Regression analysis</h2>
If you install If you install
......
...@@ -227,7 +227,9 @@ Metrically Restored Text by Karen Thomson and Jonathan Slocum</a><br> ...@@ -227,7 +227,9 @@ Metrically Restored Text by Karen Thomson and Jonathan Slocum</a><br>
<a href="http://www.unipune.ac.in/dept/fine_arts/centre_for_advanced_study_in_sanskrit/default.htm">Centre of Advanced Study of Sanskrit, Pune University</a><br> <a href="http://www.unipune.ac.in/dept/fine_arts/centre_for_advanced_study_in_sanskrit/default.htm">Centre of Advanced Study of Sanskrit, Pune University</a><br>
<!-- OBS <a href="http://www.unipune.ernet.in/dept/sanskrit/welcome.html">Department of Sanskrit and Prakrit Languages, Pune University</a><br> --> <!-- OBS <a href="http://www.unipune.ernet.in/dept/sanskrit/welcome.html">Department of Sanskrit and Prakrit Languages, Pune University</a><br> -->
<a href="http://www.unipune.ac.in/dept/fine_arts/sanskrit_and_pakrit/default.htm">Department of Sanskrit and Prakrit Languages, Pune University</a><br> <a href="http://www.unipune.ac.in/dept/fine_arts/sanskrit_and_pakrit/default.htm">Department of Sanskrit and Prakrit Languages, Pune University</a><br>
<a href="http://sanskrit.uohyd.ernet.in/">Department of Sanskrit Studies, University of Hyderabad</a><br> <!-- ernet obsolete
<a href="http://sanskrit.uohyd.ernet.in/">Department of Sanskrit Studies, University of Hyderabad</a><br>-->
<a href="http://sanskrit.uohyd.ac.in/">Department of Sanskrit Studies, University of Hyderabad</a><br>
<a href="http://www.bhu.ac.in/Sanskrit/">Department of Sanskrit, Faculty of <a href="http://www.bhu.ac.in/Sanskrit/">Department of Sanskrit, Faculty of
Arts, Banaras Hindu University, Varanasi</a><br> Arts, Banaras Hindu University, Varanasi</a><br>
<a href="http://ignca.nic.in/welcome.html">Kalakosa, Indira Gandhi National Center for the Arts</a><br> <a href="http://ignca.nic.in/welcome.html">Kalakosa, Indira Gandhi National Center for the Arts</a><br>
...@@ -240,9 +242,11 @@ Arts, Banaras Hindu University, Varanasi</a><br> ...@@ -240,9 +242,11 @@ Arts, Banaras Hindu University, Varanasi</a><br>
<!-- obsolete <a href="http://www.jnu.ac.in/Academics/SpecialCentres/Sanskrit/index.html">Center for Sanskrit Studies, J.N.U., New Delhi</a><br> --> <!-- obsolete <a href="http://www.jnu.ac.in/Academics/SpecialCentres/Sanskrit/index.html">Center for Sanskrit Studies, J.N.U., New Delhi</a><br> -->
<a href="http://sanskrit.jnu.ac.in/index.jsp">Special Center for Sanskrit Studies, Jawaharal Nehru University, New Delhi</a><br> <a href="http://sanskrit.jnu.ac.in/index.jsp">Special Center for Sanskrit Studies, Jawaharal Nehru University, New Delhi</a><br>
<a href="http://www.cfilt.iitb.ac.in/">Center for Indian Language <a href="http://www.cfilt.iitb.ac.in/">Center for Indian Language
Technology, Indian Institute of Technology, Bombay</a><br> Technology, Indian Institute of Technology, Bombay</a><br>-->
<a href="http://www.indiaeducation.ernet.in/insitutions/PROFILENEW.ASP?no=U01763">Lal Bahadur Shastri Rashtriya Sanskrit Vidyapeetha, Delhi</a><br> <!-- obsolete<a href="http://www.indiaeducation.ernet.in/insitutions/PROFILENEW.ASP?no=U01763">Lal Bahadur Shastri Rashtriya Sanskrit Vidyapeetha, Delhi</a><br>-->
<a href="http://www.sanskrituni.net/">Kavikulguru Kalidas Sanskrit University, Ramtek, Maharashtra</a><br> <a href="http://www.slbsrsv.ac.in/home.asp">Lal Bahadur Shastri Rashtriya Sanskrit Vidyapeetha, Delhi</a><br>-->
<!-- obsolete <a href="http://www.sanskrituni.net/">Kavikulguru Kalidas Sanskrit University, Ramtek, Maharashtra</a><br>-->
<a href="http://kksanskrituni.digitaluniversity.ac">Kavikulguru Kalidas Sanskrit University, Ramtek, Maharashtra</a>
<a href="http://mpsvvujjain.org/">Panini Sanskrit University, Ujjain</a><br> <a href="http://mpsvvujjain.org/">Panini Sanskrit University, Ujjain</a><br>
<a href="http://www.shadvala.de/en/center/">Shadvala Center for Sanskrit Studies, Goa</a><br> <a href="http://www.shadvala.de/en/center/">Shadvala Center for Sanskrit Studies, Goa</a><br>
<!-- obsolete <a href="http://www.education.nic.in/htmlweb/prolan.htm">Indian Government Policy on Languages Development</a><br> --> <!-- obsolete <a href="http://www.education.nic.in/htmlweb/prolan.htm">Indian Government Policy on Languages Development</a><br> -->
...@@ -585,7 +589,8 @@ at Maharishi University of Management</a><br> ...@@ -585,7 +589,8 @@ at Maharishi University of Management</a><br>
<a href="http://www.mpg.de/english/aboutTheSociety/aboutUs/scientificAwards/awardsOfMPS/MPResearchAward/mpfp2000/wezler_albrecht/index.html">Albrecht Wezler's citation for Max Planck Research Award for Humanities</a><br>