diff options
author | Kenneth Heafield <github@kheafield.com> | 2012-10-22 14:04:27 +0100 |
---|---|---|
committer | Kenneth Heafield <github@kheafield.com> | 2012-10-22 14:04:27 +0100 |
commit | 1fb7bfbbe287e868522613871ed6ca74369ed2a1 (patch) | |
tree | 6c06e30cdb32f1116f6cf5fdc7ac74b96a11013e /klm/lm | |
parent | ac586bc9b156b4ae687cd5961ba1fe7b20ec57d6 (diff) |
Update search, make it compile
Diffstat (limited to 'klm/lm')
-rw-r--r-- | klm/lm/model.cc | 2 | ||||
-rw-r--r-- | klm/lm/vocab.cc | 4 | ||||
-rw-r--r-- | klm/lm/vocab.hh | 2 |
3 files changed, 4 insertions, 4 deletions
diff --git a/klm/lm/model.cc b/klm/lm/model.cc index 40af8a63..2fd20481 100644 --- a/klm/lm/model.cc +++ b/klm/lm/model.cc @@ -87,7 +87,7 @@ template <class Search, class VocabularyT> void GenericModel<Search, VocabularyT WriteWordsWrapper wrap(config.enumerate_vocab); vocab_.ConfigureEnumerate(&wrap, counts[0]); search_.InitializeFromARPA(file, f, counts, config, vocab_, backing_); - wrap.Write(backing_.file.get()); + wrap.Write(backing_.file.get(), backing_.vocab.size() + vocab_.UnkCountChangePadding() + backing_.search.size()); } else { vocab_.ConfigureEnumerate(config.enumerate_vocab, counts[0]); search_.InitializeFromARPA(file, f, counts, config, vocab_, backing_); diff --git a/klm/lm/vocab.cc b/klm/lm/vocab.cc index 398475be..11c27518 100644 --- a/klm/lm/vocab.cc +++ b/klm/lm/vocab.cc @@ -80,8 +80,8 @@ void WriteWordsWrapper::Add(WordIndex index, const StringPiece &str) { buffer_.push_back(0); } -void WriteWordsWrapper::Write(int fd) { - util::SeekEnd(fd); +void WriteWordsWrapper::Write(int fd, uint64_t start) { + util::SeekOrThrow(fd, start); util::WriteOrThrow(fd, buffer_.data(), buffer_.size()); } diff --git a/klm/lm/vocab.hh b/klm/lm/vocab.hh index 074cd446..de54eb06 100644 --- a/klm/lm/vocab.hh +++ b/klm/lm/vocab.hh @@ -35,7 +35,7 @@ class WriteWordsWrapper : public EnumerateVocab { void Add(WordIndex index, const StringPiece &str); - void Write(int fd); + void Write(int fd, uint64_t start); private: EnumerateVocab *inner_; |