Lattice MBR now uses nbest list as default hypothesis set during reranking.

To use lattice instead as hypothesis set, run with -lattice-hypo-set option


git-svn-id: https://mosesdecoder.svn.sourceforge.net/svnroot/mosesdecoder/trunk@2843 1f5c12ca-751b-0410-a591-d2e778427230
This commit is contained in:
abarun 2010-02-03 11:20:20 +00:00
parent 6d7a710beb
commit 117f5ef329
6 changed files with 8 additions and 8 deletions

View File

@ -224,7 +224,7 @@ void calcNgramPosteriors(Lattice & connectedHyp, map<const Hypothesis*, vector<E
}
//Process ngrams now
for (int j =0 ; j < edges.size(); ++j) {
for (size_t j =0 ; j < edges.size(); ++j) {
Edge& edge = edges[j];
const NgramHistory & incomingPhrases = edge.GetNgrams(incomingEdges);

View File

@ -38,8 +38,8 @@ typedef map<Path, size_t> PathCounts;
typedef map<Phrase, PathCounts > NgramHistory;
class Edge {
const Hypothesis* m_headNode;
const Hypothesis* m_tailNode;
const Hypothesis* m_headNode;
float m_score;
TargetPhrase m_targetPhrase;
NgramHistory m_ngrams;

View File

@ -178,7 +178,7 @@ int main(int argc, char* argv[])
pruneLatticeFB(connectedList, outgoingHyps, incomingEdges, estimatedScores, staticData.GetLatticeMBRPruningFactor());
calcNgramPosteriors(connectedList, incomingEdges, staticData.GetMBRScale(), ngramPosteriors);
const Hypothesis *mbrBestHypo;
if (staticData.UseNbestHypSetForLatticeMBR()) {
if (!staticData.UseLatticeHypSetForLatticeMBR()) {
size_t nBestSize = staticData.GetMBRSize();
if (nBestSize <= 0)
{

View File

@ -94,7 +94,7 @@ Parameter::Parameter()
AddParam("mbr-scale", "scaling factor to convert log linear score probability in MBR decoding (default 1.0)");
AddParam("lmbr-thetas", "theta(s) for lattice mbr calculation");
AddParam("lmbr-pruning-factor", "average number of nodes/word wanted in pruned lattice");
AddParam("nbest-hypo-set", "to use nbest list as hypo set during lattice MBR");
AddParam("lattice-hypo-set", "to use lattice as hypo set during lattice MBR");
AddParam("use-persistent-cache", "cache translation options across sentences (default true)");
AddParam("persistent-cache-size", "maximum size of cache for translation options (default 10,000 input phrases)");
AddParam("recover-input-path", "r", "(conf net/word lattice only) - recover input path corresponding to the best translation");

View File

@ -337,7 +337,7 @@ bool StaticData::LoadData(Parameter *parameter)
m_lmbrPruning = (m_parameter->GetParam("lmbr-pruning-factor").size() > 0) ?
Scan<size_t>(m_parameter->GetParam("lmbr-pruning-factor")[0]) : 30;
m_lmbrThetas = Scan<float>(m_parameter->GetParam("lmbr-thetas"));
SetBooleanParameter( &m_useNbestHypSetForLatticeMBR, "nbest-hypo-set", false );
SetBooleanParameter( &m_useLatticeHypSetForLatticeMBR, "lattice-hypo-set", false );
m_timeout_threshold = (m_parameter->GetParam("time-out").size() > 0) ?
Scan<size_t>(m_parameter->GetParam("time-out")[0]) : -1;

View File

@ -146,7 +146,7 @@ protected:
float m_mbrScale; //! scaling factor for computing marginal probability of candidate translation
size_t m_lmbrPruning; //! average number of nodes per word wanted in pruned lattice
vector<float> m_lmbrThetas; //! theta(s) for lattice mbr calculation
bool m_useNbestHypSetForLatticeMBR; //! to use nbest as hypothesis set during lattice MBR
bool m_useLatticeHypSetForLatticeMBR; //! to use nbest as hypothesis set during lattice MBR
bool m_timeout; //! use timeout
size_t m_timeout_threshold; //! seconds after which time out is activated
@ -461,9 +461,9 @@ public:
float GetMBRScale() const { return m_mbrScale; }
size_t GetLatticeMBRPruningFactor() const { return m_lmbrPruning; }
const vector<float>& GetLatticeMBRThetas() const {return m_lmbrThetas;}
bool UseNbestHypSetForLatticeMBR() const { return m_useNbestHypSetForLatticeMBR;}
bool UseLatticeHypSetForLatticeMBR() const { return m_useLatticeHypSetForLatticeMBR;}
bool UseTimeout() const { return m_timeout; }
size_t GetTimeoutThreshold() const { return m_timeout_threshold; }