mirror of
https://github.com/moses-smt/mosesdecoder.git
synced 2025-01-01 16:33:16 +03:00
add osmHyp
This commit is contained in:
parent
67ff37aed7
commit
79f8e64457
@ -78,6 +78,43 @@ void OpSequenceModel::EvaluateInIsolation(MemPool &pool,
|
||||
const TargetPhraseImpl &targetPhrase, Scores &scores,
|
||||
SCORE &estimatedScore) const
|
||||
{
|
||||
/*
|
||||
osmHypothesis obj;
|
||||
obj.setState(OSM->NullContextState());
|
||||
Bitmap myBitmap(source.GetSize());
|
||||
vector <string> mySourcePhrase;
|
||||
vector <string> myTargetPhrase;
|
||||
vector<float> scores;
|
||||
vector <int> alignments;
|
||||
int startIndex = 0;
|
||||
int endIndex = source.GetSize();
|
||||
|
||||
const AlignmentInfo &align = targetPhrase.GetAlignTerm();
|
||||
AlignmentInfo::const_iterator iter;
|
||||
|
||||
for (iter = align.begin(); iter != align.end(); ++iter) {
|
||||
alignments.push_back(iter->first);
|
||||
alignments.push_back(iter->second);
|
||||
}
|
||||
|
||||
for (size_t i = 0; i < targetPhrase.GetSize(); i++) {
|
||||
if (targetPhrase.GetWord(i).IsOOV() && sFactor == 0 && tFactor == 0)
|
||||
myTargetPhrase.push_back("_TRANS_SLF_");
|
||||
else
|
||||
myTargetPhrase.push_back(targetPhrase.GetWord(i).GetFactor(tFactor)->GetString().as_string());
|
||||
}
|
||||
|
||||
for (size_t i = 0; i < source.GetSize(); i++) {
|
||||
mySourcePhrase.push_back(source.GetWord(i).GetFactor(sFactor)->GetString().as_string());
|
||||
}
|
||||
|
||||
obj.setPhrases(mySourcePhrase , myTargetPhrase);
|
||||
obj.constructCepts(alignments,startIndex,endIndex-1,targetPhrase.GetSize());
|
||||
obj.computeOSMFeature(startIndex,myBitmap);
|
||||
obj.calculateOSMProb(*OSM);
|
||||
obj.populateScores(scores,numFeatures);
|
||||
estimatedScores.PlusEquals(this, scores);
|
||||
*/
|
||||
}
|
||||
|
||||
void OpSequenceModel::EvaluateInIsolation(MemPool &pool, const System &system, const Phrase<SCFG::Word> &source,
|
||||
|
0
contrib/moses2/FF/OSM/osmHyp.cpp
Normal file
0
contrib/moses2/FF/OSM/osmHyp.cpp
Normal file
0
contrib/moses2/FF/OSM/osmHyp.h
Normal file
0
contrib/moses2/FF/OSM/osmHyp.h
Normal file
Loading…
Reference in New Issue
Block a user