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

Do not split for unknown tokens but replace instead

parent 28045459
No related branches found
No related tags found
No related merge requests found
...@@ -42,17 +42,12 @@ void ContextLSTMImpl::addToContext(std::vector<std::vector<long>> & context, Dic ...@@ -42,17 +42,12 @@ void ContextLSTMImpl::addToContext(std::vector<std::vector<long>> & context, Dic
for (auto & contextElement : context) for (auto & contextElement : context)
contextElement.push_back(dictIndex); contextElement.push_back(dictIndex);
if (splitUnknown)
for (auto & targetCol : unknownValueColumns) for (auto & targetCol : unknownValueColumns)
if (col == targetCol) if (col == targetCol)
if (dict.getNbOccs(dictIndex) <= unknownValueThreshold) if (dict.getNbOccs(dictIndex) <= unknownValueThreshold)
{
context.emplace_back(context.back());
context.back().back() = dict.getIndexOrInsert(Dict::unknownValueStr); context.back().back() = dict.getIndexOrInsert(Dict::unknownValueStr);
} }
} }
}
torch::Tensor ContextLSTMImpl::forward(torch::Tensor input) torch::Tensor ContextLSTMImpl::forward(torch::Tensor input)
{ {
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment