mirror of
https://github.com/moses-smt/mosesdecoder.git
synced 2024-12-26 21:42:19 +03:00
delete LM:Useable(). Superseded by IsUseable() for all feature functions
This commit is contained in:
parent
65d2d68bc5
commit
bc0fdfbd79
@ -69,7 +69,6 @@ void LanguageModel::Evaluate(const Phrase &source
|
||||
, ScoreComponentCollection &scoreBreakdown
|
||||
, ScoreComponentCollection &estimatedFutureScore) const
|
||||
{
|
||||
if (Useable(targetPhrase)) {
|
||||
// contains factors used by this LM
|
||||
float fullScore, nGramScore;
|
||||
size_t oovCount;
|
||||
@ -90,8 +89,6 @@ void LanguageModel::Evaluate(const Phrase &source
|
||||
scoreBreakdown.Assign(this, nGramScore);
|
||||
estimatedFutureScore.Assign(this, estimateScore);
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
const LanguageModel &LanguageModel::GetFirstLM()
|
||||
|
@ -64,15 +64,9 @@ public:
|
||||
|
||||
virtual const FFState* EmptyHypothesisState(const InputType &input) const = 0;
|
||||
|
||||
/* whether this LM can be used on a particular phrase.
|
||||
* Should return false if phrase size = 0 or factor types required don't exists
|
||||
*/
|
||||
virtual bool Useable(const Phrase &phrase) const = 0;
|
||||
|
||||
/* calc total unweighted LM score of this phrase and return score via arguments.
|
||||
* Return scores should always be in natural log, regardless of representation with LM implementation.
|
||||
* Uses GetValue() of inherited class.
|
||||
* Useable() should be called beforehand on the phrase
|
||||
* \param fullScore scores of all unigram, bigram... of contiguous n-gram of the phrase
|
||||
* \param ngramScore score of only n-gram of order m_nGramOrder
|
||||
* \param oovCount number of LM OOVs
|
||||
|
@ -68,10 +68,6 @@ template <class Model> class LanguageModelKen : public LanguageModel
|
||||
public:
|
||||
LanguageModelKen(const std::string &description, const std::string &line, const std::string &file, FactorType factorType, bool lazy);
|
||||
|
||||
bool Useable(const Phrase &phrase) const {
|
||||
return (phrase.GetSize()>0 && phrase.GetFactor(0, m_factorType) != NULL);
|
||||
}
|
||||
|
||||
const FFState *EmptyHypothesisState(const InputType &/*input*/) const {
|
||||
KenLMState *ret = new KenLMState();
|
||||
ret->state = m_ngram->BeginSentenceState();
|
||||
|
@ -78,7 +78,6 @@ public:
|
||||
virtual void InitializeForInput(InputType const& source);
|
||||
virtual void CleanUpAfterSentenceProcessing(const InputType &source);
|
||||
virtual const FFState* EmptyHypothesisState(const InputType& input) const;
|
||||
virtual bool Useable(const Phrase& phrase) const;
|
||||
virtual void CalcScore(const Phrase& phrase,
|
||||
float& fullScore,
|
||||
float& ngramScore,
|
||||
@ -214,11 +213,6 @@ const FFState* LanguageModelLDHT::EmptyHypothesisState(
|
||||
return NULL;
|
||||
}
|
||||
|
||||
bool LanguageModelLDHT::Useable(const Phrase& phrase) const
|
||||
{
|
||||
return (phrase.GetSize() > 0 && phrase.GetFactor(0, m_factorType) != NULL);
|
||||
}
|
||||
|
||||
void LanguageModelLDHT::CalcScore(const Phrase& phrase,
|
||||
float& fullScore,
|
||||
float& ngramScore,
|
||||
|
@ -24,20 +24,6 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
|
||||
namespace Moses
|
||||
{
|
||||
bool LanguageModelMultiFactor::Useable(const Phrase &phrase) const
|
||||
{
|
||||
if (phrase.GetSize()==0)
|
||||
return false;
|
||||
|
||||
// whether phrase contains all factors in this LM
|
||||
const Word &word = phrase.GetWord(0);
|
||||
for (size_t currFactor = 0 ; currFactor < MAX_NUM_FACTORS ; ++currFactor) {
|
||||
if (m_factorTypes[currFactor] && word[currFactor] == NULL)
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
@ -50,7 +50,6 @@ public:
|
||||
, const std::vector<FactorType> &factorTypes
|
||||
, size_t nGramOrder) = 0;
|
||||
|
||||
bool Useable(const Phrase &phrase) const;
|
||||
};
|
||||
|
||||
}
|
||||
|
@ -53,10 +53,6 @@ public:
|
||||
|
||||
bool IsUseable(const FactorMask &mask) const;
|
||||
|
||||
bool Useable(const Phrase &phrase) const {
|
||||
return (phrase.GetSize()>0 && phrase.GetFactor(0, m_factorType) != NULL);
|
||||
}
|
||||
|
||||
const Factor *GetSentenceStart() const {
|
||||
return m_sentenceStart;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user