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

.

parent 34c3830d
No related branches found
No related tags found
No related merge requests found
......@@ -3,8 +3,10 @@
#include<string.h>
#include<unistd.h>
#include<getopt.h>
#include"context.h"
#include<math.h>
#include<time.h>
#include<random.h>
#include"context.h"
#include"movement_parser_arc_eager.h"
#include"feat_fct.h"
#include"config2feat_vec.h"
......@@ -155,7 +157,11 @@ void simple_decoder_parser_arc_eager(context *ctx)
double currentSumExp;
double ScoreTranslation;
int FlagNotInitExp;
double ProbaDivider = 10; // TO SETUP
double ProbaDivider = 100; // TO SETUP
double randomFloat;
srand(mix(clock(), time(NULL), getpid()););
word* word_scored;
......@@ -250,7 +256,12 @@ void simple_decoder_parser_arc_eager(context *ctx)
printf("%f\n", max1 - max2);
}
if(ctx->partial_mode){
currentSumExp = 0.;
randomFloat = (double) rand()/(double)RAND_MAX;
printf("< %f > is our random number. \n",randomFloat);
// if(ctx->partial_mode){ // NOT YET COMPATIBLE
vcode *vcode_array = feature_table_get_vcode_array(fv, ft);
mvt_code = 0;
for(int i=0; i < ft->classes_nb; i++){
......@@ -259,12 +270,16 @@ 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);
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;
break;
}
}
free(vcode_array);
}
free(vcode_array);
// }
mvt_type = movement_parser_type(mvt_code);
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment