Skip to content
Snippets Groups Projects
Commit 851720e9 authored by Franck Dary's avatar Franck Dary
Browse files

Parser entropy is only counted for a word being attached

parent 2a7eb155
Branches
No related tags found
No related merge requests found
...@@ -100,10 +100,21 @@ Transition::Transition(const std::string & name) ...@@ -100,10 +100,21 @@ Transition::Transition(const std::string & name)
void Transition::apply(Config & config, float entropy) void Transition::apply(Config & config, float entropy)
{ {
if (config.hasColIndex("ENTROPY")) if (config.hasColIndex("ENTROPY"))
{
if (name.find("SHIFT") == std::string::npos and name.find("REDUCE") == std::string::npos)
{
if (name.find("LEFT") != std::string::npos)
{
auto action = Action::sumToHypothesis("ENTROPY", config.getStack(0), entropy);
action.apply(config, action);
}
else
{ {
auto action = Action::sumToHypothesis("ENTROPY", config.getWordIndex(), entropy); auto action = Action::sumToHypothesis("ENTROPY", config.getWordIndex(), entropy);
action.apply(config, action); action.apply(config, action);
} }
}
}
apply(config); apply(config);
} }
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment