Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
M
macaon2
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Container registry
Model registry
Operate
Environments
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Alexis Nasr
macaon2
Commits
3e35914b
Commit
3e35914b
authored
7 years ago
by
Alexis Nasr
Browse files
Options
Downloads
Plain Diff
Merge branch 'master' of gitlab.lis-lab.fr:alexis.nasr/macaon2
parents
91721019
b4b15f51
No related branches found
No related tags found
No related merge requests found
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
maca_common/include/word_buffer.h
+1
-1
1 addition, 1 deletion
maca_common/include/word_buffer.h
maca_common/src/word_buffer.c
+2
-2
2 additions, 2 deletions
maca_common/src/word_buffer.c
maca_tools/src/json2mcf.c
+39
-2
39 additions, 2 deletions
maca_tools/src/json2mcf.c
with
42 additions
and
5 deletions
maca_common/include/word_buffer.h
+
1
−
1
View file @
3e35914b
...
...
@@ -54,7 +54,7 @@ void word_buffer_print(FILE *f, word_buffer *wb);
void
word_buffer_print_compact
(
FILE
*
f
,
word_buffer
*
wb
);
int
word_buffer_read_sentence
(
word_buffer
*
bw
);
word_buffer
*
word_buffer_load_mcf
(
char
*
mcf_filename
,
mcd
*
mcd_struct
);
int
word_buffer_locate_token
(
word_buffer
*
wb
,
int
offset
);
int
word_buffer_locate_token
_with_offset
(
word_buffer
*
wb
,
int
offset
);
/*
int word_buffer_is_empty(word_buffer *wb);
int word_buffer_is_last(word_buffer *wb);
...
...
This diff is collapsed.
Click to expand it.
maca_common/src/word_buffer.c
+
2
−
2
View file @
3e35914b
...
...
@@ -156,7 +156,7 @@ int word_buffer_read_sentence(word_buffer *wb)
return
wb
->
nbelem
;
}
int
word_buffer_locate_token
(
word_buffer
*
wb
,
int
offset
)
int
word_buffer_locate_token
_with_offset
(
word_buffer
*
wb
,
int
offset
)
{
int
c
,
first
,
last
,
middle
;
word
*
w_middle
;
...
...
@@ -165,7 +165,7 @@ int word_buffer_locate_token(word_buffer *wb, int offset)
middle
=
(
first
+
last
)
/
2
;
while
(
first
<=
last
)
{
// printf("first = %d middle = %d last = %d\n", first, middle, last);
//
printf("first = %d middle = %d last = %d\n", first, middle, last);
w_middle
=
word_buffer_get_word_n
(
wb
,
middle
);
// printf("w middle = %d current offset = %d\n", w_middle, word_get_offset(w_middle));
if
(
word_get_offset
(
w_middle
)
<
offset
)
...
...
This diff is collapsed.
Click to expand it.
maca_tools/src/json2mcf.c
+
39
−
2
View file @
3e35914b
...
...
@@ -241,7 +241,7 @@ void update_segment(word_buffer *wb, int start, int end, char *label, char *stat
if
(
status_lab
&&
!
strcmp
(
status_lab
,
"G"
)){
fprintf
(
stderr
,
"updating label of segment [%d-%d] with
\"
%s
\"\n
"
,
start
,
end
,
label
);
index
=
word_buffer_locate_token
(
wb
,
start
);
index
=
word_buffer_locate_token
_with_offset
(
wb
,
start
);
w
=
word_buffer_get_word_n
(
wb
,
index
);
if
(
d
)
...
...
@@ -283,6 +283,40 @@ void process_segments(json_struct *segments, word_buffer *wb)
// {"orig": 1, "dest":2, "label": "suj", "status_link": "", "status_lab": "", "timestamp": "", "author": "", "target": ""},
void
update_link
(
word_buffer
*
wb
,
int
orig
,
int
dest
,
char
*
label
,
char
*
status_link
,
char
*
status_lab
)
{
int
index
;
word
*
w
;
int
label_code
=
-
1
;
dico
*
d
;
mcd
*
mcd_struct
=
NULL
;
mcd_struct
=
word_buffer_get_mcd
(
wb
);
d
=
mcd_struct
->
dico_array
[
mcd_get_label_col
(
mcd_struct
)];
if
(
status_lab
&&
!
strcmp
(
status_lab
,
"G"
)){
fprintf
(
stderr
,
"updating label of link %d -> %d with
\"
%s
\"\n
"
,
orig
,
dest
,
label
);
index
=
orig
;
w
=
word_buffer_get_word_n
(
wb
,
index
);
if
(
d
)
label_code
=
dico_string2int
(
d
,
label
);
if
(
label_code
==
-
1
)
fprintf
(
stderr
,
"label %s unknown
\n
"
,
label
);
else
word_set_label
(
w
,
label_code
);
}
if
(
status_link
&&
!
strcmp
(
status_link
,
"G"
)){
fprintf
(
stderr
,
"updating governor of token %d with %d
\n
"
,
orig
,
dest
);
index
=
orig
;
w
=
word_buffer_get_word_n
(
wb
,
index
);
word_set_gov
(
w
,
dest
);
}
}
void
process_link
(
json_attr_val
*
avl
,
word_buffer
*
wb
)
{
...
...
@@ -298,7 +332,10 @@ void process_link(json_attr_val *avl, word_buffer *wb)
if
(
!
strcmp
(
av
->
attr
,
"status_link"
)){
status_link
=
av
->
val
->
u
.
string
;
continue
;}
if
(
!
strcmp
(
av
->
attr
,
"status_lab"
)){
status_lab
=
av
->
val
->
u
.
string
;
continue
;}
}
// printf("link : orig = %d dest = %d label = %s status_link = %s status_lab = %s\n", orig, dest, label, status_link, status_lab);
fprintf
(
stderr
,
"link : orig = %d dest = %d label = %s status_link = %s status_lab = %s
\n
"
,
orig
,
dest
,
label
,
status_link
,
status_lab
);
update_link
(
wb
,
orig
,
dest
,
label
,
status_link
,
status_lab
);
}
void
process_links
(
json_struct
*
links
,
word_buffer
*
wb
)
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment