mirror of
https://github.com/moses-smt/mosesdecoder.git
synced 2025-01-07 12:10:36 +03:00
Merge ../mosesdecoder into hieu
This commit is contained in:
commit
238864a53e
@ -1237,14 +1237,14 @@
|
||||
<locationURI>PARENT-3-PROJECT_LOC/moses/FF/ReferenceComparison.h</locationURI>
|
||||
</link>
|
||||
<link>
|
||||
<name>FF/RuleAmbiguity.cpp</name>
|
||||
<name>FF/RuleScope.cpp</name>
|
||||
<type>1</type>
|
||||
<locationURI>PARENT-3-PROJECT_LOC/moses/FF/RuleAmbiguity.cpp</locationURI>
|
||||
<locationURI>PARENT-3-PROJECT_LOC/moses/FF/RuleScope.cpp</locationURI>
|
||||
</link>
|
||||
<link>
|
||||
<name>FF/RuleAmbiguity.h</name>
|
||||
<name>FF/RuleScope.h</name>
|
||||
<type>1</type>
|
||||
<locationURI>PARENT-3-PROJECT_LOC/moses/FF/RuleAmbiguity.h</locationURI>
|
||||
<locationURI>PARENT-3-PROJECT_LOC/moses/FF/RuleScope.h</locationURI>
|
||||
</link>
|
||||
<link>
|
||||
<name>FF/SetSourcePhrase.cpp</name>
|
||||
|
@ -192,12 +192,7 @@ void ChartTranslationOptionList::Evaluate(const InputType &input, const InputPat
|
||||
}
|
||||
|
||||
size_t newSize = m_size - numDiscard;
|
||||
|
||||
if (numDiscard) {
|
||||
cerr << "LIST numDiscard=" << numDiscard << " newSize=" << newSize << endl;
|
||||
}
|
||||
m_size = newSize;
|
||||
|
||||
}
|
||||
|
||||
void ChartTranslationOptionList::SwapTranslationOptions(size_t a, size_t b)
|
||||
|
@ -79,10 +79,6 @@ void ChartTranslationOptions::Evaluate(const InputType &input, const InputPath &
|
||||
}
|
||||
|
||||
size_t newSize = m_collection.size() - numDiscard;
|
||||
|
||||
if (numDiscard) {
|
||||
cerr << "numDiscard=" << numDiscard << " newSize=" << newSize << endl;
|
||||
}
|
||||
m_collection.resize(newSize);
|
||||
}
|
||||
|
||||
|
@ -40,7 +40,7 @@
|
||||
#include "moses/FF/SetSourcePhrase.h"
|
||||
#include "CountNonTerms.h"
|
||||
#include "ReferenceComparison.h"
|
||||
#include "RuleAmbiguity.h"
|
||||
#include "RuleScope.h"
|
||||
#include "MaxSpanFreeNonTermSource.h"
|
||||
|
||||
#include "moses/FF/SkeletonStatelessFF.h"
|
||||
@ -185,7 +185,7 @@ FeatureRegistry::FeatureRegistry()
|
||||
MOSES_FNAME(SetSourcePhrase);
|
||||
MOSES_FNAME(CountNonTerms);
|
||||
MOSES_FNAME(ReferenceComparison);
|
||||
MOSES_FNAME(RuleAmbiguity);
|
||||
MOSES_FNAME(RuleScope);
|
||||
MOSES_FNAME(MaxSpanFreeNonTermSource);
|
||||
|
||||
MOSES_FNAME(SkeletonStatelessFF);
|
||||
|
@ -23,7 +23,7 @@ MaxSpanFreeNonTermSource::MaxSpanFreeNonTermSource(const std::string &line)
|
||||
ReadParameters();
|
||||
|
||||
FactorCollection &fc = FactorCollection::Instance();
|
||||
const Factor *factor = fc.AddFactor(Output, 0, m_glueTargetLHSStr);
|
||||
const Factor *factor = fc.AddFactor(m_glueTargetLHSStr, true);
|
||||
m_glueTargetLHS.SetFactor(0, factor);
|
||||
}
|
||||
|
||||
@ -43,7 +43,8 @@ void MaxSpanFreeNonTermSource::Evaluate(const InputType &input
|
||||
, ScoreComponentCollection *estimatedFutureScore) const
|
||||
{
|
||||
const Word &targetLHS = targetPhrase.GetTargetLHS();
|
||||
if (m_glueTargetLHS == m_glueTargetLHS) {
|
||||
|
||||
if (targetLHS == m_glueTargetLHS) {
|
||||
// don't delete glue rules
|
||||
return;
|
||||
}
|
||||
|
@ -6,7 +6,7 @@
|
||||
namespace Moses
|
||||
{
|
||||
|
||||
// similar to Scope, however, adjacent non-term count as 1 ammbiguity, rather than 2
|
||||
// -inf if left-most or right-most non-term is over a set span
|
||||
class MaxSpanFreeNonTermSource : public StatelessFeatureFunction
|
||||
{
|
||||
public:
|
||||
|
@ -1,10 +1,10 @@
|
||||
#include "RuleAmbiguity.h"
|
||||
#include "RuleScope.h"
|
||||
#include "moses/StaticData.h"
|
||||
#include "moses/Word.h"
|
||||
|
||||
namespace Moses
|
||||
{
|
||||
RuleAmbiguity::RuleAmbiguity(const std::string &line)
|
||||
RuleScope::RuleScope(const std::string &line)
|
||||
:StatelessFeatureFunction(1, line)
|
||||
,m_sourceSyntax(true)
|
||||
{
|
||||
@ -16,11 +16,12 @@ bool IsAmbiguous(const Word &word, bool sourceSyntax)
|
||||
return word.IsNonTerminal() && (!sourceSyntax || word == inputDefaultNonTerminal);
|
||||
}
|
||||
|
||||
void RuleAmbiguity::Evaluate(const Phrase &source
|
||||
void RuleScope::Evaluate(const Phrase &source
|
||||
, const TargetPhrase &targetPhrase
|
||||
, ScoreComponentCollection &scoreBreakdown
|
||||
, ScoreComponentCollection &estimatedFutureScore) const
|
||||
{
|
||||
// adjacent non-term count as 1 ammbiguity, rather than 2 as in rule scope
|
||||
// source can't be empty, right?
|
||||
float score = 0;
|
||||
|
||||
@ -48,7 +49,7 @@ void RuleAmbiguity::Evaluate(const Phrase &source
|
||||
scoreBreakdown.PlusEquals(this, score);
|
||||
}
|
||||
|
||||
void RuleAmbiguity::SetParameter(const std::string& key, const std::string& value)
|
||||
void RuleScope::SetParameter(const std::string& key, const std::string& value)
|
||||
{
|
||||
if (key == "source-syntax") {
|
||||
m_sourceSyntax = Scan<bool>(value);
|
@ -5,11 +5,11 @@
|
||||
namespace Moses
|
||||
{
|
||||
|
||||
// similar to Scope, however, adjacent non-term count as 1 ammbiguity, rather than 2
|
||||
class RuleAmbiguity : public StatelessFeatureFunction
|
||||
// Rule Scope - not quite completely implemented yet
|
||||
class RuleScope : public StatelessFeatureFunction
|
||||
{
|
||||
public:
|
||||
RuleAmbiguity(const std::string &line);
|
||||
RuleScope(const std::string &line);
|
||||
|
||||
virtual bool IsUseable(const FactorMask &mask) const
|
||||
{ return true; }
|
@ -140,6 +140,8 @@ public:
|
||||
}
|
||||
|
||||
size_t GetNumTerminals() const;
|
||||
size_t GetNumNonTerminals() const
|
||||
{ return GetSize() - GetNumTerminals(); }
|
||||
|
||||
//! whether the 2D vector is a substring of this phrase
|
||||
bool Contains(const std::vector< std::vector<std::string> > &subPhraseVector
|
||||
|
Loading…
Reference in New Issue
Block a user