mirror of
https://github.com/moses-smt/mosesdecoder.git
synced 2024-10-26 11:28:48 +03:00
sparse features in on-disk-pt
This commit is contained in:
parent
0114766b54
commit
747661ba3e
@ -160,11 +160,11 @@ OnDiskPt::PhrasePtr Tokenize(SourcePhrase &sourcePhrase, TargetPhrase &targetPhr
|
||||
case 5: {
|
||||
// sparse features
|
||||
sparseFeatures << tok << " ";
|
||||
break;
|
||||
break;
|
||||
}
|
||||
case 6: {
|
||||
property << tok << " ";
|
||||
break;
|
||||
property << tok << " ";
|
||||
break;
|
||||
}
|
||||
default:
|
||||
cerr << "ERROR in line " << line << endl;
|
||||
|
@ -31,7 +31,7 @@ using namespace std;
|
||||
namespace OnDiskPt
|
||||
{
|
||||
|
||||
int OnDiskWrapper::VERSION_NUM = 6;
|
||||
int OnDiskWrapper::VERSION_NUM = 7;
|
||||
|
||||
OnDiskWrapper::OnDiskWrapper()
|
||||
{
|
||||
|
@ -305,14 +305,15 @@ Moses::TargetPhrase *TargetPhrase::ConvertToMoses(const std::vector<Moses::Facto
|
||||
|
||||
// scores
|
||||
ret->GetScoreBreakdown().Assign(&phraseDict, m_scores);
|
||||
ret->Evaluate(mosesSP, phraseDict.GetFeaturesToApply());
|
||||
|
||||
// sparse features
|
||||
ret->???(m_sparseFeatures);
|
||||
ret->GetScoreBreakdown().Assign(&phraseDict, m_sparseFeatures);
|
||||
|
||||
// property
|
||||
ret->SetProperties(m_property);
|
||||
|
||||
ret->Evaluate(mosesSP, phraseDict.GetFeaturesToApply());
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
@ -354,7 +355,6 @@ UINT64 TargetPhrase::ReadStringFromFile(std::fstream &fileTPColl, std::string &o
|
||||
fileTPColl.read(mem, strSize);
|
||||
outStr = string(mem);
|
||||
free(mem);
|
||||
cerr << "outStr=" << outStr << endl;
|
||||
|
||||
bytesRead += strSize;
|
||||
}
|
||||
|
@ -214,7 +214,7 @@ void ScoreComponentCollection::Save(const string& filename) const
|
||||
|
||||
void
|
||||
ScoreComponentCollection::
|
||||
Assign(const FeatureFunction* sp, const string line)
|
||||
Assign(const FeatureFunction* sp, const string &line)
|
||||
{
|
||||
istringstream istr(line);
|
||||
while(istr) {
|
||||
|
@ -287,7 +287,7 @@ public:
|
||||
|
||||
|
||||
//Read sparse features from string
|
||||
void Assign(const FeatureFunction* sp, const std::string line);
|
||||
void Assign(const FeatureFunction* sp, const std::string &line);
|
||||
|
||||
// shortcut: setting the value directly using the feature name
|
||||
void Assign(const std::string name, float score) {
|
||||
|
Loading…
Reference in New Issue
Block a user