diff --git a/maca_graph_parser/maca_graph_parser_decoder.c b/maca_graph_parser/maca_graph_parser_decoder.c index 3095550072de85e70f4b0f1eaa2c0a003189e88b..3d76cb3a1c2e31092c88f0b55c4e00e420d299f0 100644 --- a/maca_graph_parser/maca_graph_parser_decoder.c +++ b/maca_graph_parser/maca_graph_parser_decoder.c @@ -69,6 +69,10 @@ void maca_graph_parser_decoder_parse(maca_graph_parser_ctx *ctx, maca_graph_pars fprintf(stderr, "parsing sentence\n"); }*/ + + /* extract features */ + maca_graph_parser_feature_table_fill(ctx, s, ctx->feature_table); + maca_graph_parser_decoder_init(ctx, s); if(ctx->k){ maca_graph_parser_hyperdecoder_parse(ctx, s, ctx->feature_table); diff --git a/maca_graph_parser/maca_graph_parser_model.c b/maca_graph_parser/maca_graph_parser_model.c index 978b47107d0991acf3c076a2ff6774632d277135..b1e3bd6f1f5a66d27078ac2c426b28459cfacd42 100644 --- a/maca_graph_parser/maca_graph_parser_model.c +++ b/maca_graph_parser/maca_graph_parser_model.c @@ -262,6 +262,7 @@ float score_feature_counter_array(feature_counter_array *a, maca_graph_parser_mo if(v != 0){ float *w = recherche_hash(model->feat_ht, c->keys[j]); if(w != NULL){ + /* printf("AN value = %d score = %f\n", v, score); */ score += (v * (*w)); } } diff --git a/maca_graph_parser/maca_graph_parser_train.c b/maca_graph_parser/maca_graph_parser_train.c index 76df607eb6d128d964a931f9bf70c4ce14446a98..dbbdabd5a71f91b8eac3b5211146cf032612960c 100644 --- a/maca_graph_parser/maca_graph_parser_train.c +++ b/maca_graph_parser/maca_graph_parser_train.c @@ -38,9 +38,11 @@ void update_weights(maca_graph_parser_ctx *ctx, maca_graph_parser_sentence *ref_ /* with the projective decoder, this can happen if ref is non-projective */ /* TODO: check that it only happens in this case */ + float score_ref = score_feature_counter_array(ref_feat_cnt_array, ctx->model); float score_hyp = score_feature_counter_array(hyp_feat_cnt_array, ctx->model); - if(score_hyp < score_ref){ + + if(score_hyp < score_ref){ /* baseline strategy: skip update */ return; } diff --git a/maca_tools/src/mcf2conll.c b/maca_tools/src/mcf2conll.c index 1eb8b1a3d49e7c6384597a99b8fa074ce7374d83..272c18105954caed384c5aa23086ec7e203c4813 100644 --- a/maca_tools/src/mcf2conll.c +++ b/maca_tools/src/mcf2conll.c @@ -196,7 +196,7 @@ int main(int argc, char *argv[]) fprintf(output_file, "\t"); /* fprintf(output_file, "\t_\t\n"); */ - fprintf(output_file, "\n"); + fprintf(output_file, "_\t_\n"); if((sent_seg_col) && (word_get_sent_seg(w))){ fprintf(output_file, "\n"); index = 0; diff --git a/maca_trans_parser/src/maca_trans_parser_arc_eager_mcf2cff.c b/maca_trans_parser/src/maca_trans_parser_arc_eager_mcf2cff.c index f0a16c043750ee4fce542f354303dec08332e651..dfca5e53f46d2a8674047e7c1685c81062c87d1f 100644 --- a/maca_trans_parser/src/maca_trans_parser_arc_eager_mcf2cff.c +++ b/maca_trans_parser/src/maca_trans_parser_arc_eager_mcf2cff.c @@ -94,7 +94,7 @@ void generate_training_file(FILE *output_file, context *ctx) movement_parser_eos(c); sentence_nb++; if((sentence_nb % 100) == 0) - fprintf(stderr, "sentence %d\n", sentence_nb); + fprintf(stderr, "\rsentence %d", sentence_nb); /* if(word_buffer_is_last(ref)) */ break; case MVT_PARSER_LEFT : @@ -116,6 +116,7 @@ void generate_training_file(FILE *output_file, context *ctx) break; } } + fprintf(stderr, "\n"); } int main(int argc, char *argv[]) diff --git a/maca_trans_parser/src/maca_trans_tagparser_arc_eager_mcf2cff.c b/maca_trans_parser/src/maca_trans_tagparser_arc_eager_mcf2cff.c index 11c163cd93e06b20c4ac2d6729b936d2132961b9..cf95405eefd6c91fc3b3392164eb7f76c16feabf 100644 --- a/maca_trans_parser/src/maca_trans_tagparser_arc_eager_mcf2cff.c +++ b/maca_trans_parser/src/maca_trans_tagparser_arc_eager_mcf2cff.c @@ -117,7 +117,7 @@ void generate_training_file(FILE *output_file, context *ctx) movement_tagparser_eos(c); sentence_nb++; if((sentence_nb % 100) == 0) - fprintf(stderr, "sentence %d\n", sentence_nb); + fprintf(stderr, "\rsentence %d", sentence_nb); break; case MVT_TAGPARSER_POSTAG : movement_tagparser_add_pos(c, mvt_label); @@ -141,6 +141,7 @@ void generate_training_file(FILE *output_file, context *ctx) break; } } + fprintf(stderr, "\n"); } int main(int argc, char *argv[]) diff --git a/maca_trans_parser/src/simple_decoder_tagparser_arc_eager.c b/maca_trans_parser/src/simple_decoder_tagparser_arc_eager.c index 15b8767ae0b1a70b3f1f1d88f374995166131a92..85791efe0bf9daea10e82a5c53bc71a1ff567d03 100644 --- a/maca_trans_parser/src/simple_decoder_tagparser_arc_eager.c +++ b/maca_trans_parser/src/simple_decoder_tagparser_arc_eager.c @@ -161,7 +161,12 @@ void simple_decoder_tagparser_arc_eager(context *ctx) if(ctx->debug_mode){ fprintf(stdout, "WARNING : movement cannot be executed doing a SHIFT instead !\n"); } - movement_tagparser_shift(c); + result = movement_tagparser_shift(c); + if(result == 0){ /* SHIFT failed no more words to read, let's get out of here ! */ + if(ctx->debug_mode) fprintf(stdout, "WARNING : cannot exectue a SHIFT emptying stack !\n"); + while(!stack_is_empty(config_get_stack(c))) + movement_tagparser_root(c, root_label); + } } }