debug PhraseDictionaryALSuffixArray for Wilker. Sparse feature score to do

This commit is contained in:
Hieu Hoang 2013-05-28 15:38:36 +01:00
parent 0580e2bd11
commit ed220e91a9
2 changed files with 10 additions and 7 deletions

View File

@ -31,20 +31,22 @@ PhraseDictionaryALSuffixArray::PhraseDictionaryALSuffixArray(const std::string &
void PhraseDictionaryALSuffixArray::InitializeForInput(InputType const& source) void PhraseDictionaryALSuffixArray::InitializeForInput(InputType const& source)
{ {
// clear out rules for previous sentence
m_collection.Clear();
// populate with rules for this sentence // populate with rules for this sentence
long translationId = source.GetTranslationId(); long translationId = source.GetTranslationId();
string grammarFile = GetFilePath() + "/grammar.out." + SPrint(translationId) + ".gz"; string grammarFile = GetFilePath() + "/grammar." + SPrint(translationId) + ".gz";
std::auto_ptr<RuleTableLoader> loader = std::auto_ptr<RuleTableLoader> loader =
RuleTableLoaderFactory::Create(grammarFile); RuleTableLoaderFactory::Create(grammarFile);
bool ret = loader->Load(*m_input, *m_output, grammarFile, m_tableLimit, bool ret = loader->Load(m_input, m_output, grammarFile, m_tableLimit,
*this); *this);
CHECK(ret); CHECK(ret);
} }
void PhraseDictionaryALSuffixArray::CleanUpAfterSentenceProcessing(const InputType &source)
{
m_collection.Clear();
}
} }

View File

@ -22,11 +22,12 @@ class PhraseDictionaryALSuffixArray : public PhraseDictionaryMemory
{ {
public: public:
PhraseDictionaryALSuffixArray(const std::string &line); PhraseDictionaryALSuffixArray(const std::string &line);
bool InitDictionary()
{ return true; }
void InitializeForInput(InputType const& source); void InitializeForInput(InputType const& source);
void CleanUpAfterSentenceProcessing(const InputType& source);
protected: protected:
const std::vector<FactorType> *m_input, *m_output;
}; };