diff options
author | Kenneth Heafield <kenlm@kheafield.com> | 2011-09-25 19:18:36 -0400 |
---|---|---|
committer | Kenneth Heafield <kenlm@kheafield.com> | 2011-09-25 19:18:36 -0400 |
commit | 5ef94f59e08d2f25bee8520c4233829207d1c034 (patch) | |
tree | bf8eeff33b08a8445e28a933792074dd199846ae | |
parent | 747309fcb0e0b1c6d060a68286ba1cf5ed1fbfa4 (diff) |
Fix trie sort merging
-rw-r--r-- | klm/lm/trie_sort.cc | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/klm/lm/trie_sort.cc b/klm/lm/trie_sort.cc index 01c4e490..86f28493 100644 --- a/klm/lm/trie_sort.cc +++ b/klm/lm/trie_sort.cc @@ -146,7 +146,7 @@ template <class Combine> void MergeSortedFiles(const std::string &first_name, co ++first; ++second; } } - for (RecordReader &remains = (first ? second : first); remains; ++remains) { + for (RecordReader &remains = (first ? first : second); remains; ++remains) { WriteOrThrow(out_file.get(), remains.Data(), entry_size); } } @@ -191,7 +191,7 @@ void ConvertToSorted(util::FilePiece &f, const SortedVocabulary &vocab, const st assembled << file_prefix << static_cast<unsigned int>(order) << "_merge_" << (merge_count++); files.push_back(assembled.str()); MergeSortedFiles(files[0], files[1], files.back(), weights_size, order, ThrowCombine()); - MergeSortedFiles(files[0], files[1], files.back(), 0, order, FirstCombine()); + MergeSortedFiles(files[0] + kContextSuffix, files[1] + kContextSuffix, files.back() + kContextSuffix, 0, order, FirstCombine()); files.pop_front(); files.pop_front(); } |