mirror of
https://github.com/moses-smt/mosesdecoder.git
synced 2024-09-19 23:27:46 +03:00
Merge branch 'master' of git://github.com/moses-smt/mosesdecoder
This commit is contained in:
commit
69ef1d4645
@ -11,12 +11,12 @@
|
||||
</externalSetting>
|
||||
</externalSettings>
|
||||
<extensions>
|
||||
<extension id="org.eclipse.cdt.core.MachO64" point="org.eclipse.cdt.core.BinaryParser"/>
|
||||
<extension id="org.eclipse.cdt.core.ELF" point="org.eclipse.cdt.core.BinaryParser"/>
|
||||
<extension id="org.eclipse.cdt.core.GmakeErrorParser" point="org.eclipse.cdt.core.ErrorParser"/>
|
||||
<extension id="org.eclipse.cdt.core.CWDLocator" point="org.eclipse.cdt.core.ErrorParser"/>
|
||||
<extension id="org.eclipse.cdt.core.GCCErrorParser" point="org.eclipse.cdt.core.ErrorParser"/>
|
||||
<extension id="org.eclipse.cdt.core.GASErrorParser" point="org.eclipse.cdt.core.ErrorParser"/>
|
||||
<extension id="org.eclipse.cdt.core.MachO64" point="org.eclipse.cdt.core.BinaryParser"/>
|
||||
<extension id="org.eclipse.cdt.core.ELF" point="org.eclipse.cdt.core.BinaryParser"/>
|
||||
</extensions>
|
||||
</storageModule>
|
||||
<storageModule moduleId="cdtBuildSystem" version="4.0.0">
|
||||
@ -72,13 +72,13 @@
|
||||
<storageModule buildSystemId="org.eclipse.cdt.managedbuilder.core.configurationDataProvider" id="cdt.managedbuild.config.macosx.exe.release.701931933" moduleId="org.eclipse.cdt.core.settings" name="Release">
|
||||
<externalSettings/>
|
||||
<extensions>
|
||||
<extension id="org.eclipse.cdt.core.MachO64" point="org.eclipse.cdt.core.BinaryParser"/>
|
||||
<extension id="org.eclipse.cdt.core.ELF" point="org.eclipse.cdt.core.BinaryParser"/>
|
||||
<extension id="org.eclipse.cdt.core.GmakeErrorParser" point="org.eclipse.cdt.core.ErrorParser"/>
|
||||
<extension id="org.eclipse.cdt.core.CWDLocator" point="org.eclipse.cdt.core.ErrorParser"/>
|
||||
<extension id="org.eclipse.cdt.core.GCCErrorParser" point="org.eclipse.cdt.core.ErrorParser"/>
|
||||
<extension id="org.eclipse.cdt.core.GASErrorParser" point="org.eclipse.cdt.core.ErrorParser"/>
|
||||
<extension id="org.eclipse.cdt.core.GLDErrorParser" point="org.eclipse.cdt.core.ErrorParser"/>
|
||||
<extension id="org.eclipse.cdt.core.MachO64" point="org.eclipse.cdt.core.BinaryParser"/>
|
||||
<extension id="org.eclipse.cdt.core.ELF" point="org.eclipse.cdt.core.BinaryParser"/>
|
||||
</extensions>
|
||||
</storageModule>
|
||||
<storageModule moduleId="cdtBuildSystem" version="4.0.0">
|
||||
|
@ -33,7 +33,6 @@
|
||||
<option id="gnu.cpp.compiler.option.preprocessor.def.1785368241" name="Defined symbols (-D)" superClass="gnu.cpp.compiler.option.preprocessor.def" valueType="definedSymbols">
|
||||
<listOptionValue builtIn="false" value="HAVE_BOOST"/>
|
||||
<listOptionValue builtIn="false" value="TRACE_ENABLE"/>
|
||||
<listOptionValue builtIn="false" value="HAVE_CMPH"/>
|
||||
<listOptionValue builtIn="false" value="KENLM_MAX_ORDER=7"/>
|
||||
<listOptionValue builtIn="false" value="WITH_THREADS"/>
|
||||
<listOptionValue builtIn="false" value="MAX_NUM_FACTORS=4"/>
|
||||
@ -66,7 +65,6 @@
|
||||
<listOptionValue builtIn="false" value="/opt/local/lib"/>
|
||||
</option>
|
||||
<option id="gnu.cpp.link.option.libs.1177721357" name="Libraries (-l)" superClass="gnu.cpp.link.option.libs" valueType="libs">
|
||||
<listOptionValue builtIn="false" value="neuralLM"/>
|
||||
<listOptionValue builtIn="false" value="dstruct"/>
|
||||
<listOptionValue builtIn="false" value="flm"/>
|
||||
<listOptionValue builtIn="false" value="oolm"/>
|
||||
@ -75,15 +73,14 @@
|
||||
<listOptionValue builtIn="false" value="moses"/>
|
||||
<listOptionValue builtIn="false" value="search"/>
|
||||
<listOptionValue builtIn="false" value="irstlm"/>
|
||||
<listOptionValue builtIn="false" value="RandLM"/>
|
||||
<listOptionValue builtIn="false" value="OnDiskPt"/>
|
||||
<listOptionValue builtIn="false" value="lm"/>
|
||||
<listOptionValue builtIn="false" value="util"/>
|
||||
<listOptionValue builtIn="false" value="RandLM"/>
|
||||
<listOptionValue builtIn="false" value="boost_iostreams-mt"/>
|
||||
<listOptionValue builtIn="false" value="boost_system-mt"/>
|
||||
<listOptionValue builtIn="false" value="boost_thread-mt"/>
|
||||
<listOptionValue builtIn="false" value="boost_filesystem-mt"/>
|
||||
<listOptionValue builtIn="false" value="cmph"/>
|
||||
<listOptionValue builtIn="false" value="pthread"/>
|
||||
<listOptionValue builtIn="false" value="z"/>
|
||||
<listOptionValue builtIn="false" value="bz2"/>
|
||||
|
@ -62,7 +62,6 @@
|
||||
<listOptionValue builtIn="false" value="/opt/local/lib"/>
|
||||
</option>
|
||||
<option id="gnu.cpp.link.option.libs.998577284" name="Libraries (-l)" superClass="gnu.cpp.link.option.libs" valueType="libs">
|
||||
<listOptionValue builtIn="false" value="neuralLM"/>
|
||||
<listOptionValue builtIn="false" value="dstruct"/>
|
||||
<listOptionValue builtIn="false" value="flm"/>
|
||||
<listOptionValue builtIn="false" value="oolm"/>
|
||||
@ -71,15 +70,14 @@
|
||||
<listOptionValue builtIn="false" value="moses"/>
|
||||
<listOptionValue builtIn="false" value="search"/>
|
||||
<listOptionValue builtIn="false" value="irstlm"/>
|
||||
<listOptionValue builtIn="false" value="RandLM"/>
|
||||
<listOptionValue builtIn="false" value="OnDiskPt"/>
|
||||
<listOptionValue builtIn="false" value="lm"/>
|
||||
<listOptionValue builtIn="false" value="util"/>
|
||||
<listOptionValue builtIn="false" value="RandLM"/>
|
||||
<listOptionValue builtIn="false" value="boost_iostreams-mt"/>
|
||||
<listOptionValue builtIn="false" value="boost_system-mt"/>
|
||||
<listOptionValue builtIn="false" value="boost_thread-mt"/>
|
||||
<listOptionValue builtIn="false" value="boost_filesystem-mt"/>
|
||||
<listOptionValue builtIn="false" value="cmph"/>
|
||||
<listOptionValue builtIn="false" value="pthread"/>
|
||||
<listOptionValue builtIn="false" value="z"/>
|
||||
<listOptionValue builtIn="false" value="bz2"/>
|
||||
|
@ -42,7 +42,6 @@
|
||||
</option>
|
||||
<option id="gnu.cpp.compiler.option.preprocessor.def.752586397" name="Defined symbols (-D)" superClass="gnu.cpp.compiler.option.preprocessor.def" valueType="definedSymbols">
|
||||
<listOptionValue builtIn="false" value="IS_ECLIPSE"/>
|
||||
<listOptionValue builtIn="false" value="HAVE_CMPH"/>
|
||||
<listOptionValue builtIn="false" value="HAVE_BOOST"/>
|
||||
<listOptionValue builtIn="false" value="MAX_NUM_FACTORS=4"/>
|
||||
<listOptionValue builtIn="false" value="WITH_THREADS"/>
|
||||
@ -75,7 +74,7 @@
|
||||
</folderInfo>
|
||||
<fileInfo id="cdt.managedbuild.config.gnu.exe.debug.656913512.511477442" name="Rand.h" rcbsApplicability="disable" resourcePath="LM/Rand.h" toolsToInvoke=""/>
|
||||
<sourceEntries>
|
||||
<entry excluding="FF/PhraseLengthFeatureTest.cpp|PhraseLengthFeatureTest.cpp|LM/BackwardTest.cpp|LM/BackwardLMState.h|LM/BackwardLMState.cpp|LM/Backward.h|LM/Backward.cpp|FeatureVectorTest.cpp|LM/ParallelBackoff.h|LM/ParallelBackoff.cpp|src/SyntacticLanguageModelState.h|src/SyntacticLanguageModelFiles.h|src/SyntacticLanguageModel.h|src/SyntacticLanguageModel.cpp|src/LM/SRI.h|src/LM/SRI.cpp|src/LM/Rand.h|src/LM/Rand.cpp|src/LM/LDHT.h|src/LM/LDHT.cpp|SyntacticLanguageModelState.h|SyntacticLanguageModelFiles.h|SyntacticLanguageModel.h|SyntacticLanguageModel.cpp|LM/LDHT.h|LM/LDHT.cpp" flags="VALUE_WORKSPACE_PATH|RESOLVED" kind="sourcePath" name=""/>
|
||||
<entry excluding="TranslationModel/CompactPT|LM/NeuralLMWrapper.cpp|FF/PhraseLengthFeatureTest.cpp|PhraseLengthFeatureTest.cpp|LM/BackwardTest.cpp|LM/BackwardLMState.h|LM/BackwardLMState.cpp|LM/Backward.h|LM/Backward.cpp|FeatureVectorTest.cpp|LM/ParallelBackoff.h|LM/ParallelBackoff.cpp|src/SyntacticLanguageModelState.h|src/SyntacticLanguageModelFiles.h|src/SyntacticLanguageModel.h|src/SyntacticLanguageModel.cpp|src/LM/SRI.h|src/LM/SRI.cpp|src/LM/Rand.h|src/LM/Rand.cpp|src/LM/LDHT.h|src/LM/LDHT.cpp|SyntacticLanguageModelState.h|SyntacticLanguageModelFiles.h|SyntacticLanguageModel.h|SyntacticLanguageModel.cpp|LM/LDHT.h|LM/LDHT.cpp" flags="VALUE_WORKSPACE_PATH|RESOLVED" kind="sourcePath" name=""/>
|
||||
</sourceEntries>
|
||||
</configuration>
|
||||
</storageModule>
|
||||
|
@ -1156,6 +1156,16 @@
|
||||
<type>1</type>
|
||||
<locationURI>PARENT-3-PROJECT_LOC/moses/FF/InputFeature.h</locationURI>
|
||||
</link>
|
||||
<link>
|
||||
<name>FF/InternalStructStatelessFF.cpp</name>
|
||||
<type>1</type>
|
||||
<locationURI>PARENT-3-PROJECT_LOC/moses/FF/InternalStructStatelessFF.cpp</locationURI>
|
||||
</link>
|
||||
<link>
|
||||
<name>FF/InternalStructStatelessFF.h</name>
|
||||
<type>1</type>
|
||||
<locationURI>PARENT-3-PROJECT_LOC/moses/FF/InternalStructStatelessFF.h</locationURI>
|
||||
</link>
|
||||
<link>
|
||||
<name>FF/LexicalReordering</name>
|
||||
<type>2</type>
|
||||
|
@ -76,7 +76,7 @@ void BleuScoreState::AddNgramCountAndMatches(std::vector< size_t >& counts,
|
||||
|
||||
|
||||
BleuScoreFeature::BleuScoreFeature(const std::string &line)
|
||||
:StatefulFeatureFunction("BleuScoreFeature",1, line),
|
||||
:StatefulFeatureFunction(1, line),
|
||||
m_enabled(true),
|
||||
m_sentence_bleu(true),
|
||||
m_simple_history_bleu(false),
|
||||
|
@ -34,7 +34,7 @@ class ConstrainedDecoding : public StatefulFeatureFunction
|
||||
{
|
||||
public:
|
||||
ConstrainedDecoding(const std::string &line)
|
||||
:StatefulFeatureFunction("ConstrainedDecoding", 1, line)
|
||||
:StatefulFeatureFunction(1, line)
|
||||
,m_maxUnknowns(0) {
|
||||
m_tuneable = false;
|
||||
ReadParameters();
|
||||
|
@ -45,7 +45,7 @@ class ControlRecombination : public StatefulFeatureFunction
|
||||
{
|
||||
public:
|
||||
ControlRecombination(const std::string &line)
|
||||
:StatefulFeatureFunction("ControlRecombination", 0, line)
|
||||
:StatefulFeatureFunction(0, line)
|
||||
,m_type(SameOutput)
|
||||
|
||||
{
|
||||
|
@ -29,27 +29,24 @@ using namespace std;
|
||||
|
||||
namespace Moses
|
||||
{
|
||||
DecodeFeature::DecodeFeature( const std::string& description
|
||||
, const std::string &line)
|
||||
: StatelessFeatureFunction(description, line)
|
||||
DecodeFeature::DecodeFeature(const std::string &line)
|
||||
: StatelessFeatureFunction(line)
|
||||
{
|
||||
VERBOSE(2,"DecodeFeature:" << std::endl);
|
||||
}
|
||||
|
||||
DecodeFeature::DecodeFeature( const std::string& description
|
||||
, size_t numScoreComponents
|
||||
DecodeFeature::DecodeFeature(size_t numScoreComponents
|
||||
, const std::string &line)
|
||||
: StatelessFeatureFunction(description,numScoreComponents, line)
|
||||
: StatelessFeatureFunction(numScoreComponents, line)
|
||||
{
|
||||
VERBOSE(2,"DecodeFeature: no factors yet" << std::endl);
|
||||
}
|
||||
|
||||
DecodeFeature::DecodeFeature(const std::string& description
|
||||
, size_t numScoreComponents
|
||||
DecodeFeature::DecodeFeature(size_t numScoreComponents
|
||||
, const std::vector<FactorType> &input
|
||||
, const std::vector<FactorType> &output
|
||||
, const std::string &line)
|
||||
: StatelessFeatureFunction(description,numScoreComponents, line)
|
||||
: StatelessFeatureFunction(numScoreComponents, line)
|
||||
, m_input(input), m_output(output)
|
||||
{
|
||||
m_inputFactors = FactorMask(input);
|
||||
|
@ -38,15 +38,12 @@ class DecodeFeature : public StatelessFeatureFunction
|
||||
{
|
||||
|
||||
public:
|
||||
DecodeFeature( const std::string& description
|
||||
DecodeFeature(const std::string &line);
|
||||
|
||||
DecodeFeature(size_t numScoreComponents
|
||||
, const std::string &line);
|
||||
|
||||
DecodeFeature( const std::string& description
|
||||
, size_t numScoreComponents
|
||||
, const std::string &line);
|
||||
|
||||
DecodeFeature( const std::string& description
|
||||
, size_t numScoreComponents
|
||||
DecodeFeature(size_t numScoreComponents
|
||||
, const std::vector<FactorType> &input
|
||||
, const std::vector<FactorType> &output
|
||||
, const std::string &line);
|
||||
|
@ -23,7 +23,7 @@ struct DistortionState_traditional : public FFState {
|
||||
};
|
||||
|
||||
DistortionScoreProducer::DistortionScoreProducer(const std::string &line)
|
||||
: StatefulFeatureFunction("Distortion", 1, line)
|
||||
: StatefulFeatureFunction(1, line)
|
||||
{
|
||||
ReadParameters();
|
||||
}
|
||||
|
@ -37,7 +37,7 @@ class ExternalFeature : public StatefulFeatureFunction
|
||||
{
|
||||
public:
|
||||
ExternalFeature(const std::string &line)
|
||||
:StatefulFeatureFunction("ExternalFeature", line) {
|
||||
:StatefulFeatureFunction(line) {
|
||||
ReadParameters();
|
||||
}
|
||||
~ExternalFeature();
|
||||
|
@ -4,7 +4,6 @@
|
||||
#include "moses/TranslationModel/PhraseDictionaryTreeAdaptor.h"
|
||||
#include "moses/TranslationModel/RuleTable/PhraseDictionaryOnDisk.h"
|
||||
#include "moses/TranslationModel/PhraseDictionaryMemory.h"
|
||||
#include "moses/TranslationModel/CompactPT/PhraseDictionaryCompact.h"
|
||||
#include "moses/TranslationModel/PhraseDictionaryMultiModel.h"
|
||||
#include "moses/TranslationModel/PhraseDictionaryMultiModelCounts.h"
|
||||
#include "moses/TranslationModel/RuleTable/PhraseDictionaryALSuffixArray.h"
|
||||
@ -38,6 +37,9 @@
|
||||
#include "moses/LM/SkeletonLM.h"
|
||||
#include "moses/TranslationModel/SkeletonPT.h"
|
||||
|
||||
#ifdef HAVE_CMPH
|
||||
#include "moses/TranslationModel/CompactPT/PhraseDictionaryCompact.h"
|
||||
#endif
|
||||
#ifdef PT_UG
|
||||
#include "moses/TranslationModel/mmsapt.h"
|
||||
#endif
|
||||
@ -144,7 +146,6 @@ FeatureRegistry::FeatureRegistry()
|
||||
MOSES_FNAME2("PhraseDictionaryBinary", PhraseDictionaryTreeAdaptor);
|
||||
MOSES_FNAME(PhraseDictionaryOnDisk);
|
||||
MOSES_FNAME(PhraseDictionaryMemory);
|
||||
MOSES_FNAME(PhraseDictionaryCompact);
|
||||
MOSES_FNAME(PhraseDictionaryMultiModel);
|
||||
MOSES_FNAME(PhraseDictionaryMultiModelCounts);
|
||||
MOSES_FNAME(PhraseDictionaryALSuffixArray);
|
||||
@ -161,6 +162,9 @@ FeatureRegistry::FeatureRegistry()
|
||||
MOSES_FNAME(SkeletonLM);
|
||||
MOSES_FNAME(SkeletonPT);
|
||||
|
||||
#ifdef HAVE_CMPH
|
||||
MOSES_FNAME(PhraseDictionaryCompact);
|
||||
#endif
|
||||
#ifdef PT_UG
|
||||
MOSES_FNAME(Mmsapt);
|
||||
#endif
|
||||
@ -183,7 +187,9 @@ FeatureRegistry::FeatureRegistry()
|
||||
Add("KENLM", new KenFactory());
|
||||
}
|
||||
|
||||
FeatureRegistry::~FeatureRegistry() {}
|
||||
FeatureRegistry::~FeatureRegistry()
|
||||
{
|
||||
}
|
||||
|
||||
void FeatureRegistry::Add(const std::string &name, FeatureFactory *factory)
|
||||
{
|
||||
@ -203,4 +209,15 @@ void FeatureRegistry::Construct(const std::string &name, const std::string &line
|
||||
i->second->Create(line);
|
||||
}
|
||||
|
||||
void FeatureRegistry::PrintFF() const
|
||||
{
|
||||
std::cerr << "Available feature functions:" << std::endl;
|
||||
Map::const_iterator iter;
|
||||
for (iter = registry_.begin(); iter != registry_.end(); ++iter) {
|
||||
const string &ffName = iter->first;
|
||||
std::cerr << ffName << std::endl;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
} // namespace Moses
|
||||
|
@ -18,6 +18,7 @@ public:
|
||||
~FeatureRegistry();
|
||||
|
||||
void Construct(const std::string &name, const std::string &line);
|
||||
void PrintFF() const;
|
||||
|
||||
private:
|
||||
void Add(const std::string &name, FeatureFactory *factory);
|
||||
|
@ -30,40 +30,27 @@ FeatureFunction &FeatureFunction::FindFeatureFunction(const std::string& name)
|
||||
}
|
||||
|
||||
FeatureFunction::
|
||||
FeatureFunction(const std::string& description,
|
||||
const std::string& line)
|
||||
FeatureFunction(const std::string& line)
|
||||
: m_tuneable(true)
|
||||
, m_numScoreComponents(1)
|
||||
{
|
||||
Initialize(description, line);
|
||||
Initialize(line);
|
||||
}
|
||||
|
||||
FeatureFunction::
|
||||
FeatureFunction(const std::string& description,
|
||||
size_t numScoreComponents,
|
||||
FeatureFunction(size_t numScoreComponents,
|
||||
const std::string& line)
|
||||
: m_tuneable(true)
|
||||
, m_numScoreComponents(numScoreComponents)
|
||||
{
|
||||
Initialize(description, line);
|
||||
Initialize(line);
|
||||
}
|
||||
|
||||
void
|
||||
FeatureFunction::
|
||||
Initialize(const std::string& description, const std::string &line)
|
||||
Initialize(const std::string &line)
|
||||
{
|
||||
ParseLine(description, line);
|
||||
|
||||
if (m_description == "") {
|
||||
size_t index = description_counts.count(description);
|
||||
|
||||
ostringstream dstream;
|
||||
dstream << description;
|
||||
dstream << index;
|
||||
|
||||
description_counts.insert(description);
|
||||
m_description = dstream.str();
|
||||
}
|
||||
ParseLine(line);
|
||||
|
||||
ScoreComponentCollection::RegisterScoreProducer(this);
|
||||
m_producers.push_back(this);
|
||||
@ -71,11 +58,13 @@ Initialize(const std::string& description, const std::string &line)
|
||||
|
||||
FeatureFunction::~FeatureFunction() {}
|
||||
|
||||
void FeatureFunction::ParseLine(const std::string& description, const std::string &line)
|
||||
void FeatureFunction::ParseLine(const std::string &line)
|
||||
{
|
||||
vector<string> toks = Tokenize(line);
|
||||
CHECK(toks.size());
|
||||
|
||||
string nameStub = toks[0];
|
||||
|
||||
set<string> keys;
|
||||
|
||||
for (size_t i = 1; i < toks.size(); ++i) {
|
||||
@ -93,6 +82,19 @@ void FeatureFunction::ParseLine(const std::string& description, const std::strin
|
||||
m_args.push_back(args);
|
||||
}
|
||||
}
|
||||
|
||||
// name
|
||||
if (m_description == "") {
|
||||
size_t index = description_counts.count(nameStub);
|
||||
|
||||
ostringstream dstream;
|
||||
dstream << nameStub;
|
||||
dstream << index;
|
||||
|
||||
description_counts.insert(nameStub);
|
||||
m_description = dstream.str();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
void FeatureFunction::SetParameter(const std::string& key, const std::string& value)
|
||||
|
@ -36,8 +36,8 @@ protected:
|
||||
//In case there's multiple producers with the same description
|
||||
static std::multiset<std::string> description_counts;
|
||||
|
||||
void Initialize(const std::string& description, const std::string &line);
|
||||
void ParseLine(const std::string& description, const std::string &line);
|
||||
void Initialize(const std::string &line);
|
||||
void ParseLine(const std::string &line);
|
||||
|
||||
public:
|
||||
static const std::vector<FeatureFunction*>& GetFeatureFunctions() {
|
||||
@ -45,8 +45,8 @@ public:
|
||||
}
|
||||
static FeatureFunction &FindFeatureFunction(const std::string& name);
|
||||
|
||||
FeatureFunction(const std::string& description, const std::string &line);
|
||||
FeatureFunction(const std::string& description, size_t numScoreComponents, const std::string &line);
|
||||
FeatureFunction(const std::string &line);
|
||||
FeatureFunction(size_t numScoreComponents, const std::string &line);
|
||||
virtual bool IsStateless() const = 0;
|
||||
virtual ~FeatureFunction();
|
||||
|
||||
|
@ -11,7 +11,7 @@ using namespace std;
|
||||
namespace Moses
|
||||
{
|
||||
GlobalLexicalModel::GlobalLexicalModel(const std::string &line)
|
||||
: StatelessFeatureFunction("GlobalLexicalModel",1, line)
|
||||
: StatelessFeatureFunction(1, line)
|
||||
{
|
||||
std::cerr << "Creating global lexical model...\n";
|
||||
ReadParameters();
|
||||
|
@ -11,7 +11,7 @@ using namespace std;
|
||||
namespace Moses
|
||||
{
|
||||
GlobalLexicalModelUnlimited::GlobalLexicalModelUnlimited(const std::string &line)
|
||||
:StatelessFeatureFunction("GlobalLexicalModelUnlimited", 0, line)
|
||||
:StatelessFeatureFunction(0, line)
|
||||
{
|
||||
CHECK(false); // TODO need to update arguments to key=value
|
||||
|
||||
|
@ -12,7 +12,7 @@ using namespace std;
|
||||
namespace Moses
|
||||
{
|
||||
InputFeature::InputFeature(const std::string &line)
|
||||
:StatelessFeatureFunction("InputFeature", line)
|
||||
:StatelessFeatureFunction(line)
|
||||
{
|
||||
ReadParameters();
|
||||
}
|
||||
|
@ -10,7 +10,7 @@ class InternalStructStatelessFF : public StatelessFeatureFunction
|
||||
{
|
||||
public:
|
||||
InternalStructStatelessFF(const std::string &line)
|
||||
:StatelessFeatureFunction("InternalStructStatelessFF", line)
|
||||
:StatelessFeatureFunction(line)
|
||||
{}
|
||||
|
||||
bool IsUseable(const FactorMask &mask) const
|
||||
|
@ -10,7 +10,7 @@ using namespace std;
|
||||
namespace Moses
|
||||
{
|
||||
LexicalReordering::LexicalReordering(const std::string &line)
|
||||
: StatefulFeatureFunction("LexicalReordering", line)
|
||||
: StatefulFeatureFunction(line)
|
||||
{
|
||||
std::cerr << "Initializing LexicalReordering.." << std::endl;
|
||||
|
||||
|
@ -8,7 +8,7 @@
|
||||
#include "moses/TargetPhrase.h"
|
||||
#include "moses/TargetPhraseCollection.h"
|
||||
|
||||
#ifndef WIN32
|
||||
#ifdef HAVE_CMPH
|
||||
#include "moses/TranslationModel/CompactPT/LexicalReorderingTableCompact.h"
|
||||
#endif
|
||||
|
||||
@ -52,8 +52,10 @@ void auxAppend(IPhrase& head, const IPhrase& tail)
|
||||
LexicalReorderingTable* LexicalReorderingTable::LoadAvailable(const std::string& filePath, const FactorList& f_factors, const FactorList& e_factors, const FactorList& c_factors)
|
||||
{
|
||||
//decide use Compact or Tree or Memory table
|
||||
LexicalReorderingTable *compactLexr =
|
||||
LexicalReorderingTableCompact::CheckAndLoad(filePath + ".minlexr", f_factors, e_factors, c_factors);
|
||||
LexicalReorderingTable *compactLexr = NULL;
|
||||
#ifdef HAVE_CMPH
|
||||
compactLexr = LexicalReorderingTableCompact::CheckAndLoad(filePath + ".minlexr", f_factors, e_factors, c_factors);
|
||||
#endif
|
||||
if(compactLexr)
|
||||
return compactLexr;
|
||||
if(FileExists(filePath+".binlexr.idx")) {
|
||||
|
@ -11,7 +11,7 @@ namespace Moses
|
||||
{
|
||||
|
||||
OpSequenceModel::OpSequenceModel(const std::string &line)
|
||||
:StatefulFeatureFunction("OpSequenceModel", 5, line )
|
||||
:StatefulFeatureFunction(5, line )
|
||||
{
|
||||
sFactor = 0;
|
||||
tFactor = 0;
|
||||
|
@ -18,7 +18,7 @@ int PhraseBoundaryState::Compare(const FFState& other) const
|
||||
}
|
||||
|
||||
PhraseBoundaryFeature::PhraseBoundaryFeature(const std::string &line)
|
||||
: StatefulFeatureFunction("PhraseBoundaryFeature", 0, line)
|
||||
: StatefulFeatureFunction(0, line)
|
||||
{
|
||||
std::cerr << "Initializing source word deletion feature.." << std::endl;
|
||||
ReadParameters();
|
||||
|
@ -10,7 +10,7 @@ namespace Moses
|
||||
using namespace std;
|
||||
|
||||
PhraseLengthFeature::PhraseLengthFeature(const std::string &line)
|
||||
:StatelessFeatureFunction("PhraseLengthFeature", 0, line)
|
||||
:StatelessFeatureFunction(0, line)
|
||||
{
|
||||
ReadParameters();
|
||||
}
|
||||
|
@ -15,7 +15,7 @@ namespace Moses
|
||||
{
|
||||
|
||||
PhrasePairFeature::PhrasePairFeature(const std::string &line)
|
||||
:StatelessFeatureFunction("PhrasePairFeature", 0, line)
|
||||
:StatelessFeatureFunction(0, line)
|
||||
{
|
||||
std::cerr << "Initializing PhrasePairFeature.." << std::endl;
|
||||
ReadParameters();
|
||||
|
@ -5,7 +5,7 @@
|
||||
namespace Moses
|
||||
{
|
||||
PhrasePenalty::PhrasePenalty(const std::string &line)
|
||||
: StatelessFeatureFunction("PhrasePenalty",1, line)
|
||||
: StatelessFeatureFunction(1, line)
|
||||
{
|
||||
ReadParameters();
|
||||
}
|
||||
|
@ -22,7 +22,7 @@ class SkeletonStatefulFF : public StatefulFeatureFunction
|
||||
{
|
||||
public:
|
||||
SkeletonStatefulFF(const std::string &line)
|
||||
:StatefulFeatureFunction("SkeletonStatefulFF", 3, line)
|
||||
:StatefulFeatureFunction(3, line)
|
||||
{}
|
||||
|
||||
bool IsUseable(const FactorMask &mask) const {
|
||||
|
@ -10,7 +10,7 @@ class SkeletonStatelessFF : public StatelessFeatureFunction
|
||||
{
|
||||
public:
|
||||
SkeletonStatelessFF(const std::string &line)
|
||||
:StatelessFeatureFunction("SkeletonStatelessFF", 2, line)
|
||||
:StatelessFeatureFunction(2, line)
|
||||
{}
|
||||
|
||||
bool IsUseable(const FactorMask &mask) const {
|
||||
|
@ -18,7 +18,7 @@ namespace Moses
|
||||
using namespace std;
|
||||
|
||||
SourceWordDeletionFeature::SourceWordDeletionFeature(const std::string &line)
|
||||
:StatelessFeatureFunction("SourceWordDeletionFeature", 0, line),
|
||||
:StatelessFeatureFunction(0, line),
|
||||
m_unrestricted(true)
|
||||
{
|
||||
std::cerr << "Initializing source word deletion feature.." << std::endl;
|
||||
|
@ -5,14 +5,14 @@ namespace Moses
|
||||
|
||||
std::vector<const StatefulFeatureFunction*> StatefulFeatureFunction::m_statefulFFs;
|
||||
|
||||
StatefulFeatureFunction::StatefulFeatureFunction(const std::string& description, const std::string &line)
|
||||
: FeatureFunction(description, line)
|
||||
StatefulFeatureFunction::StatefulFeatureFunction(const std::string &line)
|
||||
: FeatureFunction(line)
|
||||
{
|
||||
m_statefulFFs.push_back(this);
|
||||
}
|
||||
|
||||
StatefulFeatureFunction::StatefulFeatureFunction(const std::string& description, size_t numScoreComponents, const std::string &line)
|
||||
: FeatureFunction(description,numScoreComponents, line)
|
||||
StatefulFeatureFunction::StatefulFeatureFunction(size_t numScoreComponents, const std::string &line)
|
||||
: FeatureFunction(numScoreComponents, line)
|
||||
{
|
||||
m_statefulFFs.push_back(this);
|
||||
}
|
||||
|
@ -19,8 +19,8 @@ public:
|
||||
return m_statefulFFs;
|
||||
}
|
||||
|
||||
StatefulFeatureFunction(const std::string& description, const std::string &line);
|
||||
StatefulFeatureFunction(const std::string& description, size_t numScoreComponents, const std::string &line);
|
||||
StatefulFeatureFunction(const std::string &line);
|
||||
StatefulFeatureFunction(size_t numScoreComponents, const std::string &line);
|
||||
|
||||
/**
|
||||
* \brief This interface should be implemented.
|
||||
|
@ -5,14 +5,14 @@ namespace Moses
|
||||
|
||||
std::vector<const StatelessFeatureFunction*> StatelessFeatureFunction::m_statelessFFs;
|
||||
|
||||
StatelessFeatureFunction::StatelessFeatureFunction(const std::string& description, const std::string &line)
|
||||
:FeatureFunction(description, line)
|
||||
StatelessFeatureFunction::StatelessFeatureFunction(const std::string &line)
|
||||
:FeatureFunction(line)
|
||||
{
|
||||
m_statelessFFs.push_back(this);
|
||||
}
|
||||
|
||||
StatelessFeatureFunction::StatelessFeatureFunction(const std::string& description, size_t numScoreComponents, const std::string &line)
|
||||
:FeatureFunction(description, numScoreComponents, line)
|
||||
StatelessFeatureFunction::StatelessFeatureFunction(size_t numScoreComponents, const std::string &line)
|
||||
:FeatureFunction(numScoreComponents, line)
|
||||
{
|
||||
m_statelessFFs.push_back(this);
|
||||
}
|
||||
|
@ -18,8 +18,8 @@ public:
|
||||
return m_statelessFFs;
|
||||
}
|
||||
|
||||
StatelessFeatureFunction(const std::string& description, const std::string &line);
|
||||
StatelessFeatureFunction(const std::string& description, size_t numScoreComponents, const std::string &line);
|
||||
StatelessFeatureFunction(const std::string &line);
|
||||
StatelessFeatureFunction(size_t numScoreComponents, const std::string &line);
|
||||
/**
|
||||
* This should be implemented for features that apply to phrase-based models.
|
||||
**/
|
||||
|
@ -18,7 +18,7 @@ int TargetBigramState::Compare(const FFState& other) const
|
||||
}
|
||||
|
||||
TargetBigramFeature::TargetBigramFeature(const std::string &line)
|
||||
:StatefulFeatureFunction("TargetBigramFeature", 0, line)
|
||||
:StatefulFeatureFunction(0, line)
|
||||
{
|
||||
std::cerr << "Initializing target bigram feature.." << std::endl;
|
||||
ReadParameters();
|
||||
|
@ -38,7 +38,7 @@ int TargetNgramState::Compare(const FFState& other) const
|
||||
}
|
||||
|
||||
TargetNgramFeature::TargetNgramFeature(const std::string &line)
|
||||
:StatefulFeatureFunction("TargetNgramFeature", 0, line)
|
||||
:StatefulFeatureFunction(0, line)
|
||||
{
|
||||
std::cerr << "Initializing target ngram feature.." << std::endl;
|
||||
ReadParameters();
|
||||
|
@ -16,7 +16,7 @@ namespace Moses
|
||||
using namespace std;
|
||||
|
||||
TargetWordInsertionFeature::TargetWordInsertionFeature(const std::string &line)
|
||||
:StatelessFeatureFunction("TargetWordInsertionFeature", 0, line),
|
||||
:StatelessFeatureFunction(0, line),
|
||||
m_unrestricted(true)
|
||||
{
|
||||
std::cerr << "Initializing target word insertion feature.." << std::endl;
|
||||
|
@ -7,7 +7,7 @@ using namespace std;
|
||||
namespace Moses
|
||||
{
|
||||
UnknownWordPenaltyProducer::UnknownWordPenaltyProducer(const std::string &line)
|
||||
: StatelessFeatureFunction("UnknownWordPenalty",1, line)
|
||||
: StatelessFeatureFunction(1, line)
|
||||
{
|
||||
m_tuneable = false;
|
||||
ReadParameters();
|
||||
|
@ -7,7 +7,7 @@ using namespace std;
|
||||
namespace Moses
|
||||
{
|
||||
WordPenaltyProducer::WordPenaltyProducer(const std::string &line)
|
||||
: StatelessFeatureFunction("WordPenalty",1, line)
|
||||
: StatelessFeatureFunction(1, line)
|
||||
{
|
||||
ReadParameters();
|
||||
}
|
||||
|
@ -18,7 +18,7 @@ namespace Moses
|
||||
{
|
||||
|
||||
WordTranslationFeature::WordTranslationFeature(const std::string &line)
|
||||
:StatelessFeatureFunction("WordTranslationFeature", 0, line)
|
||||
:StatelessFeatureFunction(0, line)
|
||||
,m_unrestricted(true)
|
||||
,m_simple(true)
|
||||
,m_sourceContext(false)
|
||||
|
@ -36,7 +36,7 @@ namespace Moses
|
||||
{
|
||||
|
||||
GenerationDictionary::GenerationDictionary(const std::string &line)
|
||||
: DecodeFeature("Generation", line)
|
||||
: DecodeFeature(line)
|
||||
{
|
||||
ReadParameters();
|
||||
}
|
||||
|
@ -34,8 +34,8 @@ using namespace std;
|
||||
namespace Moses
|
||||
{
|
||||
|
||||
LanguageModel::LanguageModel(const std::string& description, const std::string &line) :
|
||||
StatefulFeatureFunction(description, StaticData::Instance().GetLMEnableOOVFeature() ? 2 : 1, line )
|
||||
LanguageModel::LanguageModel(const std::string &line) :
|
||||
StatefulFeatureFunction(StaticData::Instance().GetLMEnableOOVFeature() ? 2 : 1, line )
|
||||
{
|
||||
m_enableOOVFeature = StaticData::Instance().GetLMEnableOOVFeature();
|
||||
}
|
||||
|
@ -43,7 +43,7 @@ class Phrase;
|
||||
class LanguageModel : public StatefulFeatureFunction
|
||||
{
|
||||
protected:
|
||||
LanguageModel(const std::string& description, const std::string &line);
|
||||
LanguageModel(const std::string &line);
|
||||
|
||||
// This can't be in the constructor for virual function dispatch reasons
|
||||
|
||||
|
@ -40,7 +40,7 @@ using namespace std;
|
||||
namespace Moses
|
||||
{
|
||||
LanguageModelIRST::LanguageModelIRST(const std::string &line)
|
||||
:LanguageModelSingleFactor("IRSTLM", line)
|
||||
:LanguageModelSingleFactor(line)
|
||||
{
|
||||
const StaticData &staticData = StaticData::Instance();
|
||||
int threadCount = staticData.ThreadCount();
|
||||
|
@ -41,8 +41,8 @@ using namespace std;
|
||||
|
||||
namespace Moses
|
||||
{
|
||||
LanguageModelImplementation::LanguageModelImplementation(const std::string& description, const std::string &line)
|
||||
:LanguageModel(description, line)
|
||||
LanguageModelImplementation::LanguageModelImplementation(const std::string &line)
|
||||
:LanguageModel(line)
|
||||
{
|
||||
}
|
||||
|
||||
|
@ -60,7 +60,7 @@ protected:
|
||||
Word m_sentenceStartWord, m_sentenceEndWord; //! Contains factors which represents the beging and end words for this LM.
|
||||
//! Usually <s> and </s>
|
||||
|
||||
LanguageModelImplementation(const std::string& description, const std::string &line);
|
||||
LanguageModelImplementation(const std::string &line);
|
||||
|
||||
public:
|
||||
|
||||
|
@ -50,7 +50,7 @@ protected:
|
||||
size_t m_implFactor;
|
||||
public:
|
||||
LanguageModelJoint(const std::string &line, LanguageModelSingleFactor *lmImpl)
|
||||
:LanguageModelMultiFactor("JointLM", line) {
|
||||
:LanguageModelMultiFactor(line) {
|
||||
m_lmImpl = lmImpl;
|
||||
}
|
||||
|
||||
|
@ -140,7 +140,7 @@ private:
|
||||
} // namespace
|
||||
|
||||
template <class Model> LanguageModelKen<Model>::LanguageModelKen(const std::string &line, const std::string &file, FactorType factorType, bool lazy)
|
||||
:LanguageModel("KENLM", line)
|
||||
:LanguageModel(line)
|
||||
,m_factorType(factorType)
|
||||
{
|
||||
lm::ngram::Config config;
|
||||
@ -161,7 +161,7 @@ template <class Model> LanguageModelKen<Model>::LanguageModelKen(const std::stri
|
||||
}
|
||||
|
||||
template <class Model> LanguageModelKen<Model>::LanguageModelKen(const LanguageModelKen<Model> ©_from)
|
||||
:LanguageModel(copy_from.GetScoreProducerDescription(), copy_from.GetArgLine()),
|
||||
:LanguageModel(copy_from.GetArgLine()),
|
||||
m_ngram(copy_from.m_ngram),
|
||||
// TODO: don't copy this.
|
||||
m_lmIdLookup(copy_from.m_lmIdLookup),
|
||||
|
@ -41,8 +41,8 @@ class LanguageModelMultiFactor : public LanguageModelImplementation
|
||||
protected:
|
||||
FactorMask m_factorTypes;
|
||||
|
||||
LanguageModelMultiFactor(const std::string& description, const std::string &line)
|
||||
:LanguageModelImplementation(description, line) {
|
||||
LanguageModelMultiFactor(const std::string &line)
|
||||
:LanguageModelImplementation(line) {
|
||||
}
|
||||
|
||||
public:
|
||||
|
@ -10,7 +10,7 @@ using namespace std;
|
||||
namespace Moses
|
||||
{
|
||||
NeuralLMWrapper::NeuralLMWrapper(const std::string &line)
|
||||
:LanguageModelSingleFactor("NeuralLM", line)
|
||||
:LanguageModelSingleFactor(line)
|
||||
{
|
||||
// This space intentionally left blank
|
||||
}
|
||||
|
@ -22,7 +22,7 @@ class LanguageModelORLM : public LanguageModelSingleFactor
|
||||
public:
|
||||
typedef count_t T; // type for ORLM filter
|
||||
LanguageModelORLM(const std::string &line)
|
||||
:LanguageModelSingleFactor("ORLM", line)
|
||||
:LanguageModelSingleFactor(line)
|
||||
,m_lm(0) {
|
||||
}
|
||||
bool Load(const std::string &filePath, FactorType factorType, size_t nGramOrder);
|
||||
|
@ -85,7 +85,7 @@ private:
|
||||
|
||||
public:
|
||||
LanguageModelParallelBackoff(const std::string &line)
|
||||
:LanguageModelMultiFactor("ParallelBackoffLM", line) {
|
||||
:LanguageModelMultiFactor(line) {
|
||||
}
|
||||
|
||||
~LanguageModelParallelBackoff();
|
||||
|
@ -22,7 +22,6 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
// The following ifdef prevents XCode and other non-bjam build systems
|
||||
// from attempting to compile this file when LM_RAND is disabled.
|
||||
//
|
||||
#ifdef LM_RAND
|
||||
|
||||
#include <limits>
|
||||
#include <iostream>
|
||||
@ -44,7 +43,7 @@ namespace Moses
|
||||
{
|
||||
|
||||
LanguageModelRandLM::LanguageModelRandLM(const std::string &line)
|
||||
:LanguageModelSingleFactor("RandLM", line)
|
||||
:LanguageModelSingleFactor(line)
|
||||
, m_lm(0)
|
||||
{
|
||||
}
|
||||
@ -147,4 +146,3 @@ void LanguageModelRandLM::CleanUpAfterSentenceProcessing(const InputType& source
|
||||
|
||||
}
|
||||
|
||||
#endif
|
||||
|
@ -54,7 +54,7 @@ using namespace std;
|
||||
namespace Moses
|
||||
{
|
||||
LanguageModelSRI::LanguageModelSRI(const std::string &line)
|
||||
:LanguageModelSingleFactor("SRILM", line)
|
||||
:LanguageModelSingleFactor(line)
|
||||
,m_srilmVocab(0)
|
||||
,m_srilmModel(0)
|
||||
{
|
||||
|
@ -38,8 +38,8 @@ using namespace std;
|
||||
namespace Moses
|
||||
{
|
||||
|
||||
LanguageModelSingleFactor::LanguageModelSingleFactor(const std::string& description, const std::string &line)
|
||||
:LanguageModelImplementation(description, line)
|
||||
LanguageModelSingleFactor::LanguageModelSingleFactor(const std::string &line)
|
||||
:LanguageModelImplementation(line)
|
||||
{
|
||||
m_nullContextState = new PointerState(NULL);
|
||||
m_beginSentenceState = new PointerState(NULL);
|
||||
|
@ -43,7 +43,7 @@ protected:
|
||||
FFState *m_nullContextState;
|
||||
FFState *m_beginSentenceState;
|
||||
|
||||
LanguageModelSingleFactor(const std::string& description, const std::string &line);
|
||||
LanguageModelSingleFactor(const std::string &line);
|
||||
|
||||
public:
|
||||
virtual ~LanguageModelSingleFactor();
|
||||
|
@ -7,7 +7,7 @@ using namespace std;
|
||||
namespace Moses
|
||||
{
|
||||
SkeletonLM::SkeletonLM(const std::string &line)
|
||||
:LanguageModelSingleFactor("SkeletonLM", line)
|
||||
:LanguageModelSingleFactor(line)
|
||||
{
|
||||
ReadParameters();
|
||||
|
||||
|
@ -62,7 +62,7 @@ public:
|
||||
}
|
||||
|
||||
bool OutputIsCout() const {
|
||||
return (m_outStream == std::cout);
|
||||
return (m_outStream == &std::cout);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -270,6 +270,7 @@ bool Parameter::LoadParam(int argc, char* argv[])
|
||||
&& (configPath = FindParam("-config", argc, argv)) == "") {
|
||||
PrintCredit();
|
||||
Explain();
|
||||
PrintFF();
|
||||
|
||||
cerr << endl;
|
||||
UserMessage::Add("No configuration file was specified. Use -config or -f");
|
||||
@ -1302,6 +1303,11 @@ void Parameter::OverwriteParam(const string ¶mName, PARAM_VEC values)
|
||||
VERBOSE(2, std::endl);
|
||||
}
|
||||
|
||||
void Parameter::PrintFF() const
|
||||
{
|
||||
StaticData::Instance().GetFeatureRegistry().PrintFF();
|
||||
}
|
||||
|
||||
std::set<std::string> Parameter::GetWeightNames() const
|
||||
{
|
||||
std::set<std::string> ret;
|
||||
|
@ -62,6 +62,7 @@ protected:
|
||||
void AddParam(const std::string ¶mName, const std::string &abbrevName, const std::string &description);
|
||||
|
||||
void PrintCredit();
|
||||
void PrintFF() const;
|
||||
|
||||
void SetWeight(const std::string &name, size_t ind, float weight);
|
||||
void SetWeight(const std::string &name, size_t ind, const std::vector<float> &weights);
|
||||
|
@ -32,8 +32,8 @@ BOOST_AUTO_TEST_SUITE(scc)
|
||||
class MockStatelessFeatureFunction : public StatelessFeatureFunction
|
||||
{
|
||||
public:
|
||||
MockStatelessFeatureFunction(const string& desc, size_t n, const string &line) :
|
||||
StatelessFeatureFunction(desc,n, line) {}
|
||||
MockStatelessFeatureFunction(size_t n, const string &line) :
|
||||
StatelessFeatureFunction(n, line) {}
|
||||
void Evaluate(const Hypothesis&, ScoreComponentCollection*) const {}
|
||||
void EvaluateChart(const ChartHypothesis&, ScoreComponentCollection*) const {}
|
||||
void Evaluate(const InputType &input
|
||||
@ -52,7 +52,7 @@ public:
|
||||
class MockSingleFeature : public MockStatelessFeatureFunction
|
||||
{
|
||||
public:
|
||||
MockSingleFeature(): MockStatelessFeatureFunction("MockSingle",1, "MockSingle") {}
|
||||
MockSingleFeature(): MockStatelessFeatureFunction(1, "MockSingle") {}
|
||||
|
||||
bool IsUseable(const FactorMask &mask) const {
|
||||
return true;
|
||||
@ -62,7 +62,7 @@ public:
|
||||
class MockMultiFeature : public MockStatelessFeatureFunction
|
||||
{
|
||||
public:
|
||||
MockMultiFeature(): MockStatelessFeatureFunction("MockMulti", 5, "MockMulti") {}
|
||||
MockMultiFeature(): MockStatelessFeatureFunction(5, "MockMulti") {}
|
||||
|
||||
bool IsUseable(const FactorMask &mask) const {
|
||||
return true;
|
||||
@ -73,7 +73,7 @@ public:
|
||||
class MockSparseFeature : public MockStatelessFeatureFunction
|
||||
{
|
||||
public:
|
||||
MockSparseFeature(): MockStatelessFeatureFunction("MockSparse", 0, "MockSparse") {}
|
||||
MockSparseFeature(): MockStatelessFeatureFunction(0, "MockSparse") {}
|
||||
|
||||
bool IsUseable(const FactorMask &mask) const {
|
||||
return true;
|
||||
|
@ -24,7 +24,6 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
#include "util/check.hh"
|
||||
|
||||
#include "TypeDef.h"
|
||||
#include "moses/FF/Factory.h"
|
||||
#include "moses/FF/WordPenaltyProducer.h"
|
||||
#include "moses/FF/UnknownWordPenaltyProducer.h"
|
||||
#include "moses/FF/InputFeature.h"
|
||||
@ -510,7 +509,6 @@ bool StaticData::LoadData(Parameter *parameter)
|
||||
map<string, int> featureIndexMap;
|
||||
|
||||
const vector<string> &features = m_parameter->GetParam("feature");
|
||||
FeatureRegistry registry;
|
||||
for (size_t i = 0; i < features.size(); ++i) {
|
||||
const string &line = Trim(features[i]);
|
||||
cerr << "line=" << line << endl;
|
||||
@ -521,7 +519,7 @@ bool StaticData::LoadData(Parameter *parameter)
|
||||
|
||||
const string &feature = toks[0];
|
||||
|
||||
registry.Construct(feature, line);
|
||||
m_registry.Construct(feature, line);
|
||||
}
|
||||
|
||||
OverrideFeatures();
|
||||
|
@ -41,6 +41,7 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
#include "Parameter.h"
|
||||
#include "SentenceStats.h"
|
||||
#include "ScoreComponentCollection.h"
|
||||
#include "moses/FF/Factory.h"
|
||||
|
||||
namespace Moses
|
||||
{
|
||||
@ -206,6 +207,8 @@ protected:
|
||||
FactorType m_placeHolderFactor;
|
||||
bool m_useLegacyPT;
|
||||
|
||||
FeatureRegistry m_registry;
|
||||
|
||||
StaticData();
|
||||
|
||||
void LoadChartDecodingParameters();
|
||||
@ -752,6 +755,9 @@ public:
|
||||
return m_placeHolderFactor;
|
||||
}
|
||||
|
||||
const FeatureRegistry &GetFeatureRegistry() const
|
||||
{ return m_registry; }
|
||||
|
||||
/** check whether we should be using the old code to support binary phrase-table.
|
||||
** eventually, we'll stop support the binary phrase-table and delete this legacy code
|
||||
**/
|
||||
|
@ -5,12 +5,13 @@ if $(with-cmph) {
|
||||
lib cmph : : <search>$(with-cmph)/lib <search>$(with-cmph)/lib64 ;
|
||||
includes += <include>$(with-cmph)/include ;
|
||||
current = "--with-cmph=$(with-cmph)" ;
|
||||
fakelib CompactPT : [ glob *.cpp ] ../..//headers cmph : $(includes) <dependency>$(PT-LOG) : : $(includes) ;
|
||||
}
|
||||
else {
|
||||
alias cmph ;
|
||||
fakelib CompactPT ;
|
||||
}
|
||||
|
||||
path-constant PT-LOG : bin/pt.log ;
|
||||
update-if-changed $(PT-LOG) $(current) ;
|
||||
|
||||
fakelib CompactPT : [ glob *.cpp ] ../..//headers cmph : $(includes) <dependency>$(PT-LOG) : : $(includes) ;
|
||||
|
@ -42,7 +42,7 @@ namespace Moses
|
||||
{
|
||||
|
||||
PhraseDictionaryCompact::PhraseDictionaryCompact(const std::string &line)
|
||||
:PhraseDictionary("PhraseDictionaryCompact", line)
|
||||
:PhraseDictionary(line)
|
||||
,m_inMemory(true)
|
||||
,m_useAlignmentInfo(true)
|
||||
,m_hash(10, 16)
|
||||
|
@ -118,7 +118,7 @@ bool Vocab::Load(FileHandler* vcbin, const FactorDirection& direction,
|
||||
std::string line, word_str;
|
||||
wordID_t id;
|
||||
|
||||
void *ret = getline(*vcbin, line);
|
||||
std::istream &ret = getline(*vcbin, line);
|
||||
CHECK(ret);
|
||||
std::istringstream first(line.c_str());
|
||||
uint32_t vcbsize(0);
|
||||
|
@ -32,8 +32,8 @@ using namespace std;
|
||||
namespace Moses
|
||||
{
|
||||
|
||||
PhraseDictionary::PhraseDictionary(const std::string &description, const std::string &line)
|
||||
:DecodeFeature(description, line)
|
||||
PhraseDictionary::PhraseDictionary(const std::string &line)
|
||||
:DecodeFeature(line)
|
||||
,m_tableLimit(20) // default
|
||||
,m_maxCacheSize(DEFAULT_MAX_TRANS_OPT_CACHE_SIZE)
|
||||
{
|
||||
|
@ -59,7 +59,7 @@ class ChartParser;
|
||||
class PhraseDictionary : public DecodeFeature
|
||||
{
|
||||
public:
|
||||
PhraseDictionary(const std::string &description, const std::string &line);
|
||||
PhraseDictionary(const std::string &line);
|
||||
|
||||
virtual ~PhraseDictionary() {
|
||||
}
|
||||
|
@ -10,7 +10,7 @@ namespace Moses
|
||||
{
|
||||
PhraseDictionaryDynSuffixArray::
|
||||
PhraseDictionaryDynSuffixArray(const std::string &line)
|
||||
: PhraseDictionary("PhraseDictionaryDynSuffixArray", line)
|
||||
: PhraseDictionary(line)
|
||||
,m_biSA(new BilingualDynSuffixArray())
|
||||
{
|
||||
ReadParameters();
|
||||
|
@ -41,7 +41,7 @@ using namespace std;
|
||||
namespace Moses
|
||||
{
|
||||
PhraseDictionaryMemory::PhraseDictionaryMemory(const std::string &line)
|
||||
: RuleTableTrie("PhraseDictionaryMemory", line)
|
||||
: RuleTableTrie(line)
|
||||
{
|
||||
ReadParameters();
|
||||
|
||||
|
@ -39,8 +39,8 @@ class PhraseDictionaryMemory : public RuleTableTrie
|
||||
friend class RuleTableLoader;
|
||||
|
||||
protected:
|
||||
PhraseDictionaryMemory(const std::string &description, const std::string &line)
|
||||
: RuleTableTrie(description, line) {
|
||||
PhraseDictionaryMemory(int type, const std::string &line)
|
||||
: RuleTableTrie(line) {
|
||||
}
|
||||
|
||||
public:
|
||||
|
@ -26,7 +26,7 @@ namespace Moses
|
||||
|
||||
{
|
||||
PhraseDictionaryMultiModel::PhraseDictionaryMultiModel(const std::string &line)
|
||||
:PhraseDictionary("PhraseDictionaryMultiModel", line)
|
||||
:PhraseDictionary(line)
|
||||
{
|
||||
ReadParameters();
|
||||
|
||||
@ -43,10 +43,11 @@ PhraseDictionaryMultiModel::PhraseDictionaryMultiModel(const std::string &line)
|
||||
CHECK(m_pdStr.size() == m_multimodelweights.size() || m_pdStr.size()*numWeights == m_multimodelweights.size());
|
||||
}
|
||||
|
||||
PhraseDictionaryMultiModel::PhraseDictionaryMultiModel(const std::string &description, const std::string &line)
|
||||
:PhraseDictionary(description, line)
|
||||
PhraseDictionaryMultiModel::PhraseDictionaryMultiModel(int type, const std::string &line)
|
||||
:PhraseDictionary(line)
|
||||
{
|
||||
if (description == "PhraseDictionaryMultiModelCounts") {
|
||||
if (type == 1) {
|
||||
// PhraseDictionaryMultiModelCounts
|
||||
CHECK(m_pdStr.size() == m_multimodelweights.size() || m_pdStr.size()*4 == m_multimodelweights.size());
|
||||
}
|
||||
}
|
||||
|
@ -61,7 +61,7 @@ class PhraseDictionaryMultiModel: public PhraseDictionary
|
||||
|
||||
public:
|
||||
PhraseDictionaryMultiModel(const std::string &line);
|
||||
PhraseDictionaryMultiModel(const std::string &description, const std::string &line);
|
||||
PhraseDictionaryMultiModel(int type, const std::string &line);
|
||||
~PhraseDictionaryMultiModel();
|
||||
void Load();
|
||||
virtual void CollectSufficientStatistics(const Phrase& src, std::map<std::string,multiModelStatistics*>* allStats) const;
|
||||
|
@ -61,7 +61,7 @@ namespace Moses
|
||||
{
|
||||
|
||||
PhraseDictionaryMultiModelCounts::PhraseDictionaryMultiModelCounts(const std::string &line)
|
||||
:PhraseDictionaryMultiModel("PhraseDictionaryMultiModelCounts", line)
|
||||
:PhraseDictionaryMultiModel(1, line)
|
||||
{
|
||||
m_mode = "instance_weighting";
|
||||
m_combineFunction = InstanceWeighting;
|
||||
|
@ -27,7 +27,7 @@ namespace Moses
|
||||
|
||||
PhraseDictionaryTreeAdaptor::
|
||||
PhraseDictionaryTreeAdaptor(const std::string &line)
|
||||
: PhraseDictionary("PhraseDictionaryBinary", line)
|
||||
: PhraseDictionary(line)
|
||||
{
|
||||
ReadParameters();
|
||||
}
|
||||
|
@ -21,7 +21,7 @@ using namespace std;
|
||||
namespace Moses
|
||||
{
|
||||
PhraseDictionaryALSuffixArray::PhraseDictionaryALSuffixArray(const std::string &line)
|
||||
: PhraseDictionaryMemory("PhraseDictionaryALSuffixArray", line)
|
||||
: PhraseDictionaryMemory(1, line)
|
||||
{
|
||||
const StaticData &staticData = StaticData::Instance();
|
||||
if (staticData.ThreadCount() > 1) {
|
||||
|
@ -54,7 +54,7 @@ namespace Moses
|
||||
{
|
||||
|
||||
PhraseDictionaryFuzzyMatch::PhraseDictionaryFuzzyMatch(const std::string &line)
|
||||
:PhraseDictionary("PhraseDictionaryFuzzyMatch", line)
|
||||
:PhraseDictionary(line)
|
||||
,m_FuzzyMatchWrapper(NULL)
|
||||
{
|
||||
CHECK(m_args.size() == 0);
|
||||
|
@ -35,7 +35,7 @@ using namespace std;
|
||||
namespace Moses
|
||||
{
|
||||
PhraseDictionaryOnDisk::PhraseDictionaryOnDisk(const std::string &line)
|
||||
: MyBase("PhraseDictionaryOnDisk", line)
|
||||
: MyBase(line)
|
||||
{
|
||||
ReadParameters();
|
||||
}
|
||||
|
@ -40,8 +40,8 @@ class Word;
|
||||
class RuleTableTrie : public PhraseDictionary
|
||||
{
|
||||
public:
|
||||
RuleTableTrie(const std::string &description, const std::string &line)
|
||||
: PhraseDictionary(description, line) {
|
||||
RuleTableTrie(const std::string &line)
|
||||
: PhraseDictionary(line) {
|
||||
}
|
||||
|
||||
virtual ~RuleTableTrie();
|
||||
|
@ -46,7 +46,7 @@ class RuleTableUTrie : public RuleTableTrie
|
||||
{
|
||||
public:
|
||||
RuleTableUTrie(const std::string &line)
|
||||
: RuleTableTrie("RuleTableUTrie", line) {
|
||||
: RuleTableTrie(line) {
|
||||
}
|
||||
|
||||
const UTrieNode &GetRootNode() const {
|
||||
|
@ -7,7 +7,7 @@ using namespace std;
|
||||
namespace Moses
|
||||
{
|
||||
SkeletonPT::SkeletonPT(const std::string &line)
|
||||
: PhraseDictionary("SkeletonPT", line)
|
||||
: PhraseDictionary(line)
|
||||
{
|
||||
ReadParameters();
|
||||
}
|
||||
|
@ -29,6 +29,7 @@ TranslationOptionCollectionLattice::TranslationOptionCollectionLattice(
|
||||
const InputFeature *inputFeature = StaticData::Instance().GetInputFeature();
|
||||
CHECK(inputFeature);
|
||||
|
||||
size_t maxPhraseLength = StaticData::Instance().GetMaxPhraseLength();
|
||||
size_t size = input.GetSize();
|
||||
|
||||
// 1-word phrases
|
||||
@ -76,6 +77,11 @@ TranslationOptionCollectionLattice::TranslationOptionCollectionLattice(
|
||||
}
|
||||
|
||||
size_t startPos = prevPath.GetWordsRange().GetStartPos();
|
||||
|
||||
if (endPos - startPos + 1 > maxPhraseLength) {
|
||||
continue;
|
||||
}
|
||||
|
||||
WordsRange range(startPos, endPos);
|
||||
const NonTerminalSet &labels = input.GetLabelSet(startPos, endPos);
|
||||
|
||||
|
@ -17,8 +17,8 @@
|
||||
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
***********************************************************************/
|
||||
|
||||
#include <iostream>
|
||||
#include "Subgraph.h"
|
||||
|
||||
#include "Node.h"
|
||||
|
||||
namespace Moses
|
||||
|
@ -967,7 +967,7 @@ decode
|
||||
default-name: evaluation/output
|
||||
qsub-script: yes
|
||||
ignore-if: use-hiero
|
||||
rerun-on-change: decoder decoder-settings nbest report-segmentation report-precision-by-coverage analyze-search-graph
|
||||
rerun-on-change: decoder decoder-settings nbest report-segmentation report-precision-by-coverage analyze-search-graph wade
|
||||
error: Translation was not performed correctly
|
||||
not-error: trans: No such file or directory
|
||||
hiero-decode
|
||||
@ -1031,6 +1031,13 @@ lowercase-reference
|
||||
pass-if: recaser
|
||||
multiref: $moses-script-dir/ems/support/run-command-on-multiple-refsets.perl
|
||||
template: $output-lowercaser < IN > OUT
|
||||
wade
|
||||
in: filtered-dir truecased-input tokenized-reference alignment system-output
|
||||
out: wade-analysis
|
||||
default-name: evaluation/wade-analysis
|
||||
ignore-unless: wade
|
||||
rerun-on-change: wade
|
||||
template: $moses-script-dir/ems/support/run-wade.perl $wade IN IN1 IN2 IN3 IN4 OUT
|
||||
nist-bleu
|
||||
in: wrapped-output reference-sgm
|
||||
out: nist-bleu-score
|
||||
@ -1131,6 +1138,6 @@ analysis-precision
|
||||
|
||||
[REPORTING] single
|
||||
report
|
||||
in: EVALUATION:nist-bleu-score EVALUATION:nist-bleu-c-score EVALUATION:bolt-bleu-score EVALUATION:bolt-bleu-c-score EVALUATION:multi-bleu-score EVALUATION:multi-bleu-c-score EVALUATION:meteor-score EVALUATION:ter-score EVALUATION:wer-score EVALUATION:ibm-bleu-score EVALUATION:ibm-bleu-c-score EVALUATION:analysis EVALUATION:analysis-coverage EVALUATION:analysis-prec TRAINING:biconcor-model
|
||||
in: EVALUATION:nist-bleu-score EVALUATION:nist-bleu-c-score EVALUATION:bolt-bleu-score EVALUATION:bolt-bleu-c-score EVALUATION:multi-bleu-score EVALUATION:multi-bleu-c-score EVALUATION:meteor-score EVALUATION:ter-score EVALUATION:wer-score EVALUATION:ibm-bleu-score EVALUATION:ibm-bleu-c-score EVALUATION:analysis EVALUATION:analysis-coverage EVALUATION:analysis-prec TRAINING:biconcor-model EVALUATION:wade-analysis
|
||||
out: report
|
||||
default-name: evaluation/report
|
||||
|
@ -2646,6 +2646,7 @@ sub define_evaluation_decode {
|
||||
my $report_segmentation = &backoff_and_get("EVALUATION:$set:report-segmentation");
|
||||
my $analyze_search_graph = &backoff_and_get("EVALUATION:$set:analyze-search-graph");
|
||||
my $report_precision_by_coverage = &backoff_and_get("EVALUATION:$set:report-precision-by-coverage");
|
||||
my $use_wade = &backoff_and_get("EVALUATION:$set:wade");
|
||||
my $hierarchical = &get("TRAINING:hierarchical-rule-set");
|
||||
my $word_alignment = &backoff_and_get("TRAINING:include-word-alignment-in-rules");
|
||||
|
||||
@ -2666,6 +2667,9 @@ sub define_evaluation_decode {
|
||||
$settings .= " -t";
|
||||
}
|
||||
}
|
||||
if ($use_wade) {
|
||||
$settings .= " -T $system_output.details";
|
||||
}
|
||||
$settings .= " -text-type \"test\"";
|
||||
|
||||
my $addTags = &backoff_and_get("EVALUATION:$set:add-tags");
|
||||
|
30
scripts/ems/support/run-wade.perl
Executable file
30
scripts/ems/support/run-wade.perl
Executable file
@ -0,0 +1,30 @@
|
||||
#!/usr/bin/perl
|
||||
|
||||
use strict;
|
||||
use File::Temp qw/ tempfile tempdir /;
|
||||
|
||||
if (scalar(@ARGV) != 7) {
|
||||
print STDERR "Usage: run-wade.perl wade-script filtered-dir input reference alignment output wade-output\n";
|
||||
exit 1;
|
||||
}
|
||||
|
||||
my ($wade_script, $filtered_dir, $input, $reference, $alignment, $output, $wade_output) = @ARGV;
|
||||
my ($cfh, $cfile) = tempfile();
|
||||
|
||||
#unless ($phrase_table =~ /.*\.gz/){ $phrase_table .= ".gz";}
|
||||
|
||||
print $cfh "phrase-table=$filtered_dir/phrase-table.0-0.1.1.gz\n";
|
||||
print $cfh "fr_test=$input\n";
|
||||
print $cfh "en_test=$reference\n";
|
||||
print $cfh "fren_align_test=$alignment\n";
|
||||
print $cfh "translation_details=$output.details\n";
|
||||
|
||||
print $cfh "candidatealign_out=$wade_output.candalign\n";
|
||||
print $cfh "annotatedalign_out=$wade_output.annotalign\n";
|
||||
print $cfh "transspans_out=$wade_output.transspans\n";
|
||||
print $cfh "wade_output=$wade_output\n";
|
||||
close $cfh;
|
||||
|
||||
print $cfile . "\n";
|
||||
|
||||
system("python $wade_script $cfile");
|
Loading…
Reference in New Issue
Block a user