2013-05-24 21:34:47 +04:00
|
|
|
#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
|
|
|
|
{
|
2013-05-29 21:16:15 +04:00
|
|
|
// The context either has a hypothesis (during search), or a TranslationOption and
|
2013-05-24 21:34:47 +04:00
|
|
|
// 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);
|
|
|
|
|
2013-05-29 21:16:15 +04:00
|
|
|
const TranslationOption& GetTranslationOption() const {
|
|
|
|
return m_translationOption;
|
|
|
|
}
|
|
|
|
const InputType& GetSource() const {
|
|
|
|
return m_source;
|
|
|
|
}
|
2013-05-24 21:34:47 +04:00
|
|
|
const TargetPhrase& GetTargetPhrase() const; //convenience method
|
|
|
|
const WordsBitmap& GetWordsBitmap() const;
|
|
|
|
|
|
|
|
};
|
|
|
|
|
|
|
|
} // namespace
|
|
|
|
|
|
|
|
|