Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
H
Heritage_Platform
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Service Desk
Milestones
Merge Requests
0
Merge Requests
0
Operations
Operations
Incidents
Packages & Registries
Packages & Registries
Container Registry
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Gérard Huet
Heritage_Platform
Commits
41c4387f
Commit
41c4387f
authored
May 21, 2017
by
Gérard Huet
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fixed path problem for UoH interface
parent
d3580e73
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
9 additions
and
74 deletions
+9
-74
ML/reader.ml
ML/reader.ml
+4
-12
ML/uoh_interface.ml
ML/uoh_interface.ml
+5
-62
No files found.
ML/reader.ml
View file @
41c4387f
...
...
@@ -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 *)
...
...
ML/uoh_interface.ml
View file @
41c4387f
...
...
@@ -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
;
p
rint_string
"<form name=
\"
word-order
\"
method=
\"
get
\"
action =
\"
http://localhost/cgi-bin/scl/SHMT/prog/Word_order/call_heritage2anu.cgi
\"
>
"
;
print_newline
;
p
rint_string
"<table>"
;
p
s
(
"<form name=
\"
word-order
\"
method=
\"
get
\"
action =
\"
"
^
svg_interface_url
^
"prog/Word_order/call_heritage2anu.cgi
\"
>
\n
"
)
;
p
s
"<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
;
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment