Skip to content
Snippets Groups Projects
Commit 71688f06 authored by robin.perrotin's avatar robin.perrotin
Browse files

.

parent 6f16cf58
No related branches found
No related tags found
No related merge requests found
......@@ -170,7 +170,7 @@ void simple_decoder_parser_arc_eager(context *ctx)
double currentSumExp;
double ScoreTranslation;
int FlagNotInitExp;
// double ProbaDivider = 100; // TO SETUP
double ProbaDivider = 15; // TO SETUP
double randomFloat;
srand(mix(clock(), time(NULL), getpid()));
......@@ -186,7 +186,7 @@ void simple_decoder_parser_arc_eager(context *ctx)
sumExp = 0;
currentSumExp = 0;
ScoreTranslation = -60; // TO SETUP
ScoreTranslation = -5; // TO SETUP
FlagNotInitExp = 1;
if(ctx->debug_mode){
......@@ -221,12 +221,11 @@ void simple_decoder_parser_arc_eager(context *ctx)
if(b1 && b2 && b3){
if(FlagNotInitExp){
ScoreTranslation += vcode_array[i].score;///ProbaDivider;
ScoreTranslation += vcode_array[i].score/ProbaDivider;
FlagNotInitExp = 0;
}
// if(vcode_array[i].score/ProbaDivider - ScoreTranslation > 0){
if(vcode_array[i].score - ScoreTranslation > 0){
sumExp += exp(ScoreTranslation - vcode_array[i].score );
if(vcode_array[i].score/ProbaDivider - ScoreTranslation > 0){
sumExp += exp(vcode_array[i].score/ProbaDivider - ScoreTranslation);
}
}
}
......@@ -241,11 +240,10 @@ void simple_decoder_parser_arc_eager(context *ctx)
int b2 = respect_stack_constraint(ctx->partial_mode, c, movement_parser_type(vcode_array[i].class_code), movement_parser_label(vcode_array[i].class_code));
int b3 = respect_buffer_constraint(ctx->partial_mode, c, movement_parser_type(vcode_array[i].class_code), movement_parser_label(vcode_array[i].class_code));
if(b1 && b2 && b3){
// if(vcode_array[i].score/ProbaDivider - ScoreTranslation > 0){
if(vcode_array[i].score - ScoreTranslation > 0){
if(vcode_array[i].score/ProbaDivider - ScoreTranslation > 0){
printf(" %f %f %f",sumExp, currentSumExp,ScoreTranslation);
printf(" [%f-",currentSumExp/sumExp);
currentSumExp += exp(ScoreTranslation - vcode_array[i].score);
currentSumExp += exp(vcode_array[i].score/ProbaDivider - ScoreTranslation);
printf("%f[", currentSumExp/sumExp);
}
printf("\t<----");
......@@ -285,8 +283,7 @@ void simple_decoder_parser_arc_eager(context *ctx)
int b3 = respect_buffer_constraint(ctx->partial_mode, c, movement_parser_type(vcode_array[i].class_code), movement_parser_label(vcode_array[i].class_code));
if(b1 && b2 && b3){
// currentSumExp += exp(vcode_array[i].score/ProbaDivider - ScoreTranslation);
currentSumExp += exp(ScoreTranslation - vcode_array[i].score);
currentSumExp += exp(vcode_array[i].score/ProbaDivider - ScoreTranslation);
if(currentSumExp/sumExp >= randomFloat){
printf("The %d th move has been selected by the probabilistic parser.\n",i);
mvt_code = vcode_array[i].class_code;
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment