Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
O
old_macaon
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Code
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Deploy
Releases
Container registry
Model registry
Monitor
Incidents
Analyze
Value stream analytics
Contributor 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
Franck Dary
old_macaon
Commits
3fe310a0
Commit
3fe310a0
authored
6 years ago
by
Franck Dary
Browse files
Options
Downloads
Patches
Plain Diff
Added a new option -d for debug output
parent
4e8d74f4
No related branches found
No related tags found
No related merge requests found
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
decoder/include/Decoder.hpp
+3
-1
3 additions, 1 deletion
decoder/include/Decoder.hpp
decoder/src/Decoder.cpp
+11
-5
11 additions, 5 deletions
decoder/src/Decoder.cpp
decoder/src/macaon_decode.cpp
+11
-1
11 additions, 1 deletion
decoder/src/macaon_decode.cpp
with
25 additions
and
7 deletions
decoder/include/Decoder.hpp
+
3
−
1
View file @
3fe310a0
...
...
@@ -21,6 +21,8 @@ class Decoder
BD
&
bd
;
/// @brief The current configuration of the TransitionMachine
Config
&
config
;
/// @brief is true, decode will print infos on stderr
bool
debugMode
;
public
:
...
...
@@ -31,7 +33,7 @@ class Decoder
/// @param tm The trained TransitionMachine
/// @param bd The BD we need to fill
/// @param config The current configuration of the TransitionMachine
Decoder
(
TransitionMachine
&
tm
,
BD
&
bd
,
Config
&
config
);
Decoder
(
TransitionMachine
&
tm
,
BD
&
bd
,
Config
&
config
,
bool
debugMode
);
/// @brief Fill bd using tm.
void
decode
();
};
...
...
This diff is collapsed.
Click to expand it.
decoder/src/Decoder.cpp
+
11
−
5
View file @
3fe310a0
#include
"Decoder.hpp"
#include
"util.hpp"
Decoder
::
Decoder
(
TransitionMachine
&
tm
,
BD
&
bd
,
Config
&
config
)
Decoder
::
Decoder
(
TransitionMachine
&
tm
,
BD
&
bd
,
Config
&
config
,
bool
debugMode
)
:
tm
(
tm
),
bd
(
bd
),
config
(
config
)
{
this
->
debugMode
=
debugMode
;
}
void
Decoder
::
decode
()
...
...
@@ -15,12 +16,17 @@ void Decoder::decode()
config
.
setCurrentStateName
(
&
currentState
->
name
);
Dict
::
currentClassifierName
=
classifier
->
name
;
//config.printForDebug(stderr);
//fprintf(stderr, "State : \'%s\'\n", currentState->name.c_str());
if
(
debugMode
)
{
config
.
printForDebug
(
stderr
);
fprintf
(
stderr
,
"State :
\'
%s
\'\n
"
,
currentState
->
name
.
c_str
());
}
auto
weightedActions
=
classifier
->
weightActions
(
config
);
//Classifier::printWeightedActions(stderr, weightedActions);
if
(
debugMode
)
Classifier
::
printWeightedActions
(
stderr
,
weightedActions
);
std
::
string
&
predictedAction
=
weightedActions
[
0
].
second
.
second
;
Action
*
action
=
classifier
->
getAction
(
predictedAction
);
...
...
This diff is collapsed.
Click to expand it.
decoder/src/macaon_decode.cpp
+
11
−
1
View file @
3fe310a0
...
...
@@ -36,6 +36,7 @@ po::options_description getOptionsDescription()
po
::
options_description
opt
(
"Optional"
);
opt
.
add_options
()
(
"help,h"
,
"Produce this help message"
)
(
"debug,d"
,
"Print infos on stderr"
)
(
"lang"
,
po
::
value
<
std
::
string
>
()
->
default_value
(
"fr"
),
"Language you are working with"
);
...
...
@@ -103,6 +104,15 @@ int main(int argc, char * argv[])
const
char
*
MACAON_DIR
=
std
::
getenv
(
"MACAON_DIR"
);
std
::
string
slash
=
"/"
;
std
::
string
expPath
=
MACAON_DIR
+
slash
+
lang
+
slash
+
"bin/"
+
expName
+
slash
;
bool
debugMode
=
vm
.
count
(
"debug"
)
==
0
?
false
:
true
;
if
(
debugMode
)
{
fprintf
(
stderr
,
"Oui
\n
"
);
}
else
{
fprintf
(
stderr
,
"Non
\n
"
);
}
tmFilename
=
expPath
+
tmFilename
;
bdFilename
=
expPath
+
bdFilename
;
...
...
@@ -113,7 +123,7 @@ int main(int argc, char * argv[])
Config
config
(
bd
,
expPath
);
config
.
readInput
(
inputFilename
);
Decoder
decoder
(
tapeMachine
,
bd
,
config
);
Decoder
decoder
(
tapeMachine
,
bd
,
config
,
debugMode
);
decoder
.
decode
();
...
...
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