mirror of
https://github.com/moses-smt/mosesdecoder.git
synced 2024-09-17 14:17:13 +03:00
minor fixes
This commit is contained in:
parent
5b7096f005
commit
77e9e91b08
@ -118,7 +118,7 @@ float DynamicCacheBasedLanguageModel::Evaluate_Whole_String(const TargetPhrase&
|
||||
size_t endpos = tp.GetSize();
|
||||
for (size_t pos = 0 ; pos < endpos ; ++pos) {
|
||||
w += tp.GetWord(pos).GetFactor(0)->GetString().as_string();
|
||||
if ((pos == 0) && (endpos > 1)) {
|
||||
if (pos < endpos - 1) {
|
||||
w += " ";
|
||||
}
|
||||
}
|
||||
|
@ -53,10 +53,6 @@ PhraseDictionaryDynamicCacheBased::PhraseDictionaryDynamicCacheBased(const std::
|
||||
UTIL_THROW_IF2(s_instance_map.find(m_name) != s_instance_map.end(), "Only 1 PhraseDictionaryDynamicCacheBased feature named " + m_name + " is allowed");
|
||||
s_instance_map[m_name] = this;
|
||||
s_instance = this; //for back compatibility
|
||||
|
||||
SetFeaturesToApply();
|
||||
vector<float> weight = StaticData::Instance().GetWeights(this);
|
||||
SetPreComputedScores(weight.size());
|
||||
}
|
||||
|
||||
PhraseDictionaryDynamicCacheBased::~PhraseDictionaryDynamicCacheBased()
|
||||
@ -67,9 +63,11 @@ PhraseDictionaryDynamicCacheBased::~PhraseDictionaryDynamicCacheBased()
|
||||
void PhraseDictionaryDynamicCacheBased::Load()
|
||||
{
|
||||
VERBOSE(2,"PhraseDictionaryDynamicCacheBased::Load()" << std::endl);
|
||||
// SetFeaturesToApply();
|
||||
// vector<float> weight = StaticData::Instance().GetWeights(this);
|
||||
// SetPreComputedScores(weight.size());
|
||||
SetFeaturesToApply();
|
||||
|
||||
vector<float> weight = StaticData::Instance().GetWeights(this);
|
||||
SetPreComputedScores(weight.size());
|
||||
|
||||
Load(m_initfiles);
|
||||
}
|
||||
|
||||
@ -176,15 +174,21 @@ const TargetPhraseCollection *PhraseDictionaryDynamicCacheBased::GetTargetPhrase
|
||||
return tpc;
|
||||
}
|
||||
|
||||
const TargetPhraseCollection* PhraseDictionaryDynamicCacheBased::GetTargetPhraseCollectionLEGACY(Phrase const &src) const
|
||||
{
|
||||
const TargetPhraseCollection *ret = GetTargetPhraseCollection(src);
|
||||
return ret;
|
||||
}
|
||||
|
||||
const TargetPhraseCollection* PhraseDictionaryDynamicCacheBased::GetTargetPhraseCollectionNonCacheLEGACY(Phrase const &src) const
|
||||
{
|
||||
const TargetPhraseCollection *ret = GetTargetPhraseCollection(src);
|
||||
return ret;
|
||||
const TargetPhraseCollection *ret = GetTargetPhraseCollection(src);
|
||||
return ret;
|
||||
}
|
||||
|
||||
ChartRuleLookupManager* PhraseDictionaryDynamicCacheBased::CreateRuleLookupManager(const ChartParser &parser, const ChartCellCollectionBase &cellCollection, std::size_t /*maxChartSpan*/)
|
||||
{
|
||||
UTIL_THROW(util::Exception, "Phrase table used in chart decoder");
|
||||
UTIL_THROW(util::Exception, "Phrase table used in chart decoder");
|
||||
}
|
||||
|
||||
void PhraseDictionaryDynamicCacheBased::SetScoreType(size_t type)
|
||||
|
@ -107,6 +107,7 @@ public:
|
||||
void Load(const std::string files);
|
||||
|
||||
const TargetPhraseCollection* GetTargetPhraseCollection(const Phrase &src) const;
|
||||
const TargetPhraseCollection* GetTargetPhraseCollectionLEGACY(Phrase const &src) const;
|
||||
const TargetPhraseCollection* GetTargetPhraseCollectionNonCacheLEGACY(Phrase const &src) const;
|
||||
|
||||
// for phrase-based model
|
||||
|
Loading…
Reference in New Issue
Block a user