mirror of
https://github.com/moses-smt/mosesdecoder.git
synced 2024-12-29 15:04:05 +03:00
split classes in FeatureFunction files
This commit is contained in:
parent
a80d838b0f
commit
a615421882
2
moses/FF/ChartBasedFeatureContext.cpp
Normal file
2
moses/FF/ChartBasedFeatureContext.cpp
Normal file
@ -0,0 +1,2 @@
|
||||
#include "ChartBasedFeatureContext.h"
|
||||
|
34
moses/FF/ChartBasedFeatureContext.h
Normal file
34
moses/FF/ChartBasedFeatureContext.h
Normal file
@ -0,0 +1,34 @@
|
||||
#pragma once
|
||||
|
||||
namespace Moses
|
||||
{
|
||||
class ChartHypothesis;
|
||||
class InputType;
|
||||
class TargetPhrase;
|
||||
|
||||
/**
|
||||
* Same as PhraseBasedFeatureContext, but for chart-based Moses.
|
||||
**/
|
||||
class ChartBasedFeatureContext
|
||||
{
|
||||
//The context either has a hypothesis (during search) or a
|
||||
//TargetPhrase and source sentence (during pre-calculation)
|
||||
//TODO: should the context also include some info on where the TargetPhrase
|
||||
//is anchored (assuming it's lexicalised), which is available at pre-calc?
|
||||
const ChartHypothesis* m_hypothesis;
|
||||
const TargetPhrase& m_targetPhrase;
|
||||
const InputType& m_source;
|
||||
|
||||
public:
|
||||
ChartBasedFeatureContext(const ChartHypothesis* hypothesis);
|
||||
ChartBasedFeatureContext(const TargetPhrase& targetPhrase,
|
||||
const InputType& source);
|
||||
|
||||
const InputType& GetSource() const;
|
||||
const TargetPhrase& GetTargetPhrase() const;
|
||||
|
||||
};
|
||||
|
||||
} // namespace
|
||||
|
||||
|
@ -4,6 +4,8 @@
|
||||
#include <vector>
|
||||
#include <set>
|
||||
#include <string>
|
||||
#include "PhraseBasedFeatureContext.h"
|
||||
#include "ChartBasedFeatureContext.h"
|
||||
#include "moses/TypeDef.h"
|
||||
|
||||
namespace Moses
|
||||
@ -20,56 +22,6 @@ class WordsBitmap;
|
||||
class WordsRange;
|
||||
|
||||
|
||||
/**
|
||||
* Contains all that a feature function can access without affecting recombination.
|
||||
* For stateless features, this is all that it can access. Currently this is not
|
||||
* used for stateful features, as it would need to be retro-fitted to the LM feature.
|
||||
* TODO: Expose source segmentation,lattice path.
|
||||
* XXX Don't add anything to the context that would break recombination XXX
|
||||
**/
|
||||
class PhraseBasedFeatureContext
|
||||
{
|
||||
// The context either has a hypothesis (during search), or a TranslationOption and
|
||||
// source sentence (during pre-calculation).
|
||||
const Hypothesis* m_hypothesis;
|
||||
const TranslationOption& m_translationOption;
|
||||
const InputType& m_source;
|
||||
|
||||
public:
|
||||
PhraseBasedFeatureContext(const Hypothesis* hypothesis);
|
||||
PhraseBasedFeatureContext(const TranslationOption& translationOption,
|
||||
const InputType& source);
|
||||
|
||||
const TranslationOption& GetTranslationOption() const;
|
||||
const InputType& GetSource() const;
|
||||
const TargetPhrase& GetTargetPhrase() const; //convenience method
|
||||
const WordsBitmap& GetWordsBitmap() const;
|
||||
|
||||
};
|
||||
|
||||
/**
|
||||
* Same as PhraseBasedFeatureContext, but for chart-based Moses.
|
||||
**/
|
||||
class ChartBasedFeatureContext
|
||||
{
|
||||
//The context either has a hypothesis (during search) or a
|
||||
//TargetPhrase and source sentence (during pre-calculation)
|
||||
//TODO: should the context also include some info on where the TargetPhrase
|
||||
//is anchored (assuming it's lexicalised), which is available at pre-calc?
|
||||
const ChartHypothesis* m_hypothesis;
|
||||
const TargetPhrase& m_targetPhrase;
|
||||
const InputType& m_source;
|
||||
|
||||
public:
|
||||
ChartBasedFeatureContext(const ChartHypothesis* hypothesis);
|
||||
ChartBasedFeatureContext(const TargetPhrase& targetPhrase,
|
||||
const InputType& source);
|
||||
|
||||
const InputType& GetSource() const;
|
||||
const TargetPhrase& GetTargetPhrase() const;
|
||||
|
||||
};
|
||||
|
||||
|
||||
/** base class for all feature functions.
|
||||
* @todo is this for pb & hiero too?
|
||||
|
2
moses/FF/PhraseBasedFeatureContext.cpp
Normal file
2
moses/FF/PhraseBasedFeatureContext.cpp
Normal file
@ -0,0 +1,2 @@
|
||||
#include "PhraseBasedFeatureContext.h"
|
||||
|
40
moses/FF/PhraseBasedFeatureContext.h
Normal file
40
moses/FF/PhraseBasedFeatureContext.h
Normal file
@ -0,0 +1,40 @@
|
||||
#pragma once
|
||||
|
||||
namespace Moses
|
||||
{
|
||||
class Hypothesis;
|
||||
class TranslationOption;
|
||||
class InputType;
|
||||
class TargetPhrase;
|
||||
class WordsBitmap;
|
||||
|
||||
/**
|
||||
* Contains all that a feature function can access without affecting recombination.
|
||||
* For stateless features, this is all that it can access. Currently this is not
|
||||
* used for stateful features, as it would need to be retro-fitted to the LM feature.
|
||||
* TODO: Expose source segmentation,lattice path.
|
||||
* XXX Don't add anything to the context that would break recombination XXX
|
||||
**/
|
||||
class PhraseBasedFeatureContext
|
||||
{
|
||||
// The context either has a hypothesis (during search), or a TranslationOption and
|
||||
// source sentence (during pre-calculation).
|
||||
const Hypothesis* m_hypothesis;
|
||||
const TranslationOption& m_translationOption;
|
||||
const InputType& m_source;
|
||||
|
||||
public:
|
||||
PhraseBasedFeatureContext(const Hypothesis* hypothesis);
|
||||
PhraseBasedFeatureContext(const TranslationOption& translationOption,
|
||||
const InputType& source);
|
||||
|
||||
const TranslationOption& GetTranslationOption() const;
|
||||
const InputType& GetSource() const;
|
||||
const TargetPhrase& GetTargetPhrase() const; //convenience method
|
||||
const WordsBitmap& GetWordsBitmap() const;
|
||||
|
||||
};
|
||||
|
||||
} // namespace
|
||||
|
||||
|
2
moses/FF/StatelessFeatureFunction.cpp
Normal file
2
moses/FF/StatelessFeatureFunction.cpp
Normal file
@ -0,0 +1,2 @@
|
||||
#include "StatelessFeatureFunction.h"
|
||||
|
8
moses/FF/StatelessFeatureFunction.h
Normal file
8
moses/FF/StatelessFeatureFunction.h
Normal file
@ -0,0 +1,8 @@
|
||||
#pragma once
|
||||
|
||||
namespace Moses
|
||||
{
|
||||
|
||||
|
||||
} // namespace
|
||||
|
Loading…
Reference in New Issue
Block a user