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 | a730085e77c5eb80b2b71dfcb05e0b6a27b2140c (patch) | |
tree | 53c488914e3403eb79501d025b9112179b79197c | |
parent | 4e225d86f5c0511c8e7fab42587e54041904d9a9 (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(); } |