#include <BlockHashIndex.h>
Public Member Functions | |
BlockHashIndex (size_t orderBits, size_t fingerPrintBits) | |
~BlockHashIndex () | |
size_t | GetHash (const char *key) |
size_t | GetHash (std::string key) |
size_t | operator[] (std::string key) |
size_t | operator[] (char *key) |
void | BeginSave (std::FILE *mphf) |
void | SaveRange (size_t i) |
void | SaveLastRange () |
size_t | FinalizeSave () |
void | DropRange (size_t i) |
void | DropLastRange () |
size_t | LoadIndex (std::FILE *mphf) |
void | LoadRange (size_t i) |
size_t | Save (std::string filename) |
size_t | Save (std::FILE *mphf) |
size_t | Load (std::string filename) |
size_t | Load (std::FILE *mphf) |
size_t | GetSize () const |
void | KeepNLastRanges (float ratio=0.1, float tolerance=0.1) |
template<typename Keys > | |
void | AddRange (Keys &keys) |
template<typename Keys > | |
void | CalcHash (size_t current, Keys &keys) |
void | CalcHash (size_t current, void *source) |
Definition at line 50 of file BlockHashIndex.h.
Moses::BlockHashIndex::BlockHashIndex | ( | size_t | orderBits, | |
size_t | fingerPrintBits | |||
) |
Definition at line 48 of file BlockHashIndex.cpp.
Moses::BlockHashIndex::~BlockHashIndex | ( | ) |
Definition at line 60 of file BlockHashIndex.cpp.
void Moses::BlockHashIndex::AddRange | ( | Keys & | keys | ) | [inline] |
Definition at line 145 of file BlockHashIndex.h.
References Moses::StringVector< ValueT, PosT, Allocator >::back(), CalcHash(), Moses::StringVector< ValueT, PosT, Allocator >::push_back(), Moses::StringVector< ValueT, PosT, Allocator >::size(), util::StringStream::str(), and UTIL_THROW2.
void Moses::BlockHashIndex::BeginSave | ( | std::FILE * | mphf | ) |
Definition at line 146 of file BlockHashIndex.cpp.
References ftell(), and ThrowingFwrite().
Referenced by Moses::LexicalReorderingTableCreator::LexicalReorderingTableCreator(), Moses::PhraseTableCreator::PhraseTableCreator(), and Save().
void Moses::BlockHashIndex::CalcHash | ( | size_t | current, | |
void * | source | |||
) |
Definition at line 346 of file BlockHashIndex.cpp.
References Moses::PairedPackedArray< T, D >::Set(), util::StringStream::str(), and UTIL_THROW2.
void Moses::BlockHashIndex::CalcHash | ( | size_t | current, | |
Keys & | keys | |||
) | [inline] |
Definition at line 175 of file BlockHashIndex.h.
Referenced by AddRange().
void Moses::BlockHashIndex::DropLastRange | ( | ) |
Definition at line 199 of file BlockHashIndex.cpp.
References DropRange().
void Moses::BlockHashIndex::DropRange | ( | size_t | i | ) |
Definition at line 183 of file BlockHashIndex.cpp.
Referenced by DropLastRange().
size_t Moses::BlockHashIndex::FinalizeSave | ( | ) |
Definition at line 216 of file BlockHashIndex.cpp.
References fseek(), ftell(), Moses::StringVector< ValueT, PosT, Allocator >::save(), SaveLastRange(), and ThrowingFwrite().
Referenced by Save().
size_t Moses::BlockHashIndex::GetHash | ( | std::string | key | ) |
Definition at line 123 of file BlockHashIndex.cpp.
size_t Moses::BlockHashIndex::GetHash | ( | const char * | key | ) |
Definition at line 75 of file BlockHashIndex.cpp.
References Moses::StringVector< ValueT, PosT, Allocator >::begin(), Moses::StringVector< ValueT, PosT, Allocator >::end(), and GetSize().
size_t Moses::BlockHashIndex::GetSize | ( | ) | const |
Definition at line 319 of file BlockHashIndex.cpp.
Referenced by Moses::PhraseDecoder::CreateTargetPhraseCollection(), GetHash(), Moses::LexicalReorderingTableCompact::GetScore(), and GetScore().
void Moses::BlockHashIndex::KeepNLastRanges | ( | float | ratio = 0.1 , |
|
float | tolerance = 0.1 | |||
) |
Definition at line 324 of file BlockHashIndex.cpp.
size_t Moses::BlockHashIndex::Load | ( | std::FILE * | mphf | ) |
Definition at line 308 of file BlockHashIndex.cpp.
References end, fseek(), ftell(), LoadIndex(), and LoadRange().
size_t Moses::BlockHashIndex::Load | ( | std::string | filename | ) |
Definition at line 300 of file BlockHashIndex.cpp.
Referenced by Moses::PhraseDictionaryCompact::Load(), Moses::LexicalReorderingTableCompact::Load(), and Load().
size_t Moses::BlockHashIndex::LoadIndex | ( | std::FILE * | mphf | ) |
Definition at line 252 of file BlockHashIndex.cpp.
References end, fseek(), ftell(), Moses::StringVector< ValueT, PosT, Allocator >::load(), and read().
Referenced by Load().
void Moses::BlockHashIndex::LoadRange | ( | size_t | i | ) |
Definition at line 284 of file BlockHashIndex.cpp.
References fseek().
Referenced by Load().
size_t Moses::BlockHashIndex::operator[] | ( | char * | key | ) |
Definition at line 133 of file BlockHashIndex.cpp.
size_t Moses::BlockHashIndex::operator[] | ( | std::string | key | ) |
Definition at line 128 of file BlockHashIndex.cpp.
size_t Moses::BlockHashIndex::Save | ( | std::FILE * | mphf | ) |
Definition at line 243 of file BlockHashIndex.cpp.
References BeginSave(), FinalizeSave(), and SaveRange().
size_t Moses::BlockHashIndex::Save | ( | std::string | filename | ) |
Definition at line 138 of file BlockHashIndex.cpp.
void Moses::BlockHashIndex::SaveLastRange | ( | ) |
Definition at line 169 of file BlockHashIndex.cpp.
References SaveRange().
Referenced by FinalizeSave().
void Moses::BlockHashIndex::SaveRange | ( | size_t | i | ) |
Definition at line 158 of file BlockHashIndex.cpp.
References ftell().
Referenced by Save(), and SaveLastRange().