Merge "Pass max trie structure size to on memory Ver4DictBuffers."
commit
4f3c3aaf11
|
@ -130,11 +130,10 @@ Ver4DictBuffers::Ver4DictBuffers(const char *const dictPath,
|
||||||
mShortcutDictContent(dictPath, isUpdatable),
|
mShortcutDictContent(dictPath, isUpdatable),
|
||||||
mIsUpdatable(isUpdatable) {}
|
mIsUpdatable(isUpdatable) {}
|
||||||
|
|
||||||
Ver4DictBuffers::Ver4DictBuffers(const HeaderPolicy *const headerPolicy)
|
Ver4DictBuffers::Ver4DictBuffers(const HeaderPolicy *const headerPolicy, const int maxTrieSize)
|
||||||
: mHeaderBuffer(nullptr), mDictBuffer(nullptr), mHeaderPolicy(),
|
: mHeaderBuffer(nullptr), mDictBuffer(nullptr), mHeaderPolicy(),
|
||||||
mExpandableHeaderBuffer(Ver4DictConstants::MAX_DICTIONARY_SIZE),
|
mExpandableHeaderBuffer(Ver4DictConstants::MAX_DICTIONARY_SIZE),
|
||||||
mExpandableTrieBuffer(Ver4DictConstants::MAX_DICTIONARY_SIZE),
|
mExpandableTrieBuffer(maxTrieSize), mTerminalPositionLookupTable(),
|
||||||
mTerminalPositionLookupTable(),
|
|
||||||
mProbabilityDictContent(headerPolicy->hasHistoricalInfoOfWords()),
|
mProbabilityDictContent(headerPolicy->hasHistoricalInfoOfWords()),
|
||||||
mBigramDictContent(headerPolicy->hasHistoricalInfoOfWords()), mShortcutDictContent(),
|
mBigramDictContent(headerPolicy->hasHistoricalInfoOfWords()), mShortcutDictContent(),
|
||||||
mIsUpdatable(true) {}
|
mIsUpdatable(true) {}
|
||||||
|
|
|
@ -39,8 +39,8 @@ class Ver4DictBuffers {
|
||||||
MmappedBuffer::MmappedBufferPtr headerBuffer);
|
MmappedBuffer::MmappedBufferPtr headerBuffer);
|
||||||
|
|
||||||
static AK_FORCE_INLINE Ver4DictBuffersPtr createVer4DictBuffers(
|
static AK_FORCE_INLINE Ver4DictBuffersPtr createVer4DictBuffers(
|
||||||
const HeaderPolicy *const headerPolicy) {
|
const HeaderPolicy *const headerPolicy, const int maxTrieSize) {
|
||||||
return Ver4DictBuffersPtr(new Ver4DictBuffers(headerPolicy));
|
return Ver4DictBuffersPtr(new Ver4DictBuffers(headerPolicy, maxTrieSize));
|
||||||
}
|
}
|
||||||
|
|
||||||
AK_FORCE_INLINE bool isValid() const {
|
AK_FORCE_INLINE bool isValid() const {
|
||||||
|
@ -122,7 +122,7 @@ class Ver4DictBuffers {
|
||||||
Ver4DictBuffers(const char *const dictDirPath,
|
Ver4DictBuffers(const char *const dictDirPath,
|
||||||
const MmappedBuffer::MmappedBufferPtr headerBuffer, const bool isUpdatable);
|
const MmappedBuffer::MmappedBufferPtr headerBuffer, const bool isUpdatable);
|
||||||
|
|
||||||
Ver4DictBuffers(const HeaderPolicy *const headerPolicy);
|
Ver4DictBuffers(const HeaderPolicy *const headerPolicy, const int maxTrieSize);
|
||||||
|
|
||||||
const MmappedBuffer::MmappedBufferPtr mHeaderBuffer;
|
const MmappedBuffer::MmappedBufferPtr mHeaderBuffer;
|
||||||
const MmappedBuffer::MmappedBufferPtr mDictBuffer;
|
const MmappedBuffer::MmappedBufferPtr mDictBuffer;
|
||||||
|
|
|
@ -55,7 +55,8 @@ bool Ver4PatriciaTrieWritingHelper::writeToDictFileWithGC(const int rootPtNodeAr
|
||||||
const char *const dictDirPath) {
|
const char *const dictDirPath) {
|
||||||
const HeaderPolicy *const headerPolicy = mBuffers->getHeaderPolicy();
|
const HeaderPolicy *const headerPolicy = mBuffers->getHeaderPolicy();
|
||||||
Ver4DictBuffers::Ver4DictBuffersPtr dictBuffers(
|
Ver4DictBuffers::Ver4DictBuffersPtr dictBuffers(
|
||||||
Ver4DictBuffers::createVer4DictBuffers(headerPolicy));
|
Ver4DictBuffers::createVer4DictBuffers(headerPolicy,
|
||||||
|
Ver4DictConstants::MAX_DICTIONARY_SIZE));
|
||||||
int unigramCount = 0;
|
int unigramCount = 0;
|
||||||
int bigramCount = 0;
|
int bigramCount = 0;
|
||||||
if (!runGC(rootPtNodeArrayPos, headerPolicy, dictBuffers.get(), &unigramCount, &bigramCount)) {
|
if (!runGC(rootPtNodeArrayPos, headerPolicy, dictBuffers.get(), &unigramCount, &bigramCount)) {
|
||||||
|
|
|
@ -49,7 +49,8 @@ const char *const DictFileWritingUtils::TEMP_FILE_SUFFIX_FOR_WRITING_DICT_FILE =
|
||||||
const DictionaryHeaderStructurePolicy::AttributeMap *const attributeMap) {
|
const DictionaryHeaderStructurePolicy::AttributeMap *const attributeMap) {
|
||||||
HeaderPolicy headerPolicy(FormatUtils::VERSION_4, localeAsCodePointVector, attributeMap);
|
HeaderPolicy headerPolicy(FormatUtils::VERSION_4, localeAsCodePointVector, attributeMap);
|
||||||
Ver4DictBuffers::Ver4DictBuffersPtr dictBuffers(
|
Ver4DictBuffers::Ver4DictBuffersPtr dictBuffers(
|
||||||
Ver4DictBuffers::createVer4DictBuffers(&headerPolicy));
|
Ver4DictBuffers::createVer4DictBuffers(&headerPolicy,
|
||||||
|
Ver4DictConstants::MAX_DICT_EXTENDED_REGION_SIZE));
|
||||||
headerPolicy.fillInAndWriteHeaderToBuffer(true /* updatesLastDecayedTime */,
|
headerPolicy.fillInAndWriteHeaderToBuffer(true /* updatesLastDecayedTime */,
|
||||||
0 /* unigramCount */, 0 /* bigramCount */,
|
0 /* unigramCount */, 0 /* bigramCount */,
|
||||||
0 /* extendedRegionSize */, dictBuffers->getWritableHeaderBuffer());
|
0 /* extendedRegionSize */, dictBuffers->getWritableHeaderBuffer());
|
||||||
|
|
Loading…
Reference in New Issue