class rename

This commit is contained in:
Hieu Hoang 2016-03-22 15:48:04 +00:00
parent 34aa1353f6
commit 619d7c8a6f
4 changed files with 16 additions and 16 deletions

View File

@ -7,7 +7,7 @@
#include <boost/foreach.hpp>
#include "LexicalReordering.h"
#include "PhraseLR.h"
#include "PhraseBasedReorderingState.h"
#include "../../TranslationModel/PhraseTable.h"
#include "../../System.h"
#include "../../PhraseImpl.h"
@ -113,7 +113,7 @@ void LexicalReordering::SetParameter(const std::string& key, const std::string&
FFState* LexicalReordering::BlankState(MemPool &pool) const
{
return new (pool.Allocate<LexicalReorderingState>()) LexicalReorderingState();
return new (pool.Allocate<PhraseBasedReorderingState>()) PhraseBasedReorderingState();
}
void LexicalReordering::EmptyHypothesisState(FFState &state,
@ -121,7 +121,7 @@ void LexicalReordering::EmptyHypothesisState(FFState &state,
const InputType &input,
const Hypothesis &hypo) const
{
LexicalReorderingState &stateCast = static_cast<LexicalReorderingState&>(state);
PhraseBasedReorderingState &stateCast = static_cast<PhraseBasedReorderingState&>(state);
stateCast.path = &hypo.GetInputPath();
stateCast.targetPhrase = &hypo.GetTargetPhrase();
}
@ -192,7 +192,7 @@ void LexicalReordering::EvaluateWhenApplied(const ManagerBase &mgr,
FFState &state) const
{
if (m_phraseBased) {
const LexicalReorderingState &prevStateCast = static_cast<const LexicalReorderingState&>(prevState);
const PhraseBasedReorderingState &prevStateCast = static_cast<const PhraseBasedReorderingState&>(prevState);
prevStateCast.Expand(mgr.system, *this, hypo, m_PhraseTableInd, scores, state);
}
else {
@ -207,8 +207,8 @@ void LexicalReordering::EvaluateWhenAppliedPB(const ManagerBase &mgr,
Scores &scores,
FFState &state) const
{
const LexicalReorderingState &prevStateCast = static_cast<const LexicalReorderingState&>(prevState);
LexicalReorderingState &stateCast = static_cast<LexicalReorderingState&>(state);
const PhraseBasedReorderingState &prevStateCast = static_cast<const PhraseBasedReorderingState&>(prevState);
PhraseBasedReorderingState &stateCast = static_cast<PhraseBasedReorderingState&>(state);
const Range &currRange = hypo.GetInputPath().range;
stateCast.path = &hypo.GetInputPath();

View File

@ -5,21 +5,21 @@
* Author: hieu
*/
#include "PhraseLR.h"
#include "PhraseBasedReorderingState.h"
#include "LexicalReordering.h"
#include "../../PhraseBased/Hypothesis.h"
namespace Moses2 {
void LexicalReorderingState::Expand(const System &system,
void PhraseBasedReorderingState::Expand(const System &system,
const LexicalReordering &ff,
const Hypothesis &hypo,
size_t phraseTableInd,
Scores &scores,
FFState &state) const
{
const LexicalReorderingState &prevStateCast = static_cast<const LexicalReorderingState&>(*this);
LexicalReorderingState &stateCast = static_cast<LexicalReorderingState&>(state);
const PhraseBasedReorderingState &prevStateCast = static_cast<const PhraseBasedReorderingState&>(*this);
PhraseBasedReorderingState &stateCast = static_cast<PhraseBasedReorderingState&>(state);
const Range &currRange = hypo.GetInputPath().range;
stateCast.path = &hypo.GetInputPath();
@ -55,12 +55,12 @@ void LexicalReorderingState::Expand(const System &system,
}
}
size_t LexicalReorderingState::GetOrientation(Range const& cur) const
size_t PhraseBasedReorderingState::GetOrientation(Range const& cur) const
{
return (cur.GetStartPos() == 0) ? 0 : 2;
}
size_t LexicalReorderingState::GetOrientation(Range const& prev, Range const& cur) const
size_t PhraseBasedReorderingState::GetOrientation(Range const& prev, Range const& cur) const
{
if (cur.GetStartPos() == prev.GetEndPos() + 1) {
// monotone

View File

@ -15,13 +15,13 @@ class TargetPhrase;
class LexicalReordering;
class Hypothesis;
class LexicalReorderingState : public FFState
class PhraseBasedReorderingState : public FFState
{
public:
const InputPathBase *path;
const TargetPhrase *targetPhrase;
LexicalReorderingState()
PhraseBasedReorderingState()
{
// uninitialised
}
@ -32,7 +32,7 @@ public:
}
virtual bool operator==(const FFState& other) const {
// compare range address. All ranges are created in InputPathBase
const LexicalReorderingState &stateCast = static_cast<const LexicalReorderingState&>(other);
const PhraseBasedReorderingState &stateCast = static_cast<const PhraseBasedReorderingState&>(other);
return &path->range == &stateCast.path->range;
}

View File

@ -32,7 +32,7 @@ alias deps : ../../..//z ../../..//boost_iostreams ../../..//boost_filesystem .
FF/WordPenalty.cpp
FF/LexicalReordering/LexicalReordering.cpp
FF/LexicalReordering/PhraseLR.cpp
FF/LexicalReordering/PhraseBasedReorderingState.cpp
# LM/LanguageModelDALM.cpp
LM/LanguageModel.cpp