2008-06-11 14:52:57 +04:00
|
|
|
// $Id$
|
|
|
|
|
|
|
|
/***********************************************************************
|
|
|
|
Moses - factored phrase-based language decoder
|
|
|
|
Copyright (C) 2006 University of Edinburgh
|
|
|
|
|
|
|
|
This library is free software; you can redistribute it and/or
|
|
|
|
modify it under the terms of the GNU Lesser General Public
|
|
|
|
License as published by the Free Software Foundation; either
|
|
|
|
version 2.1 of the License, or (at your option) any later version.
|
|
|
|
|
|
|
|
This library is distributed in the hope that it will be useful,
|
|
|
|
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
|
|
|
Lesser General Public License for more details.
|
|
|
|
|
|
|
|
You should have received a copy of the GNU Lesser General Public
|
|
|
|
License along with this library; if not, write to the Free Software
|
|
|
|
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
|
|
|
***********************************************************************/
|
|
|
|
|
2010-02-24 14:15:44 +03:00
|
|
|
#ifndef moses_StaticData_h
|
|
|
|
#define moses_StaticData_h
|
2008-06-11 14:52:57 +04:00
|
|
|
|
2010-01-28 13:39:43 +03:00
|
|
|
#include <limits>
|
2008-06-11 14:52:57 +04:00
|
|
|
#include <list>
|
|
|
|
#include <vector>
|
|
|
|
#include <map>
|
|
|
|
#include <memory>
|
2010-01-28 13:39:43 +03:00
|
|
|
#include <utility>
|
2009-08-07 20:47:54 +04:00
|
|
|
|
|
|
|
#ifdef WITH_THREADS
|
|
|
|
#include <boost/thread/mutex.hpp>
|
|
|
|
#endif
|
|
|
|
|
2008-06-11 14:52:57 +04:00
|
|
|
#include "TypeDef.h"
|
|
|
|
#include "ScoreIndexManager.h"
|
|
|
|
#include "FactorCollection.h"
|
|
|
|
#include "Parameter.h"
|
|
|
|
#include "LanguageModel.h"
|
|
|
|
#include "LMList.h"
|
|
|
|
#include "SentenceStats.h"
|
|
|
|
#include "DecodeGraph.h"
|
2008-10-30 21:43:17 +03:00
|
|
|
#include "TranslationOptionList.h"
|
|
|
|
|
2008-09-24 20:48:23 +04:00
|
|
|
#if HAVE_CONFIG_H
|
|
|
|
#include "config.h"
|
|
|
|
#endif
|
2008-06-11 14:52:57 +04:00
|
|
|
//#include "UnknownWordHandler.h"
|
|
|
|
|
2008-10-09 03:51:26 +04:00
|
|
|
namespace Moses
|
|
|
|
{
|
|
|
|
|
2008-06-11 14:52:57 +04:00
|
|
|
class InputType;
|
|
|
|
class LexicalReordering;
|
2009-05-26 23:30:35 +04:00
|
|
|
class GlobalLexicalModel;
|
2009-08-07 20:47:54 +04:00
|
|
|
class PhraseDictionaryFeature;
|
2008-06-11 14:52:57 +04:00
|
|
|
class GenerationDictionary;
|
|
|
|
class DistortionScoreProducer;
|
|
|
|
class WordPenaltyProducer;
|
|
|
|
class DecodeStep;
|
|
|
|
class UnknownWordPenaltyProducer;
|
|
|
|
|
|
|
|
/** Contains global variables and contants */
|
|
|
|
class StaticData
|
|
|
|
{
|
|
|
|
private:
|
|
|
|
static StaticData s_instance;
|
|
|
|
protected:
|
2008-06-19 03:14:09 +04:00
|
|
|
|
|
|
|
std::map<long,Phrase> m_constraints;
|
2009-08-07 20:47:54 +04:00
|
|
|
std::vector<PhraseDictionaryFeature*> m_phraseDictionary;
|
2008-06-11 14:52:57 +04:00
|
|
|
std::vector<GenerationDictionary*> m_generationDictionary;
|
|
|
|
Parameter *m_parameter;
|
|
|
|
std::vector<FactorType> m_inputFactorOrder, m_outputFactorOrder;
|
|
|
|
LMList m_languageModel;
|
|
|
|
ScoreIndexManager m_scoreIndexManager;
|
|
|
|
std::vector<float> m_allWeights;
|
|
|
|
std::vector<LexicalReordering*> m_reorderModels;
|
2009-05-26 23:30:35 +04:00
|
|
|
std::vector<GlobalLexicalModel*> m_globalLexicalModels;
|
2008-06-11 14:52:57 +04:00
|
|
|
// Initial = 0 = can be used when creating poss trans
|
|
|
|
// Other = 1 = used to calculate LM score once all steps have been processed
|
|
|
|
float
|
|
|
|
m_beamWidth,
|
2008-12-13 15:08:55 +03:00
|
|
|
m_earlyDiscardingThreshold,
|
|
|
|
m_translationOptionThreshold,
|
2008-06-11 14:52:57 +04:00
|
|
|
m_weightDistortion,
|
|
|
|
m_weightWordPenalty,
|
|
|
|
m_wordDeletionWeight,
|
|
|
|
m_weightUnknownWord;
|
|
|
|
// PhraseTrans, Generation & LanguageModelScore has multiple weights.
|
|
|
|
int m_maxDistortion;
|
|
|
|
// do it differently from old pharaoh
|
|
|
|
// -ve = no limit on distortion
|
|
|
|
// 0 = no disortion (monotone in old pharaoh)
|
2008-11-24 20:30:37 +03:00
|
|
|
bool m_reorderingConstraint; // use additional reordering constraints
|
2008-06-11 14:52:57 +04:00
|
|
|
size_t
|
|
|
|
m_maxHypoStackSize //hypothesis-stack size that triggers pruning
|
2008-12-13 15:08:55 +03:00
|
|
|
, m_minHypoStackDiversity // minimum number of hypothesis in stack for each source word coverage
|
2008-06-11 14:52:57 +04:00
|
|
|
, m_nBestSize
|
|
|
|
, m_nBestFactor
|
|
|
|
, m_maxNoTransOptPerCoverage
|
|
|
|
, m_maxNoPartTransOpt
|
2009-02-05 20:37:09 +03:00
|
|
|
, m_maxPhraseLength
|
|
|
|
, m_numLinkParams;
|
2008-06-11 14:52:57 +04:00
|
|
|
|
2008-06-19 03:14:09 +04:00
|
|
|
std::string
|
|
|
|
m_constraintFileName;
|
|
|
|
|
2008-06-11 14:52:57 +04:00
|
|
|
std::string m_nBestFilePath;
|
|
|
|
bool m_fLMsLoaded, m_labeledNBestList,m_nBestIncludesAlignment;
|
|
|
|
/***
|
|
|
|
* false = treat unknown words as unknowns, and translate them as themselves;
|
|
|
|
* true = drop (ignore) them
|
|
|
|
*/
|
|
|
|
bool m_dropUnknown;
|
|
|
|
bool m_wordDeletionEnabled;
|
2010-03-07 10:57:48 +03:00
|
|
|
bool m_disableDiscarding;
|
|
|
|
bool m_printAllDerivations;
|
2008-06-11 14:52:57 +04:00
|
|
|
|
|
|
|
bool m_sourceStartPosMattersForRecombination;
|
|
|
|
bool m_recoverPath;
|
|
|
|
|
|
|
|
SearchAlgorithm m_searchAlgorithm;
|
|
|
|
InputTypeEnum m_inputType;
|
|
|
|
size_t m_numInputScores;
|
|
|
|
|
|
|
|
mutable size_t m_verboseLevel;
|
|
|
|
DistortionScoreProducer *m_distortionScoreProducer;
|
|
|
|
WordPenaltyProducer *m_wpProducer;
|
|
|
|
UnknownWordPenaltyProducer *m_unknownWordPenaltyProducer;
|
|
|
|
bool m_reportSegmentation;
|
|
|
|
bool m_reportAllFactors;
|
2010-02-18 13:54:33 +03:00
|
|
|
bool m_reportAllFactorsNBest;
|
2008-06-11 14:52:57 +04:00
|
|
|
bool m_isDetailedTranslationReportingEnabled;
|
|
|
|
bool m_onlyDistinctNBest;
|
|
|
|
bool m_computeLMBackoffStats;
|
2008-09-12 22:09:06 +04:00
|
|
|
bool m_UseAlignmentInfo;
|
|
|
|
bool m_PrintAlignmentInfo;
|
|
|
|
bool m_PrintAlignmentInfoNbest;
|
|
|
|
|
2009-08-07 20:47:54 +04:00
|
|
|
|
2008-06-11 14:52:57 +04:00
|
|
|
std::string m_factorDelimiter; //! by default, |, but it can be changed
|
|
|
|
size_t m_maxFactorIdx[2]; //! number of factors on source and target side
|
|
|
|
size_t m_maxNumFactors; //! max number of factors on both source and target sides
|
|
|
|
|
|
|
|
XmlInputType m_xmlInputType; //! method for handling sentence XML input
|
|
|
|
|
|
|
|
bool m_mbr; //! use MBR decoder
|
2010-02-03 13:23:32 +03:00
|
|
|
bool m_useLatticeMBR; //! use MBR decoder
|
2010-04-07 19:47:58 +04:00
|
|
|
bool m_useConsensusDecoding; //! Use Consensus decoding (DeNero et al 2009)
|
2008-06-11 14:52:57 +04:00
|
|
|
size_t m_mbrSize; //! number of translation candidates considered
|
|
|
|
float m_mbrScale; //! scaling factor for computing marginal probability of candidate translation
|
2010-02-03 13:23:32 +03:00
|
|
|
size_t m_lmbrPruning; //! average number of nodes per word wanted in pruned lattice
|
2010-02-18 17:15:34 +03:00
|
|
|
std::vector<float> m_lmbrThetas; //! theta(s) for lattice mbr calculation
|
2010-02-03 14:20:20 +03:00
|
|
|
bool m_useLatticeHypSetForLatticeMBR; //! to use nbest as hypothesis set during lattice MBR
|
2010-02-03 22:46:35 +03:00
|
|
|
float m_lmbrPrecision; //! unigram precision theta - see Tromble et al 08 for more details
|
|
|
|
float m_lmbrPRatio; //! decaying factor for ngram thetas - see Tromble et al 08 for more details
|
2010-03-14 23:23:17 +03:00
|
|
|
float m_lmbrMapWeight; //! Weight given to the map solution. See Kumar et al 09 for details
|
2010-02-03 22:46:35 +03:00
|
|
|
|
2008-06-11 14:52:57 +04:00
|
|
|
|
|
|
|
bool m_timeout; //! use timeout
|
|
|
|
size_t m_timeout_threshold; //! seconds after which time out is activated
|
|
|
|
|
2009-01-01 21:16:54 +03:00
|
|
|
bool m_useTransOptCache; //! flag indicating, if the persistent translation option cache should be used
|
2010-01-28 13:39:43 +03:00
|
|
|
mutable std::map<std::pair<size_t, Phrase>, std::pair<TranslationOptionList*,clock_t> > m_transOptCache; //! persistent translation option cache
|
2009-01-01 21:16:54 +03:00
|
|
|
size_t m_transOptCacheMaxSize; //! maximum size for persistent translation option cache
|
2009-08-07 20:47:54 +04:00
|
|
|
//FIXME: Single lock for cache not most efficient. However using a
|
|
|
|
//reader-writer for LRU cache is tricky - how to record last used time?
|
|
|
|
#ifdef WITH_THREADS
|
|
|
|
mutable boost::mutex m_transOptCacheMutex;
|
|
|
|
#endif
|
2008-06-11 14:52:57 +04:00
|
|
|
bool m_isAlwaysCreateDirectTranslationOption;
|
|
|
|
//! constructor. only the 1 static variable can be created
|
|
|
|
|
|
|
|
bool m_outputWordGraph; //! whether to output word graph
|
2010-01-28 18:32:04 +03:00
|
|
|
bool m_outputSearchGraph; //! whether to output search graph
|
|
|
|
bool m_outputSearchGraphExtended; //! ... in extended format
|
2008-09-24 20:48:23 +04:00
|
|
|
#ifdef HAVE_PROTOBUF
|
|
|
|
bool m_outputSearchGraphPB; //! whether to output search graph as a protobuf
|
|
|
|
#endif
|
2008-06-11 14:52:57 +04:00
|
|
|
|
|
|
|
size_t m_cubePruningPopLimit;
|
|
|
|
size_t m_cubePruningDiversity;
|
|
|
|
StaticData();
|
|
|
|
|
|
|
|
//! helper fn to set bool param from ini file/command line
|
2010-01-28 13:39:43 +03:00
|
|
|
void SetBooleanParameter(bool *paramter, std::string parameterName, bool defaultValue);
|
2008-06-11 14:52:57 +04:00
|
|
|
|
|
|
|
/***
|
|
|
|
* load all language models as specified in ini file
|
|
|
|
*/
|
|
|
|
bool LoadLanguageModels();
|
|
|
|
/***
|
|
|
|
* load not only the main phrase table but also any auxiliary tables that depend on which features are being used
|
|
|
|
* (eg word-deletion, word-insertion tables)
|
|
|
|
*/
|
|
|
|
bool LoadPhraseTables();
|
|
|
|
//! load all generation tables as specified in ini file
|
|
|
|
bool LoadGenerationTables();
|
|
|
|
//! load decoding steps
|
|
|
|
bool LoadLexicalReorderingModel();
|
2009-05-26 23:30:35 +04:00
|
|
|
bool LoadGlobalLexicalModel();
|
2009-08-07 20:47:54 +04:00
|
|
|
void ReduceTransOptCache() const;
|
2008-06-11 14:52:57 +04:00
|
|
|
|
|
|
|
public:
|
|
|
|
|
|
|
|
bool IsAlwaysCreateDirectTranslationOption() const {
|
|
|
|
return m_isAlwaysCreateDirectTranslationOption;
|
|
|
|
}
|
|
|
|
//! destructor
|
|
|
|
~StaticData();
|
|
|
|
//! return static instance for use like global variable
|
|
|
|
static const StaticData& Instance() { return s_instance; }
|
|
|
|
|
|
|
|
/** delete current static instance and replace with another.
|
|
|
|
* Used by gui front end
|
|
|
|
*/
|
|
|
|
#ifdef WIN32
|
|
|
|
static void Reset() { s_instance = StaticData(); }
|
|
|
|
#endif
|
|
|
|
|
|
|
|
/** load data into static instance. This function is required
|
|
|
|
* as LoadData() is not const
|
|
|
|
*/
|
|
|
|
static bool LoadDataStatic(Parameter *parameter)
|
|
|
|
{
|
|
|
|
return s_instance.LoadData(parameter);
|
|
|
|
}
|
|
|
|
|
|
|
|
/** Main function to load everything.
|
|
|
|
* Also initialize the Parameter object
|
|
|
|
*/
|
|
|
|
bool LoadData(Parameter *parameter);
|
|
|
|
|
|
|
|
const PARAM_VEC &GetParam(const std::string ¶mName) const
|
|
|
|
{
|
|
|
|
return m_parameter->GetParam(paramName);
|
|
|
|
}
|
|
|
|
|
|
|
|
bool IsComputeLMBackoffStats() const
|
|
|
|
{
|
|
|
|
return m_computeLMBackoffStats;
|
|
|
|
}
|
|
|
|
const std::vector<FactorType> &GetInputFactorOrder() const
|
|
|
|
{
|
|
|
|
return m_inputFactorOrder;
|
|
|
|
}
|
|
|
|
const std::vector<FactorType> &GetOutputFactorOrder() const
|
|
|
|
{
|
|
|
|
return m_outputFactorOrder;
|
|
|
|
}
|
|
|
|
|
2009-08-07 20:47:54 +04:00
|
|
|
std::vector<DecodeGraph*> GetDecodeStepVL(const InputType& source) const;
|
2008-06-11 14:52:57 +04:00
|
|
|
|
|
|
|
inline bool GetSourceStartPosMattersForRecombination() const
|
|
|
|
{
|
|
|
|
return m_sourceStartPosMattersForRecombination;
|
|
|
|
}
|
|
|
|
inline bool GetDropUnknown() const
|
|
|
|
{
|
|
|
|
return m_dropUnknown;
|
|
|
|
}
|
2010-03-07 10:57:48 +03:00
|
|
|
inline bool GetDisableDiscarding() const
|
|
|
|
{
|
|
|
|
return m_disableDiscarding;
|
|
|
|
}
|
2008-06-11 14:52:57 +04:00
|
|
|
inline size_t GetMaxNoTransOptPerCoverage() const
|
|
|
|
{
|
|
|
|
return m_maxNoTransOptPerCoverage;
|
|
|
|
}
|
|
|
|
inline size_t GetMaxNoPartTransOpt() const
|
|
|
|
{
|
|
|
|
return m_maxNoPartTransOpt;
|
|
|
|
}
|
2008-06-19 03:14:09 +04:00
|
|
|
inline const Phrase* GetConstrainingPhrase(long sentenceID) const
|
|
|
|
{
|
|
|
|
std::map<long,Phrase>::const_iterator iter = m_constraints.find(sentenceID);
|
|
|
|
if (iter != m_constraints.end())
|
|
|
|
{
|
|
|
|
const Phrase& phrase = iter->second;
|
|
|
|
return &phrase;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
return NULL;
|
|
|
|
}
|
|
|
|
}
|
2008-06-11 14:52:57 +04:00
|
|
|
inline size_t GetMaxPhraseLength() const
|
|
|
|
{
|
|
|
|
return m_maxPhraseLength;
|
|
|
|
}
|
|
|
|
const std::vector<LexicalReordering*> &GetReorderModels() const
|
|
|
|
{
|
|
|
|
return m_reorderModels;
|
|
|
|
}
|
|
|
|
float GetWeightDistortion() const
|
|
|
|
{
|
|
|
|
return m_weightDistortion;
|
|
|
|
}
|
|
|
|
float GetWeightWordPenalty() const
|
|
|
|
{
|
|
|
|
return m_weightWordPenalty;
|
|
|
|
}
|
2009-02-05 20:37:09 +03:00
|
|
|
float GetWeightUnknownWord() const
|
|
|
|
{
|
|
|
|
return m_weightUnknownWord;
|
|
|
|
}
|
2008-06-11 14:52:57 +04:00
|
|
|
bool IsWordDeletionEnabled() const
|
|
|
|
{
|
|
|
|
return m_wordDeletionEnabled;
|
|
|
|
}
|
|
|
|
size_t GetMaxHypoStackSize() const
|
|
|
|
{
|
|
|
|
return m_maxHypoStackSize;
|
|
|
|
}
|
2008-12-13 15:08:55 +03:00
|
|
|
size_t GetMinHypoStackDiversity() const
|
|
|
|
{
|
|
|
|
return m_minHypoStackDiversity;
|
|
|
|
}
|
2008-06-11 14:52:57 +04:00
|
|
|
size_t GetCubePruningPopLimit() const
|
|
|
|
{
|
|
|
|
return m_cubePruningPopLimit;
|
|
|
|
}
|
|
|
|
size_t GetCubePruningDiversity() const
|
|
|
|
{
|
|
|
|
return m_cubePruningDiversity;
|
|
|
|
}
|
|
|
|
size_t IsPathRecoveryEnabled() const
|
|
|
|
{
|
|
|
|
return m_recoverPath;
|
|
|
|
}
|
|
|
|
int GetMaxDistortion() const
|
|
|
|
{
|
|
|
|
return m_maxDistortion;
|
|
|
|
}
|
2008-11-24 20:30:37 +03:00
|
|
|
bool UseReorderingConstraint() const
|
|
|
|
{
|
|
|
|
return m_reorderingConstraint;
|
|
|
|
}
|
2008-06-11 14:52:57 +04:00
|
|
|
float GetBeamWidth() const
|
|
|
|
{
|
|
|
|
return m_beamWidth;
|
|
|
|
}
|
2008-12-13 15:08:55 +03:00
|
|
|
float GetEarlyDiscardingThreshold() const
|
|
|
|
{
|
|
|
|
return m_earlyDiscardingThreshold;
|
|
|
|
}
|
|
|
|
bool UseEarlyDiscarding() const
|
|
|
|
{
|
2010-01-28 13:39:43 +03:00
|
|
|
return m_earlyDiscardingThreshold != -std::numeric_limits<float>::infinity();
|
2008-12-13 15:08:55 +03:00
|
|
|
}
|
|
|
|
float GetTranslationOptionThreshold() const
|
|
|
|
{
|
|
|
|
return m_translationOptionThreshold;
|
|
|
|
}
|
2008-06-11 14:52:57 +04:00
|
|
|
//! returns the total number of score components across all types, all factors
|
|
|
|
size_t GetTotalScoreComponents() const
|
|
|
|
{
|
|
|
|
return m_scoreIndexManager.GetTotalNumberOfScores();
|
|
|
|
}
|
|
|
|
const ScoreIndexManager& GetScoreIndexManager() const
|
|
|
|
{
|
|
|
|
return m_scoreIndexManager;
|
|
|
|
}
|
|
|
|
|
|
|
|
size_t GetLMSize() const
|
|
|
|
{
|
|
|
|
return m_languageModel.size();
|
|
|
|
}
|
|
|
|
const LMList &GetAllLM() const
|
|
|
|
{
|
|
|
|
return m_languageModel;
|
|
|
|
}
|
|
|
|
size_t GetPhraseDictionarySize() const
|
|
|
|
{
|
|
|
|
return m_phraseDictionary.size();
|
|
|
|
}
|
2009-08-07 20:47:54 +04:00
|
|
|
const std::vector<PhraseDictionaryFeature*> &GetPhraseDictionaries() const
|
2008-06-11 14:52:57 +04:00
|
|
|
{
|
|
|
|
return m_phraseDictionary;
|
|
|
|
}
|
|
|
|
const std::vector<GenerationDictionary*> &GetGenerationDictionaries() const
|
|
|
|
{
|
|
|
|
return m_generationDictionary;
|
|
|
|
}
|
|
|
|
size_t GetGenerationDictionarySize() const
|
|
|
|
{
|
|
|
|
return m_generationDictionary.size();
|
|
|
|
}
|
|
|
|
size_t GetVerboseLevel() const
|
|
|
|
{
|
|
|
|
return m_verboseLevel;
|
|
|
|
}
|
|
|
|
void SetVerboseLevel(int x) const { m_verboseLevel = x; }
|
|
|
|
bool GetReportSegmentation() const
|
|
|
|
{
|
|
|
|
return m_reportSegmentation;
|
|
|
|
}
|
|
|
|
bool GetReportAllFactors() const
|
|
|
|
{
|
|
|
|
return m_reportAllFactors;
|
|
|
|
}
|
2010-02-18 13:54:33 +03:00
|
|
|
bool GetReportAllFactorsNBest() const
|
|
|
|
{
|
|
|
|
return m_reportAllFactorsNBest;
|
|
|
|
}
|
2008-06-11 14:52:57 +04:00
|
|
|
bool IsDetailedTranslationReportingEnabled() const
|
|
|
|
{
|
|
|
|
return m_isDetailedTranslationReportingEnabled;
|
|
|
|
}
|
2009-08-07 20:47:54 +04:00
|
|
|
|
2008-06-11 14:52:57 +04:00
|
|
|
bool IsLabeledNBestList() const
|
|
|
|
{
|
|
|
|
return m_labeledNBestList;
|
|
|
|
}
|
|
|
|
bool NBestIncludesAlignment() const
|
|
|
|
{
|
|
|
|
return m_nBestIncludesAlignment;
|
|
|
|
}
|
2009-02-05 20:37:09 +03:00
|
|
|
size_t GetNumLinkParams() const
|
|
|
|
{
|
|
|
|
return m_numLinkParams;
|
|
|
|
}
|
2008-06-11 14:52:57 +04:00
|
|
|
const std::vector<std::string> &GetDescription() const
|
|
|
|
{
|
|
|
|
return m_parameter->GetParam("description");
|
|
|
|
}
|
|
|
|
|
|
|
|
// for mert
|
|
|
|
size_t GetNBestSize() const
|
|
|
|
{
|
|
|
|
return m_nBestSize;
|
|
|
|
}
|
|
|
|
const std::string &GetNBestFilePath() const
|
|
|
|
{
|
|
|
|
return m_nBestFilePath;
|
|
|
|
}
|
|
|
|
bool IsNBestEnabled() const {
|
2010-04-07 19:47:58 +04:00
|
|
|
return (!m_nBestFilePath.empty()) || m_mbr || m_useLatticeMBR || m_outputSearchGraph || m_useConsensusDecoding
|
2008-09-24 20:48:23 +04:00
|
|
|
#ifdef HAVE_PROTOBUF
|
|
|
|
|| m_outputSearchGraphPB
|
|
|
|
#endif
|
|
|
|
;
|
|
|
|
}
|
2008-06-11 14:52:57 +04:00
|
|
|
size_t GetNBestFactor() const
|
|
|
|
{
|
|
|
|
return m_nBestFactor;
|
|
|
|
}
|
|
|
|
bool GetOutputWordGraph() const
|
|
|
|
{ return m_outputWordGraph; }
|
|
|
|
|
|
|
|
//! Sets the global score vector weights for a given ScoreProducer.
|
|
|
|
void SetWeightsForScoreProducer(const ScoreProducer* sp, const std::vector<float>& weights);
|
|
|
|
InputTypeEnum GetInputType() const {return m_inputType;}
|
|
|
|
SearchAlgorithm GetSearchAlgorithm() const {return m_searchAlgorithm;}
|
|
|
|
size_t GetNumInputScores() const {return m_numInputScores;}
|
|
|
|
void InitializeBeforeSentenceProcessing(InputType const&) const;
|
|
|
|
void CleanUpAfterSentenceProcessing() const;
|
2009-08-07 20:47:54 +04:00
|
|
|
|
2008-06-11 14:52:57 +04:00
|
|
|
const std::vector<float>& GetAllWeights() const
|
|
|
|
{
|
|
|
|
return m_allWeights;
|
|
|
|
}
|
|
|
|
const DistortionScoreProducer *GetDistortionScoreProducer() const { return m_distortionScoreProducer; }
|
|
|
|
const WordPenaltyProducer *GetWordPenaltyProducer() const { return m_wpProducer; }
|
|
|
|
const UnknownWordPenaltyProducer *GetUnknownWordPenaltyProducer() const { return m_unknownWordPenaltyProducer; }
|
|
|
|
|
2008-09-12 22:09:06 +04:00
|
|
|
bool UseAlignmentInfo() const { return m_UseAlignmentInfo;}
|
|
|
|
void UseAlignmentInfo(bool a){ m_UseAlignmentInfo=a; };
|
|
|
|
bool PrintAlignmentInfo() const { return m_PrintAlignmentInfo; }
|
|
|
|
bool PrintAlignmentInfoInNbest() const {return m_PrintAlignmentInfoNbest;}
|
2008-06-11 14:52:57 +04:00
|
|
|
bool GetDistinctNBest() const {return m_onlyDistinctNBest;}
|
|
|
|
const std::string& GetFactorDelimiter() const {return m_factorDelimiter;}
|
|
|
|
size_t GetMaxNumFactors(FactorDirection direction) const { return m_maxFactorIdx[(size_t)direction]+1; }
|
|
|
|
size_t GetMaxNumFactors() const { return m_maxNumFactors; }
|
|
|
|
bool UseMBR() const { return m_mbr; }
|
2010-02-03 13:23:32 +03:00
|
|
|
bool UseLatticeMBR() const { return m_useLatticeMBR ;}
|
2010-04-07 19:47:58 +04:00
|
|
|
bool UseConsensusDecoding() const {return m_useConsensusDecoding;}
|
2010-02-23 02:42:35 +03:00
|
|
|
void SetUseLatticeMBR(bool flag) {m_useLatticeMBR = flag; }
|
2008-06-11 14:52:57 +04:00
|
|
|
size_t GetMBRSize() const { return m_mbrSize; }
|
|
|
|
float GetMBRScale() const { return m_mbrScale; }
|
2010-02-18 17:15:34 +03:00
|
|
|
void SetMBRScale(float scale) {
|
|
|
|
m_mbrScale = scale;
|
|
|
|
}
|
2010-02-03 13:23:32 +03:00
|
|
|
size_t GetLatticeMBRPruningFactor() const { return m_lmbrPruning; }
|
2010-02-18 17:15:34 +03:00
|
|
|
void SetLatticeMBRPruningFactor(size_t prune) {
|
2010-02-23 02:42:35 +03:00
|
|
|
m_lmbrPruning = prune;
|
2010-02-18 17:15:34 +03:00
|
|
|
}
|
|
|
|
const std::vector<float>& GetLatticeMBRThetas() const {return m_lmbrThetas;}
|
2010-02-03 14:20:20 +03:00
|
|
|
bool UseLatticeHypSetForLatticeMBR() const { return m_useLatticeHypSetForLatticeMBR;}
|
2010-02-03 22:46:35 +03:00
|
|
|
float GetLatticeMBRPrecision() const {
|
|
|
|
return m_lmbrPrecision;
|
|
|
|
}
|
2010-02-18 17:15:34 +03:00
|
|
|
void SetLatticeMBRPrecision(float p) {
|
|
|
|
m_lmbrPrecision = p;
|
|
|
|
}
|
2010-02-03 22:46:35 +03:00
|
|
|
float GetLatticeMBRPRatio() const {
|
|
|
|
return m_lmbrPRatio;
|
|
|
|
}
|
2010-02-18 17:15:34 +03:00
|
|
|
void SetLatticeMBRPRatio(float r) {
|
|
|
|
m_lmbrPRatio = r;
|
|
|
|
}
|
2010-02-03 13:23:32 +03:00
|
|
|
|
2010-03-14 23:23:17 +03:00
|
|
|
float GetLatticeMBRMapWeight() const {return m_lmbrMapWeight;}
|
|
|
|
|
2008-06-11 14:52:57 +04:00
|
|
|
bool UseTimeout() const { return m_timeout; }
|
|
|
|
size_t GetTimeoutThreshold() const { return m_timeout_threshold; }
|
|
|
|
|
2010-01-28 18:32:04 +03:00
|
|
|
bool GetOutputSearchGraph() const { return m_outputSearchGraph; }
|
|
|
|
bool GetOutputSearchGraphExtended() const { return m_outputSearchGraphExtended; }
|
2008-09-24 20:48:23 +04:00
|
|
|
#ifdef HAVE_PROTOBUF
|
|
|
|
bool GetOutputSearchGraphPB() const { return m_outputSearchGraphPB; }
|
|
|
|
#endif
|
|
|
|
|
2008-06-11 14:52:57 +04:00
|
|
|
XmlInputType GetXmlInputType() const { return m_xmlInputType; }
|
|
|
|
|
|
|
|
bool GetUseTransOptCache() const { return m_useTransOptCache; }
|
|
|
|
|
2008-10-14 23:25:18 +04:00
|
|
|
void AddTransOptListToCache(const DecodeGraph &decodeGraph, const Phrase &sourcePhrase, const TranslationOptionList &transOptList) const;
|
2009-08-07 20:47:54 +04:00
|
|
|
|
2008-06-11 14:52:57 +04:00
|
|
|
|
2008-10-14 23:25:18 +04:00
|
|
|
const TranslationOptionList* FindTransOptListInCache(const DecodeGraph &decodeGraph, const Phrase &sourcePhrase) const;
|
2010-03-07 10:57:48 +03:00
|
|
|
|
|
|
|
bool PrintAllDerivations() const { return m_printAllDerivations;}
|
2008-06-11 14:52:57 +04:00
|
|
|
};
|
2008-10-09 03:51:26 +04:00
|
|
|
|
|
|
|
}
|
2010-02-24 14:15:44 +03:00
|
|
|
#endif
|