void PhraseDictionaryFuzzyMatch::Load()
{
  SetFeaturesToApply();

  assert(m_config.size() == 3);
  m_FuzzyMatchWrapper = new tmmt::FuzzyMatchWrapper(m_config[0], m_config[1], m_config[2]);
}
Beispiel #2
0
void PhraseDictionaryMultiModelCounts::Load()
{
  SetFeaturesToApply();
  for(size_t i = 0; i < m_numModels; ++i) {

    // phrase table
    const string &ptName = m_pdStr[i];

    PhraseDictionary *pt;
    pt = FindPhraseDictionary(ptName);
    CHECK(pt);
    m_pd.push_back(pt);

    // reverse
    const string &target_table = m_targetTable[i];
    pt = FindPhraseDictionary(target_table);
    CHECK(pt);
    m_inverse_pd.push_back(pt);

    // lex
    string lex_e2f = m_lexE2FStr[i];
    string lex_f2e = m_lexF2EStr[i];
    lexicalTable* e2f = new lexicalTable;
    LoadLexicalTable(lex_e2f, e2f);
    lexicalTable* f2e = new lexicalTable;
    LoadLexicalTable(lex_f2e, f2e);

    m_lexTable_e2f.push_back(e2f);
    m_lexTable_f2e.push_back(f2e);

  }

}
void PhraseDictionaryMultiModel::Load()
{
  SetFeaturesToApply();

  for(size_t i = 0; i < m_numModels; ++i) {
    const string &ptName = m_pdStr[i];

    PhraseDictionary *pt = FindPhraseDictionary(ptName);
    UTIL_THROW_IF2(pt == NULL,
                   "Could not find component phrase table " << ptName);
    m_pd.push_back(pt);
  }
}
Beispiel #4
0
void RuleTableTrie::Load()
{
  SetFeaturesToApply();

  std::auto_ptr<Moses::RuleTableLoader> loader =
    Moses::RuleTableLoaderFactory::Create(m_filePath);
  if (!loader.get()) {
    throw runtime_error("Error: Loading " + m_filePath);
  }

  bool ret = loader->Load(m_input, m_output, m_filePath, m_tableLimit,
                          *this);
  if (!ret) {
    throw runtime_error("Error: Loading " + m_filePath);
  }
}
void PhraseDictionaryCompact::Load()
{
  const StaticData &staticData = StaticData::Instance();

  SetFeaturesToApply();

  m_weight = staticData.GetWeights(this);

  std::string tFilePath = m_filePath;

  std::string suffix = ".minphr";
  if (!ends_with(tFilePath, suffix)) tFilePath += suffix;
  if (!FileExists(tFilePath))
    throw runtime_error("Error: File " + tFilePath + " does not exist.");

  m_phraseDecoder = new PhraseDecoder(*this, &m_input, &m_output,
                                      m_numScoreComponents, &m_weight);

  std::FILE* pFile = std::fopen(tFilePath.c_str() , "r");

  size_t indexSize;
  if(m_inMemory)
    // Load source phrase index into memory
    indexSize = m_hash.Load(pFile);
  else
    // Keep source phrase index on disk
    indexSize = m_hash.LoadIndex(pFile);

  size_t coderSize = m_phraseDecoder->Load(pFile);

  size_t phraseSize;
  if(m_inMemory)
    // Load target phrase collections into memory
    phraseSize = m_targetPhrasesMemory.load(pFile, false);
  else
    // Keep target phrase collections on disk
    phraseSize = m_targetPhrasesMapped.load(pFile, true);

  UTIL_THROW_IF2(indexSize == 0 || coderSize == 0 || phraseSize == 0,
                 "Not successfully loaded");
}
void PhraseDictionaryOnDisk::Load()
{
  SetFeaturesToApply();
}
Beispiel #7
0
void PhraseDictionaryALSuffixArray::Load()
{
    SetFeaturesToApply();
}
void PhraseDictionaryTransliteration::Load()
{
	SetFeaturesToApply();
}
void PhraseDictionaryTreeAdaptor::Load()
{
  SetFeaturesToApply();
}