mirror of
https://github.com/moses-smt/mosesdecoder.git
synced 2024-11-13 10:40:52 +03:00
can set max trans option per coverage
turned off profiling git-svn-id: https://mosesdecoder.svn.sourceforge.net/svnroot/mosesdecoder/trunk@350 1f5c12ca-751b-0410-a591-d2e778427230
This commit is contained in:
parent
35f3c1b1b5
commit
2a4cb09a6c
@ -23,7 +23,7 @@
|
||||
<listOptionValue builtIn="false" value="${ProjDirPath}/../mysql/include"/>
|
||||
<listOptionValue builtIn="false" value="${ProjDirPath}/../mysqlpp/lib"/>
|
||||
</option>
|
||||
<option id="gnu.cpp.compiler.option.debugging.gprof.1598624147" superClass="gnu.cpp.compiler.option.debugging.gprof" value="true" valueType="boolean"/>
|
||||
<option id="gnu.cpp.compiler.option.debugging.gprof.1598624147" superClass="gnu.cpp.compiler.option.debugging.gprof" value="false" valueType="boolean"/>
|
||||
</tool>
|
||||
<tool id="cdt.managedbuild.tool.gnu.archiver.lib.debug.187676627" name="GCC Archiver" superClass="cdt.managedbuild.tool.gnu.archiver.lib.debug"/>
|
||||
<tool id="cdt.managedbuild.tool.gnu.assembler.lib.debug.1660142337" name="GCC Assembler" superClass="cdt.managedbuild.tool.gnu.assembler.lib.debug"/>
|
||||
@ -78,7 +78,7 @@
|
||||
<listOptionValue builtIn="false" value="${ProjDirPath}/../mysql/include"/>
|
||||
<listOptionValue builtIn="false" value="${ProjDirPath}/../mysqlpp/lib"/>
|
||||
</option>
|
||||
<option id="gnu.cpp.compiler.option.debugging.gprof.1182039672" superClass="gnu.cpp.compiler.option.debugging.gprof" value="true" valueType="boolean"/>
|
||||
<option id="gnu.cpp.compiler.option.debugging.gprof.1182039672" superClass="gnu.cpp.compiler.option.debugging.gprof" value="false" valueType="boolean"/>
|
||||
</tool>
|
||||
<tool id="cdt.managedbuild.tool.gnu.archiver.lib.debug.1451721331" name="GCC Archiver" superClass="cdt.managedbuild.tool.gnu.archiver.lib.debug"/>
|
||||
<tool id="cdt.managedbuild.tool.gnu.assembler.lib.debug.1914532442" name="GCC Assembler" superClass="cdt.managedbuild.tool.gnu.assembler.lib.debug"/>
|
||||
|
@ -9,7 +9,8 @@
|
||||
#include "Util.h"
|
||||
#include "PhraseDictionaryTreeAdaptor.h"
|
||||
#include "TranslationOptionCollectionConfusionNet.h"
|
||||
|
||||
#include "StaticData.h"
|
||||
|
||||
struct CNStats {
|
||||
unsigned created,destr,read,colls,words;
|
||||
|
||||
@ -195,7 +196,8 @@ CreateTargetPhraseCollection(PhraseDictionaryBase const& d,
|
||||
TranslationOptionCollection*
|
||||
ConfusionNet::CreateTranslationOptionCollection() const
|
||||
{
|
||||
return new TranslationOptionCollectionConfusionNet(*this);
|
||||
size_t maxNoTransOptPerCoverage = StaticData::Instance()->GetMaxNoTransOptPerCoverage();
|
||||
return new TranslationOptionCollectionConfusionNet(*this, maxNoTransOptPerCoverage);
|
||||
}
|
||||
|
||||
#endif
|
||||
|
@ -67,6 +67,7 @@ Parameter::Parameter()
|
||||
AddParam("report-all-factors");
|
||||
AddParam("drop-unknown");
|
||||
AddParam("inputtype");
|
||||
AddParam("max-trans-opt-per-coverage");
|
||||
}
|
||||
|
||||
// check if parameter settings make sense
|
||||
|
@ -22,6 +22,7 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
#include <boost/algorithm/string.hpp>
|
||||
#include "PhraseDictionary.h"
|
||||
#include "TranslationOptionCollectionText.h"
|
||||
#include "StaticData.h"
|
||||
|
||||
int Sentence::Read(std::istream& in,const std::vector<FactorType>& factorOrder,
|
||||
FactorCollection &factorCollection)
|
||||
@ -48,7 +49,8 @@ CreateTargetPhraseCollection(PhraseDictionaryBase const& d,
|
||||
TranslationOptionCollection*
|
||||
Sentence::CreateTranslationOptionCollection() const
|
||||
{
|
||||
return new TranslationOptionCollectionText(*this);
|
||||
size_t maxNoTransOptPerCoverage = StaticData::Instance()->GetMaxNoTransOptPerCoverage();
|
||||
return new TranslationOptionCollectionText(*this, maxNoTransOptPerCoverage);
|
||||
}
|
||||
void Sentence::Print(std::ostream& out) const
|
||||
{
|
||||
|
@ -287,6 +287,9 @@ bool StaticData::LoadParameters(int argc, char* argv[])
|
||||
TransformScore(Scan<float>(m_parameter.GetParam("beam-threshold")[0]))
|
||||
: TransformScore(DEFAULT_BEAM_THRESHOLD);
|
||||
|
||||
m_maxNoTransOptPerCoverage = (m_parameter.GetParam("max-trans-opt-per-coverage").size() > 0)
|
||||
? Scan<size_t>(m_parameter.GetParam("max-trans-opt-per-coverage")[0]) : DEFAULT_MAX_TRANS_OPT_SIZE;
|
||||
|
||||
// Unknown Word Processing -- wade
|
||||
//TODO replace this w/general word dropping -- EVH
|
||||
if (m_parameter.GetParam("drop-unknown").size() == 1)
|
||||
|
@ -67,8 +67,11 @@ protected:
|
||||
// do it differently from old pharaoh
|
||||
// -ve = no limit on distortion
|
||||
// 0 = no disortion (monotone in old pharaoh)
|
||||
size_t m_maxHypoStackSize; //hypothesis-stack size that triggers pruning
|
||||
size_t m_nBestSize;
|
||||
size_t
|
||||
m_maxHypoStackSize //hypothesis-stack size that triggers pruning
|
||||
, m_nBestSize
|
||||
, m_maxNoTransOptPerCoverage;
|
||||
|
||||
std::string m_nBestFilePath, m_cachePath;
|
||||
std::vector<std::string> m_mySQLParam;
|
||||
InputOutput *m_inputOutput;
|
||||
@ -139,6 +142,10 @@ public:
|
||||
{
|
||||
return m_dropUnknown;
|
||||
}
|
||||
inline size_t GetMaxNoTransOptPerCoverage() const
|
||||
{
|
||||
return m_maxNoTransOptPerCoverage;
|
||||
}
|
||||
/*
|
||||
boost::shared_ptr<UnknownWordHandler> GetUnknownWordHandler()
|
||||
{
|
||||
|
@ -9,10 +9,11 @@
|
||||
|
||||
using namespace std;
|
||||
|
||||
TranslationOptionCollection::TranslationOptionCollection(InputType const& src)
|
||||
TranslationOptionCollection::TranslationOptionCollection(InputType const& src, size_t maxNoTransOptPerCoverage)
|
||||
: m_source(src)
|
||||
,m_futureScore(src.GetSize())
|
||||
,m_unknownWordPos(src.GetSize())
|
||||
,m_maxNoTransOptPerCoverage(maxNoTransOptPerCoverage)
|
||||
{
|
||||
// create 2-d vector
|
||||
size_t size = src.GetSize();
|
||||
|
@ -48,13 +48,14 @@ protected:
|
||||
InputType const &m_source;
|
||||
SquareMatrix m_futureScore;
|
||||
WordsBitmap m_unknownWordPos;
|
||||
std::list<const PhraseDictionaryBase*> m_allPhraseDictionary;
|
||||
std::list<const PhraseDictionaryBase*> m_allPhraseDictionary;
|
||||
std::list<const GenerationDictionary*> m_allGenerationDictionary;
|
||||
std::set<TargetPhrase> m_unknownTargetPhrase;
|
||||
// make sure phrase doesn't go out of memory while we're using it
|
||||
std::set<TargetPhrase> m_unknownTargetPhrase;
|
||||
// make sure phrase doesn't go out of memory while we're using it
|
||||
const size_t m_maxNoTransOptPerCoverage;
|
||||
const LMList *m_allLM;
|
||||
|
||||
TranslationOptionCollection(InputType const& src);
|
||||
TranslationOptionCollection(InputType const& src, size_t maxNoTransOptPerCoverage);
|
||||
|
||||
void CalcFutureScore(size_t verboseLevel);
|
||||
|
||||
|
@ -8,8 +8,8 @@
|
||||
#include "LMList.h"
|
||||
|
||||
TranslationOptionCollectionConfusionNet::
|
||||
TranslationOptionCollectionConfusionNet(const ConfusionNet &input)
|
||||
: TranslationOptionCollection(input) {}
|
||||
TranslationOptionCollectionConfusionNet(const ConfusionNet &input, size_t maxNoTransOptPerCoverage)
|
||||
: TranslationOptionCollection(input, maxNoTransOptPerCoverage) {}
|
||||
|
||||
void TranslationOptionCollectionConfusionNet::
|
||||
ProcessUnknownWord( size_t sourcePos
|
||||
|
@ -7,7 +7,7 @@ class ConfusionNet;
|
||||
|
||||
class TranslationOptionCollectionConfusionNet : public TranslationOptionCollection {
|
||||
public:
|
||||
TranslationOptionCollectionConfusionNet(const ConfusionNet &source);
|
||||
TranslationOptionCollectionConfusionNet(const ConfusionNet &source, size_t maxNoTransOptPerCoverage);
|
||||
|
||||
void ProcessUnknownWord( size_t sourcePos
|
||||
, int dropUnknown
|
||||
|
@ -10,8 +10,8 @@
|
||||
|
||||
using namespace std;
|
||||
|
||||
TranslationOptionCollectionText::TranslationOptionCollectionText(Sentence const &inputSentence)
|
||||
: TranslationOptionCollection(inputSentence) {}
|
||||
TranslationOptionCollectionText::TranslationOptionCollectionText(Sentence const &inputSentence, size_t maxNoTransOptPerCoverage)
|
||||
: TranslationOptionCollection(inputSentence, maxNoTransOptPerCoverage) {}
|
||||
|
||||
void TranslationOptionCollectionText::ProcessUnknownWord(size_t sourcePos
|
||||
, int dropUnknown
|
||||
|
@ -15,7 +15,7 @@ protected:
|
||||
, float weightWordPenalty);
|
||||
|
||||
public:
|
||||
TranslationOptionCollectionText(Sentence const& inputSentence);
|
||||
TranslationOptionCollectionText(Sentence const& inputSentence, size_t maxNoTransOptPerCoverage);
|
||||
|
||||
};
|
||||
|
||||
|
@ -35,6 +35,7 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
#define MAX_NGRAM_SIZE 20
|
||||
|
||||
const size_t DEFAULT_MAX_HYPOSTACK_SIZE = 200;
|
||||
const size_t DEFAULT_MAX_TRANS_OPT_SIZE = 50;
|
||||
const size_t ARRAY_SIZE_INCR = 20; //amount by which a hypostack gets resized when necessary
|
||||
const float LOWEST_SCORE = -100.0f;
|
||||
const float DEFAULT_BEAM_THRESHOLD = 0.00001f;
|
||||
|
Loading…
Reference in New Issue
Block a user