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
4706ec1d
Commit
4706ec1d
authored
7 years ago
by
Alexis Nasr
Browse files
Options
Downloads
Patches
Plain Diff
minor changes in mcf2json, the root dependency has -1 as a governor
parent
723cafa9
No related branches found
No related tags found
No related merge requests found
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
maca_common/src/dico.c
+2
-1
2 additions, 1 deletion
maca_common/src/dico.c
maca_tools/src/json2mcf.c
+8
-4
8 additions, 4 deletions
maca_tools/src/json2mcf.c
maca_tools/src/mcf2json.c
+5
-5
5 additions, 5 deletions
maca_tools/src/mcf2json.c
with
15 additions
and
10 deletions
maca_common/src/dico.c
+
2
−
1
View file @
4706ec1d
...
@@ -153,6 +153,7 @@ dico *dico_extract_from_corpus(char *filename, int column, char *dico_name)
...
@@ -153,6 +153,7 @@ dico *dico_extract_from_corpus(char *filename, int column, char *dico_name)
char
*
token
;
char
*
token
;
int
column_nb
=
0
;
int
column_nb
=
0
;
if
(
feof
(
f
))
return
NULL
;
/* no more words to read */
if
(
feof
(
f
))
return
NULL
;
/* no more words to read */
while
(
fgets
(
buffer
,
10000
,
f
)){
while
(
fgets
(
buffer
,
10000
,
f
)){
...
@@ -164,7 +165,7 @@ dico *dico_extract_from_corpus(char *filename, int column, char *dico_name)
...
@@ -164,7 +165,7 @@ dico *dico_extract_from_corpus(char *filename, int column, char *dico_name)
column_nb
=
0
;
column_nb
=
0
;
do
{
do
{
if
(
column_nb
==
column
){
if
(
column_nb
==
column
){
/
*
printf("token = %s\n", token);
*/
/
/
printf("token = %s\n", token);
dico_add
(
d
,
token
);
dico_add
(
d
,
token
);
}
}
column_nb
++
;
column_nb
++
;
...
...
This diff is collapsed.
Click to expand it.
maca_tools/src/json2mcf.c
+
8
−
4
View file @
4706ec1d
...
@@ -232,14 +232,18 @@ void update_segment(word_buffer *wb, int start, int end, char *label, char *stat
...
@@ -232,14 +232,18 @@ void update_segment(word_buffer *wb, int start, int end, char *label, char *stat
{
{
int
index
;
int
index
;
word
*
w
;
word
*
w
;
int
label_code
;
int
label_code
=
-
1
;
dico
*
d
;
dico
*
d
;
mcd
*
mcd_struct
=
NULL
;
if
(
status_lab
&&
!
strcmp
(
status_lab
,
"GOLD"
)){
mcd_struct
=
word_buffer_get_mcd
(
wb
);
printf
(
"updating label of segment [%d-%d] with
\"
%s
\"\n
"
,
start
,
end
,
label
);
d
=
mcd_struct
->
dico_array
[
mcd_get_pos_col
(
mcd_struct
)];
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
(
wb
,
start
);
w
=
word_buffer_get_word_n
(
wb
,
index
);
w
=
word_buffer_get_word_n
(
wb
,
index
);
d
=
word_buffer_get_mcd
(
wb
)
->
dico_array
[
MCD_WF_CPOS
];
if
(
d
)
if
(
d
)
label_code
=
dico_string2int
(
d
,
label
);
label_code
=
dico_string2int
(
d
,
label
);
if
(
label_code
==
-
1
)
if
(
label_code
==
-
1
)
...
...
This diff is collapsed.
Click to expand it.
maca_tools/src/mcf2json.c
+
5
−
5
View file @
4706ec1d
...
@@ -176,7 +176,7 @@ void print_header(FILE *output_file, mcd *mcd_struct, char *filename)
...
@@ -176,7 +176,7 @@ void print_header(FILE *output_file, mcd *mcd_struct, char *filename)
}
}
void
print_link
(
FILE
*
output_file
,
word_buffer
*
wb
,
int
index
)
void
print_link
(
FILE
*
output_file
,
word_buffer
*
wb
,
int
index_first_word
,
int
index
)
{
{
int
gov_col
=
mcd_get_gov_col
(
word_buffer_get_mcd
(
wb
));
int
gov_col
=
mcd_get_gov_col
(
word_buffer_get_mcd
(
wb
));
int
label_col
=
mcd_get_label_col
(
word_buffer_get_mcd
(
wb
));
int
label_col
=
mcd_get_label_col
(
word_buffer_get_mcd
(
wb
));
...
@@ -186,15 +186,15 @@ void print_link(FILE *output_file, word_buffer *wb, int index)
...
@@ -186,15 +186,15 @@ void print_link(FILE *output_file, word_buffer *wb, int index)
fprintf
(
output_file
,
"{"
);
fprintf
(
output_file
,
"{"
);
// fprintf(output_file, "\"orig\": %d, ", word_get_offset(w));
// fprintf(output_file, "\"orig\": %d, ", word_get_offset(w));
fprintf
(
output_file
,
"
\"
orig
\"
: %d, "
,
index
);
fprintf
(
output_file
,
"
\"
orig
\"
: %d, "
,
index
-
index_first_word
);
fprintf
(
output_file
,
"
\"
dest
\"
:"
);
fprintf
(
output_file
,
"
\"
dest
\"
:"
);
if
(
gov_col
){
if
(
gov_col
){
if
((
word_get_gov
(
w
)
==
0
)
||
((
word_get_gov
(
w
)
+
index
)
<
0
))
if
((
word_get_gov
(
w
)
==
0
)
||
((
word_get_gov
(
w
)
+
index
)
<
0
))
fprintf
(
output_file
,
"
0
"
);
fprintf
(
output_file
,
"
-1
"
);
else
{
else
{
word
*
gov
=
word_buffer_get_word_n
(
wb
,
word_get_gov
(
w
)
+
index
);
word
*
gov
=
word_buffer_get_word_n
(
wb
,
word_get_gov
(
w
)
+
index
);
// fprintf(output_file, "%d", word_get_offset(gov));
// fprintf(output_file, "%d", word_get_offset(gov));
fprintf
(
output_file
,
"%d"
,
word_get_gov
(
w
)
+
index
);
fprintf
(
output_file
,
"%d"
,
word_get_gov
(
w
)
+
index
-
index_first_word
);
}
}
}
}
else
else
...
@@ -228,7 +228,7 @@ void print_links(FILE *output_file, word_buffer *wb, int index_first_word, int i
...
@@ -228,7 +228,7 @@ void print_links(FILE *output_file, word_buffer *wb, int index_first_word, int i
for
(
index
=
index_first_word
;
index
<=
index_last_word
;
index
++
){
for
(
index
=
index_first_word
;
index
<=
index_last_word
;
index
++
){
if
(
first_link
==
1
)
first_link
=
0
;
else
fprintf
(
output_file
,
","
);
if
(
first_link
==
1
)
first_link
=
0
;
else
fprintf
(
output_file
,
","
);
fprintf
(
output_file
,
"
\n
"
);
fprintf
(
output_file
,
"
\n
"
);
print_link
(
output_file
,
wb
,
index
);
print_link
(
output_file
,
wb
,
index_first_word
,
index
);
}
}
fprintf
(
output_file
,
" ]"
);
fprintf
(
output_file
,
" ]"
);
}
}
...
...
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