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
L
libcaml-grew
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
3
Issues
3
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
grew
libcaml-grew
Commits
13493b75
Commit
13493b75
authored
Mar 13, 2019
by
Bruno Guillaume
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
add to_orfeo function
parent
eff8c0ee
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
41 additions
and
0 deletions
+41
-0
src/grew_graph.ml
src/grew_graph.ml
+33
-0
src/grew_graph.mli
src/grew_graph.mli
+1
-0
src/libgrew.ml
src/libgrew.ml
+6
-0
src/libgrew.mli
src/libgrew.mli
+1
-0
No files found.
src/grew_graph.ml
View file @
13493b75
...
...
@@ -922,6 +922,39 @@ module G_graph = struct
Sentence
.
fr_clean_spaces
(
loop
None
snodes
)
let
start_dur
gnode
=
let
fs
=
G_node
.
get_fs
gnode
in
match
(
G_fs
.
get_string_atom
"_start"
fs
,
G_fs
.
get_string_atom
"_stop"
fs
)
with
(
Some
_start
,
Some
_stop
)
->
let
start
=
float_of_string
_start
and
stop
=
float_of_string
_stop
in
(
start
,
stop
-.
start
)
|
_
->
(
-
1
.,
-
1
.
)
let
to_orfeo
?
(
deco
=
G_deco
.
empty
)
graph
=
let
is_highlighted_gid
gid
=
List
.
mem_assoc
gid
deco
.
nodes
in
let
nodes
=
Gid_map
.
fold
(
fun
id
elt
acc
->
(
id
,
elt
)
::
acc
)
graph
.
map
[]
in
let
snodes
=
List
.
sort
(
fun
(
_
,
n1
)
(
_
,
n2
)
->
G_node
.
position_comp
n1
n2
)
nodes
in
let
buff
=
Buffer
.
create
32
in
CCList
.
iteri
(
fun
i
(
gid
,
gnode
)
->
match
G_fs
.
to_word
(
G_node
.
get_fs
gnode
)
with
|
None
->
()
|
Some
word
->
let
(
start
,
dur
)
=
start_dur
gnode
in
Printf
.
bprintf
buff
"<span id=
\"
tok%d
\"
data-dur=
\"
%g
\"
data-begin=
\"
%g
\"
tabindex=
\"
0
\"
data-index=
\"
%d
\"
%s%s>%s </span>"
i
dur
start
i
(
if
i
=
1
then
"class=
\"
speaking highlight
\"
"
else
""
)
(
if
is_highlighted_gid
gid
then
"class=
\"
highlight
\"
"
else
""
)
word
)
snodes
;
Buffer
.
contents
buff
(* -------------------------------------------------------------------------------- *)
let
is_non_lexical_node
node
=
let
fs
=
G_node
.
get_fs
node
in
G_fs
.
get_string_atom
"kind"
fs
<>
None
...
...
src/grew_graph.mli
View file @
13493b75
...
...
@@ -203,6 +203,7 @@ module G_graph: sig
val
to_gr
:
t
->
string
val
to_dot
:
?
main_feat
:
string
->
?
get_url
:
(
string
->
string
option
)
->
?
deco
:
G_deco
.
t
->
t
->
string
val
to_sentence
:
?
only_pivot
:
bool
->
?
main_feat
:
string
->
?
deco
:
G_deco
.
t
->
t
->
string
val
to_orfeo
:
?
deco
:
G_deco
.
t
->
t
->
string
val
to_dep
:
?
filter
:
(
string
->
bool
)
->
?
main_feat
:
string
->
?
deco
:
G_deco
.
t
->
t
->
string
val
to_conll
:
t
->
Conll
.
t
val
to_conll_string
:
?
cupt
:
bool
->
t
->
string
...
...
src/libgrew.ml
View file @
13493b75
...
...
@@ -229,6 +229,12 @@ module Graph = struct
Grew_graph
.
G_graph
.
to_sentence
?
only_pivot
?
main_feat
?
deco
gr
)
()
let
to_orfeo
?
deco
gr
=
Libgrew
.
handle
~
name
:
"Graph.to_orfeo"
(
fun
()
->
Grew_graph
.
G_graph
.
to_orfeo
?
deco
gr
)
()
let
save_conll
filename
graph
=
Libgrew
.
handle
~
name
:
"Graph.save_conll"
(
fun
()
->
let
out_ch
=
open_out
filename
in
...
...
src/libgrew.mli
View file @
13493b75
...
...
@@ -98,6 +98,7 @@ module Graph : sig
val
sentence_of_pst
:
?
domain
:
Domain
.
t
->
string
->
string
val
to_sentence
:
?
only_pivot
:
bool
->
?
main_feat
:
string
->
?
deco
:
Deco
.
t
->
t
->
string
val
to_orfeo
:
?
deco
:
Deco
.
t
->
t
->
string
val
to_dot
:
?
main_feat
:
string
->
?
deco
:
Deco
.
t
->
?
get_url
:
(
string
->
string
option
)
->
t
->
string
...
...
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