Skip to content
Snippets Groups Projects
Commit 3d2ba363 authored by Alexis Nasr's avatar Alexis Nasr
Browse files

uncommented function call that computes all features of a sentence

parent 71700931
Branches
No related tags found
No related merge requests found
......@@ -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);
......
......@@ -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));
}
}
......
......@@ -38,8 +38,10 @@ 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){
/* baseline strategy: skip update */
return;
......
......@@ -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;
......
......@@ -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[])
......
......@@ -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[])
......
......@@ -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);
}
}
}
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment