diff --git a/maca_common/src/word.c b/maca_common/src/word.c index 8cc623cdcd6eb57168311c6009fb1fd33856d400..b2c4aa67fc657209a925b23e2a6f67ff513cef0e 100644 --- a/maca_common/src/word.c +++ b/maca_common/src/word.c @@ -27,15 +27,14 @@ word *word_new(char *input) word *word_read(FILE *f, mcd *mcd_struct) { char buffer[10000]; - if(feof(f)) return NULL; /* no more words to read */ /* look for a valid word */ while(fgets(buffer, 10000, f)){ - if(feof(f)) return NULL; /* no more words to read */ - if((buffer[0] != '\n') && (buffer[0] != ' ')){ - /* printf("word = %s\n", buffer); */ - return word_parse_buffer(buffer, mcd_struct); - } + /* ignore empty lines */ + if((buffer[0] == '\n')) continue; + /* lines beginning with ## are comments */ + if((buffer[0] == '#') && (buffer[1] == '#')) continue; + return word_parse_buffer(buffer, mcd_struct); } return NULL; } @@ -69,6 +68,8 @@ word *word_parse_buffer(char *buffer, mcd *mcd_struct) } +/* out of date, must be updated */ + word *word_copy(word *w) { word *copy = word_new(w->input); @@ -109,10 +110,7 @@ word *word_create_dummy(mcd *mcd_struct) void word_print2(FILE *f, word *w) { - int i; if(w == NULL) return; - - if(w->input) fprintf(f, "%s\t", w->input); printf("form = %d\t", word_get_form(w)); @@ -120,24 +118,13 @@ void word_print2(FILE *f, word *w) printf("pos = %d\t", word_get_pos(w)); printf("index = %d\t", word_get_index(w)); printf("rel index = %d\n", word_get_relative_index(w)); - - /* - - if(dico_labels) - fprintf(f, "\t%s", dico_int2string(dico_labels, w->label)); - else - fprintf(f, "\t%d", word_get_label(w));*/ } void word_print(FILE *f, word *w, mcd *mcd_struct, dico *dico_labels) { - int i; if(w == NULL) return; - - fprintf(f, "%s", w->input); - } int word_is_eos(word *w, mcd *mcd_struct) diff --git a/maca_lemmatizer/src/context.c b/maca_lemmatizer/src/context.c index f83fae202924839b01dfd29b86f787a963cc81b9..81daf46f5a6215a04283ea641851d8d253282343 100644 --- a/maca_lemmatizer/src/context.c +++ b/maca_lemmatizer/src/context.c @@ -110,10 +110,10 @@ context *context_read_options(int argc, char *argv[]) ctx->verbose = 1; break; case 'F': - ctx->form_column = atoi(optarg); + ctx->form_column = atoi(optarg) - 1; break; case 'P': - ctx->pos_column = atoi(optarg); + ctx->pos_column = atoi(optarg) - 1; break; case 'f': ctx->fplm_filename = strdup(optarg); diff --git a/maca_trans_parser/src/depset.c b/maca_trans_parser/src/depset.c index c7f5cfe8f4b5989f75a60386323acb09a8da6e4e..ee7f0fdaf77a51892ab28ac9143dbf1c0c313ccf 100644 --- a/maca_trans_parser/src/depset.c +++ b/maca_trans_parser/src/depset.c @@ -74,21 +74,16 @@ void depset_print(FILE *f, depset *d) void depset_print2(FILE *f, depset *d, dico *dico_labels) { int i; - int root_code = dico_string2int(dico_labels, "root"); int distance; for(i=1; i < d->length; i++){ if((d->array[i].gov) && (d->array[i].dep)){ - /* if(d->array[i].label == root_code) */ - /* fprintf(f, "%s\t%d\t%s\n", d->array[i].dep->input, 0, dico_int2string(dico_labels, d->array[i].label)); */ - /* else{ */ distance = word_get_relative_index(d->array[i].gov) - word_get_relative_index(d->array[i].dep); fprintf(f, "%s\t%d\t%s\n", d->array[i].dep->input, distance, dico_int2string(dico_labels, d->array[i].label)); - /* } */ } } } - +/* void depset_print3(FILE *f, depset *d, dico *dico_labels) { int i; @@ -106,6 +101,7 @@ void depset_print3(FILE *f, depset *d, dico *dico_labels) } } } +*/ char *skip_index(char *buffer) { diff --git a/maca_trans_parser/src/simple_decoder_parser.c b/maca_trans_parser/src/simple_decoder_parser.c index 947844110733187602ffb58612515b5fa4e9184d..f803a8105a6ee189c14249abe2c010ee1ff6c61b 100644 --- a/maca_trans_parser/src/simple_decoder_parser.c +++ b/maca_trans_parser/src/simple_decoder_parser.c @@ -92,10 +92,7 @@ void simple_decoder_stream(context *ctx, FILE *f, feature_table *ft, int root_la /* config_connect_subtrees(c, root_label); */ /* depset_print_new_index(stdout, c->ds, ctx->dico_labels); */ - if(ctx->mcd_struct->wf2col[MCD_WF_INDEX] == -1) - depset_print3(stdout, c->ds, ctx->dico_labels); - else - depset_print2(stdout, c->ds, ctx->dico_labels); + depset_print2(stdout, c->ds, ctx->dico_labels); /* pop the dummy word */ stack_pop(c->st); @@ -124,17 +121,9 @@ void simple_decoder_stream(context *ctx, FILE *f, feature_table *ft, int root_la /* config_print(stdout, c); */ - /* config_connect_subtrees(c, root_label); */ + /* config_connect_subtrees(c, root_label); */ - - if(ctx->mcd_struct->wf2col[MCD_WF_INDEX] == -1) - depset_print3(stdout, c->ds, ctx->dico_labels); - else - depset_print2(stdout, c->ds, ctx->dico_labels); - - - - /* depset_print_new_index(stdout, c->ds, ctx->dico_labels); */ + depset_print2(stdout, c->ds, ctx->dico_labels); /* config_free(c); */