Merge branch 'GHKMStruct' of github.com:moses-smt/mosesdecoder into GHKMStruct

This commit is contained in:
Matthias Huck 2013-09-13 17:13:20 +02:00
commit 643fa18805
2 changed files with 23 additions and 4 deletions

7
GHKM_sparse_weights Normal file
View File

@ -0,0 +1,7 @@
InternalStructFeature_NTVBZ 0.1
InternalStructFeature_NTVBD 0.1
InternalStructFeature_NTVBP 0.1
InternalStructFeature_NTPP 0.1
InternalStructFeature_NTSBAR 0.1

View File

@ -11,7 +11,7 @@ InternalStructFeature::InternalStructFeature()
}
bool InternalStructFeature::equals(const PhraseAlignment& lhs, const PhraseAlignment& rhs) const{
cout<<"InternalStructFeature: Equals\n";
//cout<<"InternalStructFeature: Equals\n";
//don't know what it's used for and what we should compare
//-> if the dense score is the same
//-> if the sparse feature is set
@ -19,7 +19,13 @@ bool InternalStructFeature::equals(const PhraseAlignment& lhs, const PhraseAlign
/** Return true if the two phrase pairs are equal from the point of this feature. Assume
that they already compare true according to PhraseAlignment.equals()
**/
/* if(lhs.ghkmParse==rhs.ghkmParse)
return true;
else
return false;
*/
//return true;
}
void InternalStructFeature::add(const ScoreFeatureContext& context,
@ -52,9 +58,15 @@ void InternalStructFeatureSparse::add(std::string *internalStruct,
std::map<std::string,float>& sparseValues) const{
//cout<<"Sparse: "<<*internalStruct<<endl;
if(internalStruct->find("VBZ")!=std::string::npos)
sparseValues["NT_VBZ"] = 1;
sparseValues["NTVBZ"] = 1;
if(internalStruct->find("VBD")!=std::string::npos)
sparseValues["NT_VBD"] = 1;
sparseValues["NTVBD"] = 1;
if(internalStruct->find("VBP")!=std::string::npos)
sparseValues["NTVBP"] = 1;
if(internalStruct->find("PP")!=std::string::npos)
sparseValues["NTPP"] = 1;
if(internalStruct->find("SBAR")!=std::string::npos)
sparseValues["NTSBAR"] = 1;
}