Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
M
macaon2
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Container registry
Model registry
Operate
Environments
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
GitLab community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Alexis Nasr
macaon2
Commits
515cda63
Commit
515cda63
authored
7 years ago
by
robin.perrotin
Browse files
Options
Downloads
Patches
Plain Diff
.
parent
34c3830d
No related branches found
No related tags found
No related merge requests found
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
maca_trans_parser/src/simple_decoder_parser_arc_eager.c
+36
-21
36 additions, 21 deletions
maca_trans_parser/src/simple_decoder_parser_arc_eager.c
with
36 additions
and
21 deletions
maca_trans_parser/src/simple_decoder_parser_arc_eager.c
+
36
−
21
View file @
515cda63
...
...
@@ -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
);
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment