Skip to content
This repository has been archived by the owner on Jun 10, 2021. It is now read-only.

Commit

Permalink
Fix vocabularies assignment when no pruning is required
Browse files Browse the repository at this point in the history
  • Loading branch information
guillaumekln committed Mar 6, 2017
1 parent 3ff4e5c commit da19df0
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions onmt/data/Vocabulary.lua
Expand Up @@ -124,6 +124,8 @@ function Vocabulary.init(name, dataFile, vocabFile, vocabSize, wordsMinFrequency
wordVocab = genWordVocab:pruneByMinFrequency(minFrequency[1])
elseif newSizes[1] > 0 then
wordVocab = genWordVocab:prune(newSizes[1])
else
wordVocab = genWordVocab
end

_G.logger:info('Created word dictionary of size '
Expand All @@ -136,6 +138,8 @@ function Vocabulary.init(name, dataFile, vocabFile, vocabSize, wordsMinFrequency
featuresVocabs[i] = genFeaturesVocabs[i]:pruneByMinFrequency(minFrequency[i + 1])
elseif newSizes[i + 1] > 0 then
featuresVocabs[i] = genFeaturesVocabs[i]:prune(newSizes[i + 1])
else
featuresVocabs[i] = genFeaturesVocabs[i]
end

_G.logger:info('Created feature ' .. i .. ' dictionary of size '
Expand Down

0 comments on commit da19df0

Please sign in to comment.