Classes | |
class | IOWrapper |
class | Edge |
class | NgramScores |
class | LatticeMBRSolution |
struct | LatticeMBRSolutionComparator |
class | Grid |
class | TranslationTask |
Typedefs | |
typedef std::vector< const Moses::Hypothesis * > | Lattice |
typedef std::vector< const Edge * > | Path |
typedef std::map< Path, size_t > | PathCounts |
typedef std::map < Moses::Phrase, PathCounts > | NgramHistory |
Functions | |
void | OutputSurface (std::ostream &out, const Hypothesis &edge, const std::vector< FactorType > &outputFactorOrder, bool reportSegmentation, bool reportAllFactors) |
void | OutputBestSurface (std::ostream &out, const Hypothesis *hypo, const std::vector< FactorType > &outputFactorOrder, bool reportSegmentation, bool reportAllFactors) |
void | OutputAlignment (ostream &out, const AlignmentInfo &ai, size_t sourceOffset, size_t targetOffset) |
void | OutputAlignment (ostream &out, const vector< const Hypothesis * > &edges) |
void | OutputAlignment (std::ostream &out, const Moses::Hypothesis *hypo) |
void | OutputAlignment (OutputCollector *collector, size_t lineNo, const vector< const Hypothesis * > &edges) |
void | OutputAlignment (OutputCollector *collector, size_t lineNo, const Hypothesis *hypo) |
void | OutputAlignment (OutputCollector *collector, size_t lineNo, const TrellisPath &path) |
void | OutputBestHypo (const Moses::TrellisPath &path, long, bool reportSegmentation, bool reportAllFactors, std::ostream &out) |
void | OutputBestHypo (const std::vector< Word > &mbrBestHypo, long, bool, bool, ostream &out) |
void | OutputInput (std::vector< const Phrase * > &map, const Hypothesis *hypo) |
void | OutputInput (std::ostream &os, const Hypothesis *hypo) |
void | OutputNBest (std::ostream &out, const Moses::TrellisPathList &nBestList, const std::vector< Moses::FactorType > &outputFactorOrder, long translationId, bool reportSegmentation) |
void | OutputAllFeatureScores (const Moses::ScoreComponentCollection &features, std::ostream &out) |
void | OutputFeatureScores (std::ostream &out, const ScoreComponentCollection &features, const FeatureFunction *ff, std::string &lastName) |
void | OutputLatticeMBRNBest (std::ostream &out, const vector< LatticeMBRSolution > &solutions, long translationId) |
bool | ReadInput (IOWrapper &ioWrapper, InputTypeEnum inputType, InputType *&source) |
IOWrapper * | GetIOWrapper (const StaticData &staticData) |
void | OutputBestSurface (std::ostream &out, const Moses::Hypothesis *hypo, const std::vector< Moses::FactorType > &outputFactorOrder, bool reportSegmentation, bool reportAllFactors) |
void | OutputLatticeMBRNBest (std::ostream &out, const std::vector< LatticeMBRSolution > &solutions, long translationId) |
void | OutputBestHypo (const std::vector< Moses::Word > &mbrBestHypo, long, bool reportSegmentation, bool reportAllFactors, std::ostream &out) |
void | GetOutputWords (const TrellisPath &path, vector< Word > &translation) |
void | extract_ngrams (const vector< Word > &sentence, map< Phrase, int > &allngrams) |
void | pruneLatticeFB (Lattice &connectedHyp, map< const Hypothesis *, set< const Hypothesis * > > &outgoingHyps, map< const Hypothesis *, vector< Edge > > &incomingEdges, const vector< float > &estimatedScores, const Hypothesis *bestHypo, size_t edgeDensity, float scale) |
void | calcNgramExpectations (Lattice &connectedHyp, map< const Hypothesis *, vector< Edge > > &incomingEdges, map< Phrase, float > &finalNgramScores, bool posteriors) |
ostream & | operator<< (ostream &out, const Edge &edge) |
bool | ascendingCoverageCmp (const Hypothesis *a, const Hypothesis *b) |
void | getLatticeMBRNBest (Manager &manager, TrellisPathList &nBestList, vector< LatticeMBRSolution > &solutions, size_t n) |
vector< Word > | doLatticeMBR (Manager &manager, TrellisPathList &nBestList) |
const TrellisPath | doConsensusDecoding (Manager &manager, TrellisPathList &nBestList) |
void | pruneLatticeFB (Lattice &connectedHyp, std::map< const Moses::Hypothesis *, std::set< const Moses::Hypothesis * > > &outgoingHyps, std::map< const Moses::Hypothesis *, std::vector< Edge > > &incomingEdges, const std::vector< float > &estimatedScores, const Moses::Hypothesis *, size_t edgeDensity, float scale) |
void | getLatticeMBRNBest (Moses::Manager &manager, Moses::TrellisPathList &nBestList, std::vector< LatticeMBRSolution > &solutions, size_t n) |
void | calcNgramExpectations (Lattice &connectedHyp, std::map< const Moses::Hypothesis *, std::vector< Edge > > &incomingEdges, std::map< Moses::Phrase, float > &finalNgramScores, bool posteriors) |
void | GetOutputFactors (const Moses::TrellisPath &path, std::vector< Moses::Word > &translation) |
void | extract_ngrams (const std::vector< Moses::Word > &sentence, std::map< Moses::Phrase, int > &allngrams) |
void | fix (std::ostream &stream, size_t size) |
size_t | OutputFeatureWeightsForHypergraph (size_t index, const FeatureFunction *ff, std::ostream &outputSearchGraphStream) |
void | OutputFeatureWeightsForHypergraph (std::ostream &outputSearchGraphStream) |
Variables | |
size_t | bleu_order = 4 |
float | UNKNGRAMLOGPROB = -20 |
typedef std::vector< const Moses::Hypothesis *> MosesCmd::Lattice |
Definition at line 25 of file LatticeMBR.h.
typedef std::map<Moses::Phrase, PathCounts > MosesCmd::NgramHistory |
Definition at line 30 of file LatticeMBR.h.
typedef std::vector<const Edge*> MosesCmd::Path |
Definition at line 28 of file LatticeMBR.h.
typedef std::map<Path, size_t> MosesCmd::PathCounts |
Definition at line 29 of file LatticeMBR.h.
bool MosesCmd::ascendingCoverageCmp | ( | const Hypothesis * | a, | |
const Hypothesis * | b | |||
) |
Definition at line 498 of file LatticeMBR.cpp.
References Moses::WordsBitmap::GetNumWordsCovered(), and Moses::Hypothesis::GetWordsBitmap().
Referenced by calcNgramExpectations().
void MosesCmd::calcNgramExpectations | ( | Lattice & | connectedHyp, | |
std::map< const Moses::Hypothesis *, std::vector< Edge > > & | incomingEdges, | |||
std::map< Moses::Phrase, float > & | finalNgramScores, | |||
bool | posteriors | |||
) |
void MosesCmd::calcNgramExpectations | ( | Lattice & | connectedHyp, | |
map< const Hypothesis *, vector< Edge > > & | incomingEdges, | |||
map< Phrase, float > & | finalNgramScores, | |||
bool | posteriors | |||
) |
Definition at line 279 of file LatticeMBR.cpp.
References MosesCmd::NgramScores::addScore(), Moses::Phrase::AddWord(), Moses::ARRAY_SIZE_INCR, ascendingCoverageCmp(), bleu_order, count, end, Moses::Hypothesis::GetId(), MosesCmd::Edge::GetNgrams(), Moses::WordsBitmap::GetNumWordsCovered(), MosesCmd::Edge::GetPhraseSuffix(), MosesCmd::Edge::GetScore(), Moses::Phrase::GetSize(), MosesCmd::Edge::GetTailNode(), Moses::Phrase::GetWord(), MosesCmd::Edge::GetWords(), Moses::Hypothesis::GetWordsBitmap(), MosesCmd::Edge::GetWordsSize(), IFVERBOSE, index, Moses::WordsBitmap::IsComplete(), k, Moses::log_sum(), MosesCmd::NgramScores::nodeBegin(), MosesCmd::NgramScores::nodeEnd(), MosesCmd::Edge::storeNgramHistory(), and VERBOSE.
Referenced by doConsensusDecoding(), and getLatticeMBRNBest().
const Moses::TrellisPath MosesCmd::doConsensusDecoding | ( | Manager & | manager, | |
TrellisPathList & | nBestList | |||
) |
Definition at line 558 of file LatticeMBR.cpp.
References Moses::TrellisPathList::begin(), BLEU_ORDER, calcNgramExpectations(), Moses::TrellisPathList::end(), extract_ngrams(), Moses::Manager::GetBestHypothesis(), Moses::Manager::GetForwardBackwardSearchGraph(), Moses::StaticData::GetLatticeMBRPruningFactor(), Moses::StaticData::GetMBRScale(), GetOutputWords(), pruneLatticeFB(), SMOOTH, and VERBOSE.
Referenced by MosesCmd::TranslationTask::Run().
std::vector< Moses::Word > MosesCmd::doLatticeMBR | ( | Manager & | manager, | |
TrellisPathList & | nBestList | |||
) |
Definition at line 550 of file LatticeMBR.cpp.
References getLatticeMBRNBest().
Referenced by main(), and MosesCmd::TranslationTask::Run().
void MosesCmd::extract_ngrams | ( | const std::vector< Moses::Word > & | sentence, | |
std::map< Moses::Phrase, int > & | allngrams | |||
) |
Definition at line 39 of file LatticeMBR.cpp.
References Moses::Phrase::AddWord(), bleu_order, and k.
Referenced by doConsensusDecoding(), and doMBR().
void MosesCmd::fix | ( | std::ostream & | stream, | |
size_t | size | |||
) |
Enforce rounding
Definition at line 71 of file Main.cpp.
Referenced by main(), and MosesCmd::TranslationTask::Run().
IOWrapper * MosesCmd::GetIOWrapper | ( | const StaticData & | staticData | ) |
Definition at line 553 of file IOWrapper.cpp.
Referenced by main().
void MosesCmd::getLatticeMBRNBest | ( | Moses::Manager & | manager, | |
Moses::TrellisPathList & | nBestList, | |||
std::vector< LatticeMBRSolution > & | solutions, | |||
size_t | n | |||
) |
void MosesCmd::getLatticeMBRNBest | ( | Manager & | manager, | |
TrellisPathList & | nBestList, | |||
vector< LatticeMBRSolution > & | solutions, | |||
size_t | n | |||
) |
Definition at line 503 of file LatticeMBR.cpp.
References Moses::TrellisPathList::begin(), bleu_order, calcNgramExpectations(), Moses::TrellisPathList::end(), Moses::Manager::GetBestHypothesis(), Moses::Manager::GetForwardBackwardSearchGraph(), Moses::StaticData::GetLatticeMBRMapWeight(), Moses::StaticData::GetLatticeMBRPRatio(), Moses::StaticData::GetLatticeMBRPrecision(), Moses::StaticData::GetLatticeMBRPruningFactor(), Moses::StaticData::GetLatticeMBRThetas(), Moses::StaticData::GetMBRScale(), IFVERBOSE, pruneLatticeFB(), and VERBOSE.
Referenced by doLatticeMBR(), and MosesCmd::TranslationTask::Run().
void MosesCmd::GetOutputFactors | ( | const Moses::TrellisPath & | path, | |
std::vector< Moses::Word > & | translation | |||
) |
void MosesCmd::GetOutputWords | ( | const TrellisPath & | path, | |
vector< Word > & | translation | |||
) |
Definition at line 23 of file LatticeMBR.cpp.
References Moses::Hypothesis::GetCurrTargetPhrase(), Moses::TrellisPath::GetEdges(), Moses::Phrase::GetSize(), and Moses::Phrase::GetWord().
Referenced by doConsensusDecoding().
ostream& MosesCmd::operator<< | ( | ostream & | out, | |
const Edge & | edge | |||
) |
Definition at line 492 of file LatticeMBR.cpp.
References Moses::Hypothesis::GetId().
void MosesCmd::OutputAlignment | ( | OutputCollector * | collector, | |
size_t | lineNo, | |||
const TrellisPath & | path | |||
) |
Definition at line 299 of file IOWrapper.cpp.
References Moses::TrellisPath::GetEdges(), and OutputAlignment().
void MosesCmd::OutputAlignment | ( | OutputCollector * | collector, | |
size_t | lineNo, | |||
const Hypothesis * | hypo | |||
) |
Definition at line 285 of file IOWrapper.cpp.
References Moses::Hypothesis::GetPrevHypo(), and OutputAlignment().
void MosesCmd::OutputAlignment | ( | OutputCollector * | collector, | |
size_t | lineNo, | |||
const vector< const Hypothesis * > & | edges | |||
) |
Definition at line 277 of file IOWrapper.cpp.
References OutputAlignment(), and Moses::OutputCollector::Write().
void MosesCmd::OutputAlignment | ( | std::ostream & | out, | |
const Moses::Hypothesis * | hypo | |||
) |
Definition at line 264 of file IOWrapper.cpp.
References Moses::Hypothesis::GetPrevHypo(), and OutputAlignment().
void MosesCmd::OutputAlignment | ( | ostream & | out, | |
const vector< const Hypothesis * > & | edges | |||
) |
Definition at line 248 of file IOWrapper.cpp.
References Moses::TargetPhrase::GetAlignTerm(), Moses::Hypothesis::GetCurrSourceWordsRange(), Moses::Hypothesis::GetCurrTargetPhrase(), Moses::Phrase::GetSize(), Moses::WordsRange::GetStartPos(), and OutputAlignment().
void MosesCmd::OutputAlignment | ( | ostream & | out, | |
const AlignmentInfo & | ai, | |||
size_t | sourceOffset, | |||
size_t | targetOffset | |||
) |
Definition at line 235 of file IOWrapper.cpp.
References Moses::AlignmentInfo::GetSortedAlignments().
Referenced by OutputAlignment(), OutputNBest(), and MosesCmd::TranslationTask::Run().
void MosesCmd::OutputAllFeatureScores | ( | const Moses::ScoreComponentCollection & | features, | |
std::ostream & | out | |||
) |
Definition at line 454 of file IOWrapper.cpp.
References Moses::FeatureFunction::GetScoreProducerDescription(), Moses::FeatureFunction::IsTuneable(), and OutputFeatureScores().
Referenced by OutputNBest().
void MosesCmd::OutputBestHypo | ( | const std::vector< Moses::Word > & | mbrBestHypo, | |
long | , | |||
bool | reportSegmentation, | |||
bool | reportAllFactors, | |||
std::ostream & | out | |||
) |
void MosesCmd::OutputBestHypo | ( | const std::vector< Word > & | mbrBestHypo, | |
long | , | |||
bool | , | |||
bool | , | |||
ostream & | out | |||
) |
void MosesCmd::OutputBestHypo | ( | const Moses::TrellisPath & | path, | |
long | , | |||
bool | reportSegmentation, | |||
bool | reportAllFactors, | |||
std::ostream & | out | |||
) |
Definition at line 306 of file IOWrapper.cpp.
References Moses::TrellisPath::GetEdges(), and OutputSurface().
Referenced by main(), and MosesCmd::TranslationTask::Run().
void MosesCmd::OutputBestSurface | ( | std::ostream & | out, | |
const Moses::Hypothesis * | hypo, | |||
const std::vector< Moses::FactorType > & | outputFactorOrder, | |||
bool | reportSegmentation, | |||
bool | reportAllFactors | |||
) |
void MosesCmd::OutputBestSurface | ( | std::ostream & | out, | |
const Hypothesis * | hypo, | |||
const std::vector< FactorType > & | outputFactorOrder, | |||
bool | reportSegmentation, | |||
bool | reportAllFactors | |||
) |
Definition at line 225 of file IOWrapper.cpp.
References Moses::Hypothesis::GetPrevHypo(), NULL, and OutputSurface().
Referenced by MosesCmd::IOWrapper::OutputBestHypo(), and MosesCmd::TranslationTask::Run().
void MosesCmd::OutputFeatureScores | ( | std::ostream & | out, | |
const ScoreComponentCollection & | features, | |||
const FeatureFunction * | ff, | |||
std::string & | lastName | |||
) |
Definition at line 475 of file IOWrapper.cpp.
References Moses::FVector::cbegin(), Moses::FVector::cend(), Moses::FeatureFunction::GetNumScoreComponents(), Moses::FeatureFunction::GetScoreProducerDescription(), Moses::ScoreComponentCollection::GetScoresForProducer(), Moses::ScoreComponentCollection::GetVectorForProducer(), and Moses::StaticData::IsLabeledNBestList().
Referenced by OutputAllFeatureScores().
void MosesCmd::OutputFeatureWeightsForHypergraph | ( | std::ostream & | outputSearchGraphStream | ) |
Definition at line 501 of file Main.cpp.
References Moses::StaticData::GetGenerationDictionaries(), Moses::StaticData::GetPhraseDictionaries(), and OutputFeatureWeightsForHypergraph().
size_t MosesCmd::OutputFeatureWeightsForHypergraph | ( | size_t | index, | |
const FeatureFunction * | ff, | |||
std::ostream & | outputSearchGraphStream | |||
) |
Definition at line 478 of file Main.cpp.
References Moses::FeatureFunction::GetNumScoreComponents(), and Moses::FeatureFunction::GetScoreProducerDescription().
Referenced by main(), and OutputFeatureWeightsForHypergraph().
void MosesCmd::OutputInput | ( | std::ostream & | os, | |
const Hypothesis * | hypo | |||
) |
Definition at line 347 of file IOWrapper.cpp.
References Moses::Hypothesis::GetInput(), Moses::InputType::GetSize(), and OutputInput().
void MosesCmd::OutputInput | ( | std::vector< const Phrase * > & | map, | |
const Hypothesis * | hypo | |||
) |
Definition at line 339 of file IOWrapper.cpp.
References Moses::Hypothesis::GetCurrSourceWordsRange(), Moses::Hypothesis::GetPrevHypo(), Moses::Hypothesis::GetSourcePhrase(), and Moses::WordsRange::GetStartPos().
Referenced by MosesCmd::IOWrapper::OutputBestHypo(), OutputInput(), OutputNBest(), and MosesCmd::TranslationTask::Run().
void MosesCmd::OutputLatticeMBRNBest | ( | std::ostream & | out, | |
const std::vector< LatticeMBRSolution > & | solutions, | |||
long | translationId | |||
) |
void MosesCmd::OutputLatticeMBRNBest | ( | std::ostream & | out, | |
const vector< LatticeMBRSolution > & | solutions, | |||
long | translationId | |||
) |
Definition at line 502 of file IOWrapper.cpp.
Referenced by MosesCmd::TranslationTask::Run().
void MosesCmd::OutputNBest | ( | std::ostream & | out, | |
const Moses::TrellisPathList & | nBestList, | |||
const std::vector< Moses::FactorType > & | outputFactorOrder, | |||
long | translationId, | |||
bool | reportSegmentation | |||
) |
Definition at line 379 of file IOWrapper.cpp.
References Moses::TrellisPathList::begin(), Moses::TrellisPathList::end(), Moses::TargetPhrase::GetAlignTerm(), Moses::Hypothesis::GetCurrSourceWordsRange(), Moses::Hypothesis::GetCurrTargetPhrase(), Moses::TrellisPath::GetEdges(), Moses::WordsRange::GetEndPos(), Moses::StaticData::GetReportAllFactorsNBest(), Moses::TrellisPath::GetScoreBreakdown(), Moses::WordsRange::GetStartPos(), Moses::TrellisPath::GetTargetWordsRange(), Moses::TrellisPath::GetTotalScore(), Moses::StaticData::IsLabeledNBestList(), Moses::StaticData::NBestIncludesSegmentation(), OutputAlignment(), OutputAllFeatureScores(), OutputInput(), OutputSurface(), and Moses::StaticData::PrintAlignmentInfoInNbest().
Referenced by MosesCmd::TranslationTask::Run().
void MosesCmd::OutputSurface | ( | std::ostream & | out, | |
const Hypothesis & | edge, | |||
const std::vector< FactorType > & | outputFactorOrder, | |||
bool | reportSegmentation, | |||
bool | reportAllFactors | |||
) |
Definition at line 194 of file IOWrapper.cpp.
References CHECK, Moses::Hypothesis::GetCurrSourceWordsRange(), Moses::Hypothesis::GetCurrTargetPhrase(), Moses::WordsRange::GetEndPos(), Moses::Phrase::GetSize(), and Moses::WordsRange::GetStartPos().
Referenced by OutputBestHypo(), OutputBestSurface(), and OutputNBest().
void MosesCmd::pruneLatticeFB | ( | Lattice & | connectedHyp, | |
std::map< const Moses::Hypothesis *, std::set< const Moses::Hypothesis * > > & | outgoingHyps, | |||
std::map< const Moses::Hypothesis *, std::vector< Edge > > & | incomingEdges, | |||
const std::vector< float > & | estimatedScores, | |||
const Moses::Hypothesis * | , | |||
size_t | edgeDensity, | |||
float | scale | |||
) |
void MosesCmd::pruneLatticeFB | ( | Lattice & | connectedHyp, | |
map< const Hypothesis *, set< const Hypothesis * > > & | outgoingHyps, | |||
map< const Hypothesis *, vector< Edge > > & | incomingEdges, | |||
const vector< float > & | estimatedScores, | |||
const Hypothesis * | bestHypo, | |||
size_t | edgeDensity, | |||
float | scale | |||
) |
Definition at line 134 of file LatticeMBR.cpp.
References Moses::Hypothesis::GetArcList(), Moses::Hypothesis::GetCurrTargetPhrase(), Moses::Hypothesis::GetId(), Moses::Hypothesis::GetPrevHypo(), Moses::Hypothesis::GetScore(), Moses::Hypothesis::GetSize(), IFVERBOSE, NULL, and VERBOSE.
Referenced by doConsensusDecoding(), and getLatticeMBRNBest().
bool MosesCmd::ReadInput | ( | IOWrapper & | ioWrapper, | |
InputTypeEnum | inputType, | |||
InputType *& | source | |||
) |
Definition at line 532 of file IOWrapper.cpp.
References Moses::ConfusionNetworkInput, MosesCmd::IOWrapper::GetInput(), Moses::SentenceInput, TRACE_ERR, and Moses::WordLatticeInput.
size_t MosesCmd::bleu_order = 4 |
Definition at line 21 of file LatticeMBR.cpp.
Referenced by calcNgramExpectations(), extract_ngrams(), and getLatticeMBRNBest().
float MosesCmd::UNKNGRAMLOGPROB = -20 |
Definition at line 22 of file LatticeMBR.cpp.