compiles with bjam

This commit is contained in:
Hieu Hoang 2014-07-15 15:26:50 +01:00
parent 08be3b6b4f
commit 53073726d6
6 changed files with 40 additions and 4 deletions

View File

@ -114,6 +114,13 @@ requirements += [ option.get "with-mm" : : <define>PT_UG ] ;
requirements += [ option.get "with-mm" : : <define>MAX_NUM_FACTORS=4 ] ;
requirements += [ option.get "unlabelled-source" : : <define>UNLABELLED_SOURCE ] ;
if [ option.get "with-lbllm" ] {
external-lib boost_serialization ;
external-lib gomp ;
requirements += <library>boost_serialization ;
requirements += <library>gomp ;
}
if [ option.get "with-cmph" ] {
requirements += <define>HAVE_CMPH ;
}

View File

@ -10,7 +10,14 @@ if $(with-dlib) {
dlib = ;
}
alias headers : ../util//kenutil : : : $(max-factors) $(dlib) ;
with-lbllm = [ option.get "with-lbllm" ] ;
if $(with-lbllm) {
lbllm2 = <cxxflags>-std=c++0x <define>LM_LBL <include>$(with-lbllm)/src <include>$(with-lbllm)/3rdparty/eigen-3 ;
} else {
lbllm2 = ;
}
alias headers : ../util//kenutil : : : $(max-factors) $(dlib) $(lbllm2) ;
alias ThreadPool : ThreadPool.cpp ;
alias Util : Util.cpp Timer.cpp ;

View File

@ -93,13 +93,16 @@ if $(with-nplm) {
#LBLLM
local with-lbllm = [ option.get "with-lbllm" ] ;
if $(with-lbllm) {
lib lblLM : : <search>$(with-lbllm)/lib <search>$(with-lbllm)/lib64 ;
obj LBLLM.o : LBLLM.cpp lblLM ..//headers : <include>$(with-lbllm)/src <include>$(with-lbllm)/3rdparty/eigen-3 ;
alias lbllm : LBLLM.o lblLM : : : <cxxflags>-std=c++0x <linkflags>-std=c++0x <define>LM_LBL ;
lib lbl : : <search>$(with-lbllm)/lib <search>$(with-lbllm)/lib64 ;
obj LBLLM.o : LBLLM.cpp lbl ..//headers : <include>$(with-lbllm)/src <include>$(with-lbllm)/3rdparty/eigen-3 ;
obj LBLLM2.o : oxlm/LBLLM2.cpp lbl ..//headers : <include>$(with-lbllm)/src <include>$(with-lbllm)/3rdparty/eigen-3 ;
obj Mapper.o : oxlm/Mapper.cpp lbl ..//headers : <include>$(with-lbllm)/src <include>$(with-lbllm)/3rdparty/eigen-3 ;
alias lbllm : LBLLM.o LBLLM2.o Mapper.o lbl : : : <cxxflags>-std=c++0x <define>LM_LBL ;
dependencies += lbllm ;
lmmacros += LM_LBL ;
}
#DALM
local with-dalm = [ option.get "with-dalm" ] ;
if $(with-dalm) {

View File

@ -87,6 +87,17 @@ void LanguageModelSingleFactor::SetParameter(const std::string& key, const std::
}
}
std::string LanguageModelSingleFactor::DebugContextFactor(const std::vector<const Word*> &contextFactor) const
{
std::string ret;
for (size_t i = 0; i < contextFactor.size(); ++i) {
const Word &word = *contextFactor[i];
ret += word.ToString();
}
return ret;
}
}

View File

@ -67,6 +67,8 @@ public:
virtual LMResult GetValueForgotState(const std::vector<const Word*> &contextFactor, FFState &outState) const;
virtual LMResult GetValue(const std::vector<const Word*> &contextFactor, State* finalState = NULL) const = 0;
std::string DebugContextFactor(const std::vector<const Word*> &contextFactor) const;
};

View File

@ -68,6 +68,11 @@ public:
virtual LMResult GetValue(const std::vector<const Word*> &contextFactor, State* finalState = 0) const
{
std::string str = DebugContextFactor(contextFactor);
if (str == "unterstützende ") {
std::cerr << str << std::endl;
}
std::vector<int> ids;
ids = mapper->convert(contextFactor);
int word = ids.back();
@ -77,6 +82,7 @@ public:
double score;
score = model.predict(word, ids);
std::cerr << "contextFactor=" << str << " " << score << std::endl;
LMResult ret;
ret.score = score;