mirror of
https://github.com/moses-smt/mosesdecoder.git
synced 2024-12-25 12:52:29 +03:00
port PhraseDictionaryMultiModelCounts to new format. Runs but doesn't pass regression test
This commit is contained in:
parent
66ad7c3c18
commit
81ffe84dbc
@ -174,6 +174,7 @@ void PhraseDictionaryMultiModel::CollectSufficientStatistics(const Phrase& src,
|
||||
}
|
||||
|
||||
statistics->targetPhrase->GetScoreBreakdown().Assign(this, scoreVector); // set scores to 0
|
||||
statistics->targetPhrase->Evaluate();
|
||||
|
||||
(*allStats)[targetString] = statistics;
|
||||
|
||||
@ -211,6 +212,8 @@ TargetPhraseCollection* PhraseDictionaryMultiModel::CreateTargetPhraseCollection
|
||||
cerr << endl;
|
||||
|
||||
statistics->targetPhrase->GetScoreBreakdown().Assign(this, scoreVector);
|
||||
statistics->targetPhrase->Evaluate();
|
||||
|
||||
ret->Add(new TargetPhrase(*statistics->targetPhrase));
|
||||
}
|
||||
return ret;
|
||||
|
@ -243,15 +243,16 @@ void PhraseDictionaryMultiModelCounts::CollectSufficientStatistics(const Phrase&
|
||||
//fill fs and allStats with statistics from models
|
||||
{
|
||||
for(size_t i = 0; i < m_numModels; ++i){
|
||||
const PhraseDictionary &pd = *m_pd[i];
|
||||
|
||||
TargetPhraseCollection *ret_raw = (TargetPhraseCollection*) m_pd[i]->GetTargetPhraseCollection( src);
|
||||
TargetPhraseCollection *ret_raw = (TargetPhraseCollection*) pd.GetTargetPhraseCollection( src);
|
||||
if (ret_raw != NULL) {
|
||||
|
||||
TargetPhraseCollection::iterator iterTargetPhrase;
|
||||
for (iterTargetPhrase = ret_raw->begin(); iterTargetPhrase != ret_raw->end(); ++iterTargetPhrase) {
|
||||
|
||||
TargetPhrase * targetPhrase = *iterTargetPhrase;
|
||||
vector<float> raw_scores = targetPhrase->GetScoreBreakdown().GetScoresForProducer(this);
|
||||
vector<float> raw_scores = targetPhrase->GetScoreBreakdown().GetScoresForProducer(&pd);
|
||||
|
||||
string targetString = targetPhrase->GetStringRep(m_output);
|
||||
if (allStats->find(targetString) == allStats->end()) {
|
||||
@ -259,6 +260,9 @@ void PhraseDictionaryMultiModelCounts::CollectSufficientStatistics(const Phrase&
|
||||
multiModelCountsStatistics * statistics = new multiModelCountsStatistics;
|
||||
statistics->targetPhrase = new TargetPhrase(*targetPhrase); //make a copy so that we don't overwrite the original phrase table info
|
||||
|
||||
// zero out scores from original phrase table
|
||||
statistics->targetPhrase->GetScoreBreakdown().ZeroDenseFeatures(&pd);
|
||||
|
||||
statistics->fst.resize(m_numModels);
|
||||
statistics->ft.resize(m_numModels);
|
||||
Scores scoreVector(5);
|
||||
@ -267,6 +271,11 @@ void PhraseDictionaryMultiModelCounts::CollectSufficientStatistics(const Phrase&
|
||||
scoreVector[2] = -raw_scores[2];
|
||||
statistics->targetPhrase->GetScoreBreakdown().Assign(this, scoreVector); // set scores to 0
|
||||
|
||||
cerr << *targetPhrase << endl;
|
||||
for (size_t i = 0; i < scoreVector.size(); ++i)
|
||||
cerr << scoreVector[i] << " ";
|
||||
cerr << endl;
|
||||
|
||||
(*allStats)[targetString] = statistics;
|
||||
|
||||
}
|
||||
@ -318,6 +327,11 @@ TargetPhraseCollection* PhraseDictionaryMultiModelCounts::CreateTargetPhraseColl
|
||||
scoreVector[3] = FloorScore(TransformScore(lexts));
|
||||
scoreVector[4] = FloorScore(TransformScore(2.718));
|
||||
|
||||
cerr << *statistics->targetPhrase << endl;
|
||||
for (size_t i = 0; i < scoreVector.size(); ++i)
|
||||
cerr << scoreVector[i] << " ";
|
||||
cerr << endl;
|
||||
|
||||
statistics->targetPhrase->GetScoreBreakdown().Assign(this, scoreVector);
|
||||
}
|
||||
catch (AlignmentException& e) {
|
||||
|
Loading…
Reference in New Issue
Block a user