This commit is contained in:
Hieu Hoang 2015-11-17 10:33:25 +00:00
parent 40946eb345
commit d5f02dc167
4 changed files with 30 additions and 4 deletions

View File

@ -115,8 +115,8 @@ FeatureFunction *FeatureFunctions::Create(const std::string &line)
ret = new LanguageModel(m_ffStartInd, line);
}
else if (toks[0] == "KENLM") {
//ret = new KENLM(m_ffStartInd, line);
ret = new KENLMBatch(m_ffStartInd, line);
ret = new KENLM(m_ffStartInd, line);
//ret = new KENLMBatch(m_ffStartInd, line);
}
else {
//ret = new SkeletonStatefulFF(m_ffStartInd, line);

View File

@ -57,13 +57,20 @@ void Manager::Init()
m_bitmaps = new Bitmaps(m_input->GetSize(), vector<bool>(0));
switch (system.searchAlgorithm) {
switch (system.searchAlgorithm) {
case Normal:
//m_search = new SearchNormal(*this, m_stacks);
m_search = new SearchNormal(*this, m_stacks);
break;
case NormalBatch:
cerr << "BATCH" << endl;
m_search = new SearchNormalBatch(*this, m_stacks);
break;
case CubePruning:
m_search = new SearchCubePruning(*this, m_stacks);
break;
default:
cerr << "Unknown search algorithm" << endl;
abort();
}
}

View File

@ -10,9 +10,21 @@
typedef float SCORE;
// Note: StaticData uses SearchAlgorithm to determine whether the translation
// model is phrase-based or syntax-based. If you add a syntax-based search
// algorithm here then you should also update StaticData::IsSyntax().
enum SearchAlgorithm {
Normal = 0,
CubePruning = 1,
//,CubeGrowing = 2
CYKPlus = 3,
NormalBatch = 4,
ChartIncremental = 5,
SyntaxS2T = 6,
SyntaxT2S = 7,
SyntaxT2S_SCFG = 8,
SyntaxF2S = 9,
DefaultSearchAlgorithm = 777 // means: use StaticData.m_searchAlgorithm
};

View File

@ -7,6 +7,7 @@
#include <sstream>
#include <vector>
#include <cmath>
#include "../TypeDef.h"
#define NOT_FOUND std::numeric_limits<size_t>::max()
typedef size_t FactorType;
@ -71,6 +72,12 @@ inline std::string Scan<std::string>(const std::string &input)
template<>
bool Scan<bool>(const std::string &input);
template<>
inline SearchAlgorithm Scan<SearchAlgorithm>(const std::string &input)
{
return (SearchAlgorithm) Scan<size_t>(input);
}
//! convert vectors of string to vectors of type T variables
template<typename T>
inline std::vector<T> Scan(const std::vector< std::string > &input)