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

.

parent 4553a987
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) ...@@ -170,7 +170,7 @@ void simple_decoder_parser_arc_eager(context *ctx)
double currentSumExp; double currentSumExp;
double ScoreTranslation; double ScoreTranslation;
int FlagNotInitExp; int FlagNotInitExp;
double ProbaDivider = 100; // TO SETUP // double ProbaDivider = 100; // TO SETUP
double randomFloat; double randomFloat;
srand(mix(clock(), time(NULL), getpid())); srand(mix(clock(), time(NULL), getpid()));
...@@ -186,7 +186,7 @@ void simple_decoder_parser_arc_eager(context *ctx) ...@@ -186,7 +186,7 @@ void simple_decoder_parser_arc_eager(context *ctx)
sumExp = 0; sumExp = 0;
currentSumExp = 0; currentSumExp = 0;
ScoreTranslation = -10; // TO SETUP ScoreTranslation = -60; // TO SETUP
FlagNotInitExp = 1; FlagNotInitExp = 1;
if(ctx->debug_mode){ if(ctx->debug_mode){
...@@ -224,8 +224,9 @@ void simple_decoder_parser_arc_eager(context *ctx) ...@@ -224,8 +224,9 @@ void simple_decoder_parser_arc_eager(context *ctx)
ScoreTranslation += vcode_array[i].score/ProbaDivider; ScoreTranslation += vcode_array[i].score/ProbaDivider;
FlagNotInitExp = 0; FlagNotInitExp = 0;
} }
if(vcode_array[i].score/ProbaDivider - ScoreTranslation > 0){ // if(vcode_array[i].score/ProbaDivider - ScoreTranslation > 0){
sumExp += exp(vcode_array[i].score/ProbaDivider - ScoreTranslation); if(vcode_array[i].score - ScoreTranslation > 0){
sumExp += exp(ScoreTranslation - vcode_array[i].score );
} }
} }
} }
...@@ -240,10 +241,11 @@ void simple_decoder_parser_arc_eager(context *ctx) ...@@ -240,10 +241,11 @@ 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 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)); 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(b1 && b2 && b3){
if(vcode_array[i].score/ProbaDivider - ScoreTranslation > 0){ // if(vcode_array[i].score/ProbaDivider - ScoreTranslation > 0){
if(vcode_array[i].score - ScoreTranslation > 0){
printf(" %f %f %f",sumExp, currentSumExp,ScoreTranslation); printf(" %f %f %f",sumExp, currentSumExp,ScoreTranslation);
printf(" [%f-",currentSumExp/sumExp); printf(" [%f-",currentSumExp/sumExp);
currentSumExp += exp(vcode_array[i].score/ProbaDivider - ScoreTranslation); currentSumExp += exp(ScoreTranslation - vcode_array[i].score);
printf("%f[", currentSumExp/sumExp); printf("%f[", currentSumExp/sumExp);
} }
printf("\t<----"); printf("\t<----");
...@@ -283,7 +285,8 @@ void simple_decoder_parser_arc_eager(context *ctx) ...@@ -283,7 +285,8 @@ 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)); 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(b1 && b2 && b3){
currentSumExp += exp(vcode_array[i].score/ProbaDivider - ScoreTranslation); // currentSumExp += exp(vcode_array[i].score/ProbaDivider - ScoreTranslation);
currentSumExp += exp(ScoreTranslation - vcode_array[i].score);
if(currentSumExp/sumExp >= randomFloat){ if(currentSumExp/sumExp >= randomFloat){
printf("The %d th move has been selected by the probabilistic parser.\n",i); printf("The %d th move has been selected by the probabilistic parser.\n",i);
mvt_code = vcode_array[i].class_code; 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