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

different null value for each column in ContextModule

parent 2d940e47
No related branches found
No related tags found
No related merge requests found
...@@ -113,7 +113,7 @@ void ContextModuleImpl::addToContext(std::vector<std::vector<long>> & context, c ...@@ -113,7 +113,7 @@ void ContextModuleImpl::addToContext(std::vector<std::vector<long>> & context, c
if (index == -1) if (index == -1)
{ {
for (auto & contextElement : context) for (auto & contextElement : context)
contextElement.push_back(dict.getIndexOrInsert(Dict::nullValueStr)); contextElement.push_back(dict.getIndexOrInsert(fmt::format("{}({})", col, Dict::nullValueStr)));
} }
else else
{ {
...@@ -134,7 +134,12 @@ void ContextModuleImpl::addToContext(std::vector<std::vector<long>> & context, c ...@@ -134,7 +134,12 @@ void ContextModuleImpl::addToContext(std::vector<std::vector<long>> & context, c
dictIndex = dict.getIndexOrInsert(fmt::format("EOS({})", config.getAsFeature(col, index))); dictIndex = dict.getIndexOrInsert(fmt::format("EOS({})", config.getAsFeature(col, index)));
} }
else else
dictIndex = dict.getIndexOrInsert(functions[colIndex](config.getAsFeature(col, index))); {
std::string featureValue = functions[colIndex](config.getAsFeature(col, index));
if (w2vFile.empty())
featureValue = fmt::format("{}({})", col, featureValue);
dictIndex = dict.getIndexOrInsert(featureValue);
}
for (auto & contextElement : context) for (auto & contextElement : context)
contextElement.push_back(dictIndex); contextElement.push_back(dictIndex);
......
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