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

In ContextModule : left-most and right-most child features are only taken into...

In ContextModule : left-most and right-most child features are only taken into account if they are respectively to the left or to the right of their parents
parent e9c3b9aa
No related branches found
No related tags found
No related merge requests found
...@@ -85,12 +85,22 @@ void ContextModuleImpl::addToContext(std::vector<std::vector<long>> & context, c ...@@ -85,12 +85,22 @@ void ContextModuleImpl::addToContext(std::vector<std::vector<long>> & context, c
{ {
int childIndex = *std::get<2>(target); int childIndex = *std::get<2>(target);
auto childs = util::split(config.getAsFeature(Config::childsColName, baseIndex).get(), '|'); auto childs = util::split(config.getAsFeature(Config::childsColName, baseIndex).get(), '|');
int candidate = -1;
if (childIndex >= 0 and childIndex < (int)childs.size()) if (childIndex >= 0 and childIndex < (int)childs.size())
contextIndexes.emplace_back(std::stoi(childs[childIndex])); {
candidate = std::stoi(childs[childIndex]);
if (candidate > baseIndex)
candidate = -1;
}
else if (childIndex < 0 and ((int)childs.size())+childIndex >= 0) else if (childIndex < 0 and ((int)childs.size())+childIndex >= 0)
contextIndexes.emplace_back(std::stoi(childs[childs.size()+childIndex])); {
else candidate = std::stoi(childs[childs.size()+childIndex]);
contextIndexes.emplace_back(-1); if (candidate < baseIndex)
candidate = -1;
}
contextIndexes.emplace_back(candidate);
} }
} }
else else
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment