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

Fixed a bug with focused indexes where comments where not ignored during training

parent 0ee39963
No related branches found
No related tags found
No related merge requests found
......@@ -375,8 +375,9 @@ bool Config::isComment(std::size_t lineIndex) const
bool Config::isCommentPredicted(std::size_t lineIndex) const
{
auto & col0 = getAsFeature(0, lineIndex);
return !util::isEmpty(col0) and col0.get()[0] == '#';
auto & col0Pred = getAsFeature(0, lineIndex);
auto & col0Gold = getConst(0, lineIndex, 0);
return (!util::isEmpty(col0Pred) and col0Pred.get()[0] == '#') or (!util::isEmpty(col0Gold) and col0Gold.get()[0] == '#');
}
bool Config::isMultiword(std::size_t lineIndex) const
......
......@@ -78,6 +78,11 @@ void FocusedColumnLSTMImpl::addToContext(std::vector<std::vector<long>> & contex
else if (config.isEmptyNodePredicted(index))
elements.emplace_back("ID(EMPTYNODE)");
}
else if (column == "EOS")
{
bool isEOS = config.getAsFeature(Config::EOSColName, index) == Config::EOSSymbol1;
elements.emplace_back(fmt::format("EOS({})", isEOS));
}
else
{
elements.emplace_back(config.getAsFeature(column, index));
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment