Select Git revision
CITATION.cff
-
Stephane Chavin authoredStephane Chavin authored
simple_decoder_parser_arc_eager.c 7.06 KiB
#include<stdio.h>
#include<stdlib.h>
#include<string.h>
#include<unistd.h>
#include<getopt.h>
#include"context.h"
#include"movement_parser_arc_eager.h"
#include"feat_fct.h"
#include"config2feat_vec.h"
#include"feature_table.h"
#include"dico.h"
void print_word_buffer_old(config *c, dico *dico_labels, mcd *mcd_struct)
{
int i;
word *dep;
char *label;
for(i=0; i < config_get_buffer(c)->nbelem; i++){
dep = word_buffer_get_word_n(config_get_buffer(c), i);
printf("%s\t", word_get_input(dep));
printf("%d\t", word_get_gov(dep));
label = (word_get_label(dep) == -1)? NULL : dico_int2string(dico_labels, word_get_label(dep));
if(label != NULL)
printf("%s\t", label) ;
else
printf("_\t");
if(mcd_get_sent_seg_col(mcd_struct) == -1){
if(word_get_sent_seg(dep) == 1)
printf("1") ;
else
printf("0");
}
printf("\n");
}
}
void print_word_buffer(config *c, context *ctx, dico *dico_labels, mcd *mcd_struct)
{
int i;
word *w;
char *label;
char *buffer = NULL;
char *token = NULL;
int col_nb = 0;
for(i=0; i < config_get_buffer(c)->nbelem; i++){
w = word_buffer_get_word_n(config_get_buffer(c), i);
if((mcd_get_gov_col(mcd_struct) == -1)
&& (mcd_get_label_col(mcd_struct) == -1)
&& (mcd_get_sent_seg_col(mcd_struct) == -1)){
printf("%s\t", word_get_input(w));
printf("%d\t", word_get_gov(w));
label = (word_get_label(w) == -1)? NULL : dico_int2string(dico_labels, word_get_label(w));
if(label != NULL)
printf("%s\t", label) ;
else
printf("_\t");
if(word_get_sent_seg(w) == 1)
printf("1");
else
printf("0");
}
else{
buffer = strdup(w->input);
token = strtok(buffer, "\t");
col_nb = 0;