mirror of
https://github.com/moses-smt/mosesdecoder.git
synced 2025-01-05 02:22:21 +03:00
lexicalised reordering
This commit is contained in:
parent
4f0dff6a6e
commit
5fdf9d8046
@ -114,9 +114,9 @@ void LexicalReordering::EvaluateWhenApplied(const Manager &mgr,
|
||||
const Hypothesis &hypo,
|
||||
const FFState &prevState,
|
||||
Scores &scores,
|
||||
FFState &state) const
|
||||
FFState &state) const
|
||||
{
|
||||
|
||||
//const Phrase &source = hypo.ge
|
||||
}
|
||||
|
||||
const LexicalReordering::Values *LexicalReordering::GetValues(const Phrase &source, const Phrase &target) const
|
||||
@ -132,4 +132,25 @@ const LexicalReordering::Values *LexicalReordering::GetValues(const Phrase &sour
|
||||
}
|
||||
}
|
||||
|
||||
size_t LexicalReordering::GetOrientation(Range const& cur) const
|
||||
{
|
||||
return (cur.GetStartPos() == 0) ? 0 : 1;
|
||||
}
|
||||
|
||||
size_t LexicalReordering::GetOrientation(Range const& prev, Range const& cur) const
|
||||
{
|
||||
if (cur.GetStartPos() == prev.GetEndPos() + 1) {
|
||||
// monotone
|
||||
return 0;
|
||||
}
|
||||
else if (prev.GetStartPos() == cur.GetEndPos() + 1) {
|
||||
// swap
|
||||
return 1;
|
||||
}
|
||||
else {
|
||||
// discontinuous
|
||||
return 2;
|
||||
}
|
||||
}
|
||||
|
||||
} /* namespace Moses2 */
|
||||
|
@ -11,6 +11,7 @@
|
||||
#include "StatefulFeatureFunction.h"
|
||||
#include "../TypeDef.h"
|
||||
#include "../Phrase.h"
|
||||
#include "../legacy/Range.h"
|
||||
|
||||
namespace Moses2 {
|
||||
|
||||
@ -78,6 +79,10 @@ protected:
|
||||
Coll m_coll;
|
||||
|
||||
const Values *GetValues(const Phrase &source, const Phrase &target) const;
|
||||
|
||||
size_t GetOrientation(Range const& cur) const;
|
||||
size_t GetOrientation(Range const& prev, Range const& cur) const;
|
||||
|
||||
};
|
||||
|
||||
} /* namespace Moses2 */
|
||||
|
Loading…
Reference in New Issue
Block a user