#include <Sentence.h>
Public Member Functions | |
Sentence (AllOptions::ptr const &opts) | |
Sentence (AllOptions::ptr const &opts, size_t const transId, std::string stext) | |
~Sentence () | |
InputTypeEnum | GetType () const |
Phrase | GetSubString (const Range &r) const |
Calls Phrase::GetSubString(). Implements abstract InputType::GetSubString(). | |
const Word & | GetWord (size_t pos) const |
Calls Phrase::GetWord(). Implements abstract InputType::GetWord(). | |
size_t | GetSize () const |
Calls Phrase::GetSize(). Implements abstract InputType::GetSize(). | |
bool | XmlOverlap (size_t startPos, size_t endPos) const |
Returns true if there were any XML tags parsed that at least partially covered the range passed. | |
void | GetXmlTranslationOptions (std::vector< TranslationOption * > &list) const |
populates vector argument with XML force translation options for the specific range passed | |
void | GetXmlTranslationOptions (std::vector< TranslationOption * > &list, size_t startPos, size_t endPos) const |
std::vector < ChartTranslationOptions * > | GetXmlChartTranslationOptions () const |
virtual int | Read (std::istream &in) |
populate this InputType with data from in stream | |
void | Print (std::ostream &out) const |
Output debugging info to stream out. | |
TranslationOptionCollection * | CreateTranslationOptionCollection (ttasksptr const &ttask) const |
create trans options specific to this InputType | |
virtual void | CreateFromString (std::vector< FactorType > const &factorOrder, std::string const &phraseString) |
const NonTerminalSet & | GetLabelSet (size_t, size_t) const |
void | init (std::string line) |
std::vector< std::map < std::string, std::string > > const & | GetDltMeta () const |
Protected Member Functions | |
void | ProcessPlaceholders (const std::vector< std::pair< size_t, std::string > > &placeholders) |
Protected Attributes | |
std::vector< XmlOption const * > | m_xmlOptions |
std::vector< bool > | m_xmlCoverageMap |
NonTerminalSet | m_defaultLabelSet |
std::vector< std::map < std::string, std::string > > | m_dlt_meta |
Definition at line 47 of file Sentence.h.
Moses::Sentence::Sentence | ( | AllOptions::ptr const & | opts | ) |
Definition at line 44 of file Sentence.cpp.
References Moses::is_syntax(), and m_defaultLabelSet.
Moses::Sentence::Sentence | ( | AllOptions::ptr const & | opts, | |
size_t const | transId, | |||
std::string | stext | |||
) |
Moses::Sentence::~Sentence | ( | ) |
Definition at line 51 of file Sentence.cpp.
References m_xmlOptions, and Moses::RemoveAllInColl().
virtual void Moses::Sentence::CreateFromString | ( | std::vector< FactorType > const & | factorOrder, | |
std::string const & | phraseString | |||
) | [virtual] |
Reimplemented in Moses::TabbedSentence.
TranslationOptionCollection * Moses::Sentence::CreateTranslationOptionCollection | ( | ttasksptr const & | ttask | ) | const [virtual] |
create trans options specific to this InputType
Implements Moses::InputType.
Definition at line 260 of file Sentence.cpp.
std::vector<std::map<std::string,std::string> > const& Moses::Sentence::GetDltMeta | ( | ) | const [inline] |
Definition at line 121 of file Sentence.h.
References m_dlt_meta.
Referenced by Moses::TranslationTask::interpret_dlt().
const NonTerminalSet& Moses::Sentence::GetLabelSet | ( | size_t | , | |
size_t | ||||
) | const [inline, virtual] |
Implements Moses::InputType.
Reimplemented in Moses::TreeInput.
Definition at line 113 of file Sentence.h.
References m_defaultLabelSet.
Referenced by Moses::TranslationOptionCollectionText::TranslationOptionCollectionText().
size_t Moses::Sentence::GetSize | ( | ) | const [inline, virtual] |
Calls Phrase::GetSize(). Implements abstract InputType::GetSize().
Implements Moses::InputType.
Definition at line 87 of file Sentence.h.
Referenced by Moses::ConfusionNet::ConfusionNet(), Moses::GlobalLexicalModelUnlimited::EvaluateWhenApplied(), Moses::DistortionScoreProducer::EvaluateWhenApplied(), Moses::ConstrainedDecoding::EvaluateWhenApplied(), Moses::PhrasePairFeature::EvaluateWithSourceContext(), Moses::Model1Feature::EvaluateWithSourceContext(), Moses::GetContext(), Moses::operator<<(), Moses::TreeInput::Read(), and Moses::TranslationOptionCollectionText::TranslationOptionCollectionText().
Calls Phrase::GetSubString(). Implements abstract InputType::GetSubString().
Implements Moses::InputType.
Definition at line 77 of file Sentence.h.
Referenced by Moses::TranslationOptionCollectionText::TranslationOptionCollectionText().
InputTypeEnum Moses::Sentence::GetType | ( | ) | const [inline, virtual] |
Implements Moses::InputType.
Reimplemented in Moses::ForestInput, Moses::TabbedSentence, and Moses::TreeInput.
Definition at line 72 of file Sentence.h.
References Moses::SentenceInput.
const Word& Moses::Sentence::GetWord | ( | size_t | pos | ) | const [inline, virtual] |
Calls Phrase::GetWord(). Implements abstract InputType::GetWord().
Implements Moses::InputType.
Definition at line 82 of file Sentence.h.
Referenced by Moses::ConfusionNet::ConfusionNet(), Moses::SparseReordering::CopyScores(), Moses::SparseHieroReorderingFeature::EvaluateWhenApplied(), Moses::GlobalLexicalModelUnlimited::EvaluateWhenApplied(), Moses::DistortionScoreProducer::EvaluateWhenApplied(), Moses::PhrasePairFeature::EvaluateWithSourceContext(), Moses::Model1Feature::EvaluateWithSourceContext(), Moses::GetContext(), ProcessPlaceholders(), Moses::PhraseOrientationFeature::SparseWordL2RScore(), and Moses::PhraseOrientationFeature::SparseWordR2LScore().
std::vector< ChartTranslationOptions * > Moses::Sentence::GetXmlChartTranslationOptions | ( | ) | const [virtual] |
Reimplemented from Moses::InputType.
Definition at line 316 of file Sentence.cpp.
References Moses::TargetPhraseCollection::Add(), Moses::InputType::m_options, m_xmlOptions, Moses::XmlOption::range, range, Moses::XmlOption::targetPhrase, and Moses::XmlPassThrough.
void Moses::Sentence::GetXmlTranslationOptions | ( | std::vector< TranslationOption * > & | list, | |
size_t | startPos, | |||
size_t | endPos | |||
) | const |
Definition at line 295 of file Sentence.cpp.
References Moses::Range::GetEndPos(), Moses::Range::GetStartPos(), m_xmlOptions, Moses::XmlOption::range, range, and Moses::XmlOption::targetPhrase.
void Moses::Sentence::GetXmlTranslationOptions | ( | std::vector< TranslationOption * > & | list | ) | const |
populates vector argument with XML force translation options for the specific range passed
Definition at line 283 of file Sentence.cpp.
References m_xmlOptions, Moses::XmlOption::range, range, and Moses::XmlOption::targetPhrase.
Referenced by Moses::TranslationOptionCollectionText::CreateXmlOptionsForRange(), and Moses::TranslationOptionCollectionText::ViolatesXmlOptionsConstraint().
void Moses::Sentence::init | ( | std::string | line | ) |
Referenced by Moses::TabbedSentence::Read(), and Read().
void Moses::Sentence::Print | ( | std::ostream & | ) | const [virtual] |
Output debugging info to stream out.
Implements Moses::InputType.
Reimplemented in Moses::ForestInput, and Moses::TreeInput.
Definition at line 267 of file Sentence.cpp.
void Moses::Sentence::ProcessPlaceholders | ( | const std::vector< std::pair< size_t, std::string > > & | placeholders | ) | [protected] |
Definition at line 242 of file Sentence.cpp.
References Moses::FactorCollection::AddFactor(), GetWord(), Moses::FactorCollection::Instance(), Moses::InputType::m_options, NOT_FOUND, and str.
int Moses::Sentence::Read | ( | std::istream & | in | ) | [virtual] |
populate this InputType with data from in stream
Implements Moses::InputType.
Reimplemented in Moses::ForestInput, Moses::TabbedSentence, and Moses::TreeInput.
Definition at line 231 of file Sentence.cpp.
References init().
Referenced by translate().
bool Moses::Sentence::XmlOverlap | ( | size_t | startPos, | |
size_t | endPos | |||
) | const |
Returns true if there were any XML tags parsed that at least partially covered the range passed.
Definition at line 273 of file Sentence.cpp.
References m_xmlCoverageMap.
Referenced by Moses::TranslationOptionCollectionText::HasXmlOptionsOverlappingRange(), and Moses::TranslationOptionCollectionText::ViolatesXmlOptionsConstraint().
NonTerminalSet Moses::Sentence::m_defaultLabelSet [protected] |
std::vector<std::map<std::string,std::string> > Moses::Sentence::m_dlt_meta [protected] |
std::vector<bool> Moses::Sentence::m_xmlCoverageMap [protected] |
std::vector<XmlOption const*> Moses::Sentence::m_xmlOptions [protected] |
Utility method that takes in a string representing an XML tag and the name of the attribute, and returns the value of that tag if present, empty string otherwise
Definition at line 55 of file Sentence.h.
Referenced by GetXmlChartTranslationOptions(), GetXmlTranslationOptions(), Moses::TreeInput::Read(), and ~Sentence().