caching target phrase for OnDisk pt

This commit is contained in:
Hieu Hoang 2013-08-16 12:34:31 +01:00
parent 55920d5bca
commit 31360e70ef
2 changed files with 13 additions and 6 deletions

View File

@ -91,13 +91,19 @@ void PhraseDictionaryOnDisk::InitializeForInput(InputType const& source)
m_implementation.reset(obj);
}
void PhraseDictionaryOnDisk::GetTargetPhraseCollectionBatch(const InputPathList &phraseDictionaryQueue) const
void PhraseDictionaryOnDisk::GetTargetPhraseCollectionBatch(const InputPathList &inputPathQueue) const
{
OnDiskPt::OnDiskWrapper &wrapper = const_cast<OnDiskPt::OnDiskWrapper&>(GetImplementation());
InputPathList::const_iterator iter;
for (iter = phraseDictionaryQueue.begin(); iter != phraseDictionaryQueue.end(); ++iter) {
for (iter = inputPathQueue.begin(); iter != inputPathQueue.end(); ++iter) {
InputPath &inputPath = **iter;
GetTargetPhraseCollectionBatch(inputPath);
}
}
void PhraseDictionaryOnDisk::GetTargetPhraseCollectionBatch(InputPath &inputPath) const
{
OnDiskPt::OnDiskWrapper &wrapper = const_cast<OnDiskPt::OnDiskWrapper&>(GetImplementation());
const Phrase &phrase = inputPath.GetPhrase();
const InputPath *prevInputPath = inputPath.GetPrevNode();
@ -140,7 +146,6 @@ void PhraseDictionaryOnDisk::GetTargetPhraseCollectionBatch(const InputPathList
delete lastWordOnDisk;
}
}
}
}
}

View File

@ -60,6 +60,8 @@ protected:
OnDiskPt::OnDiskWrapper &GetImplementation();
const OnDiskPt::OnDiskWrapper &GetImplementation() const;
void GetTargetPhraseCollectionBatch(InputPath &inputPath) const;
public:
PhraseDictionaryOnDisk(const std::string &line);
~PhraseDictionaryOnDisk();
@ -75,7 +77,7 @@ public:
const ChartCellCollectionBase &);
virtual void InitializeForInput(InputType const& source);
void GetTargetPhraseCollectionBatch(const InputPathList &phraseDictionaryQueue) const;
void GetTargetPhraseCollectionBatch(const InputPathList &inputPathQueue) const;
};