#include <Rule.h>
Public Types | |
typedef std::set< std::pair < int, int > > | Alignments |
typedef std::vector< Property > | Properties |
Public Member Functions | |
Rule (const Rule ©) | |
Rule (const NonTerm &lhsNonTerm, const AlignedSentence &alignedSentence) | |
Rule (const Rule ©, const NonTerm &nonTerm) | |
virtual | ~Rule () |
bool | IsValid () const |
bool | CanRecurse () const |
const NonTerm & | GetLHS () const |
const ConsistentPhrase & | GetConsistentPhrase () const |
int | GetNextSourcePosForNonTerm () const |
void | SetCount (float count) |
float | GetCount () const |
const Alignments & | GetAlignments () const |
const Properties & | GetProperties () const |
std::string | Debug () const |
void | Output (std::ostream &out, bool forward) const |
void | Prevalidate (const Parameter ¶ms) |
void | CreateTarget (const Parameter ¶ms) |
void | CreateProperties (const Parameter ¶ms) |
const RulePhrase & | GetPhrase (Moses::FactorDirection direction) const |
Protected Member Functions | |
void | CreateSource () |
void | CreateAlignments () |
void | CreateAlignments (int sourcePos, const std::set< const Word * > &targetWords) |
void | CreateAlignments (int sourcePos, const RuleSymbol *targetSought) |
bool | ContainTerm (const ConsistentPhrase &cp, const std::set< const Word * > &terms) const |
int | GetScope (const Parameter ¶ms) const |
void | NonTermContext (int sourceTarget, int factors, size_t ntInd, const ConsistentPhrase &cp, std::ostream &out) const |
void | NonTermContextFactor (int factor, const Word &word, std::ostream &out) const |
Protected Attributes | |
const NonTerm & | m_lhs |
const AlignedSentence & | m_alignedSentence |
RulePhrase | m_source |
RulePhrase | m_target |
float | m_count |
Alignments | m_alignments |
std::vector< const NonTerm * > | m_nonterms |
bool | m_isValid |
bool | m_canRecurse |
Properties | m_properties |
Definition at line 20 of file Rule.h.
typedef std::set<std::pair<int,int> > Rule::Alignments |
typedef std::vector<Property> Rule::Properties |
Rule::Rule | ( | const Rule & | copy | ) |
Rule::Rule | ( | const NonTerm & | lhsNonTerm, | |
const AlignedSentence & | alignedSentence | |||
) |
Definition at line 18 of file Rule.cpp.
References CreateSource().
Definition at line 27 of file Rule.cpp.
References CreateSource(), and m_nonterms.
bool Rule::CanRecurse | ( | ) | const [inline] |
Definition at line 40 of file Rule.h.
References m_canRecurse.
Referenced by Rules::CreateRule(), and Rules::Extend().
bool Rule::ContainTerm | ( | const ConsistentPhrase & | cp, | |
const std::set< const Word * > & | terms | |||
) | const [protected] |
Definition at line 509 of file Rule.cpp.
References Contains(), ConsistentPhrase::corners, AlignedSentence::GetPhrase(), Moses::Input, and m_alignedSentence.
Referenced by Prevalidate().
void Rule::CreateAlignments | ( | int | sourcePos, | |
const RuleSymbol * | targetSought | |||
) | [protected] |
Definition at line 598 of file Rule.cpp.
References RulePhrase::GetSize(), m_alignments, and m_target.
void Rule::CreateAlignments | ( | int | sourcePos, | |
const std::set< const Word * > & | targetWords | |||
) | [protected] |
Definition at line 589 of file Rule.cpp.
References CreateAlignments().
void Rule::CreateAlignments | ( | ) | [protected] |
Definition at line 573 of file Rule.cpp.
References Word::GetAlignment(), RulePhrase::GetSize(), RuleSymbol::IsNonTerm(), and m_source.
Referenced by CreateAlignments(), and CreateTarget().
void Rule::CreateProperties | ( | const Parameter & | params | ) |
Definition at line 613 of file Rule.cpp.
References NonTerm::GetConsistentPhrase(), ConsistentPhrase::GetWidth(), Moses::Input, m_lhs, m_nonterms, m_properties, NonTermContext(), Parameter::nonTermContext, Parameter::nonTermContextFactor, Parameter::nonTermContextTarget, Moses::Output, Parameter::ruleLength, and Parameter::spanLength.
Referenced by Rules::CreateRule(), and Rules::Extend().
void Rule::CreateSource | ( | ) | [protected] |
Definition at line 49 of file Rule.cpp.
References RulePhrase::Add(), ConsistentPhrase::corners, NonTerm::GetConsistentPhrase(), AlignedSentence::GetPhrase(), Moses::Input, m_alignedSentence, m_lhs, m_nonterms, m_source, and NULL.
Referenced by Rule().
void Rule::CreateTarget | ( | const Parameter & | params | ) |
Definition at line 530 of file Rule.cpp.
References RulePhrase::Add(), CompareTargetNonTerms(), ConsistentPhrase::corners, CreateAlignments(), NonTerm::GetConsistentPhrase(), AlignedSentence::GetPhrase(), m_alignedSentence, m_isValid, m_lhs, m_nonterms, m_target, NULL, Moses::Output, and sort().
Referenced by Rules::CreateRule(), and Rules::Extend().
std::string Rule::Debug | ( | ) | const |
Definition at line 95 of file Rule.cpp.
References NonTerm::Debug(), RuleSymbol::Debug(), RulePhrase::GetSize(), m_alignments, m_lhs, m_source, and m_target.
Referenced by Rules::Debug().
const Alignments& Rule::GetAlignments | ( | ) | const [inline] |
Definition at line 59 of file Rule.h.
References m_alignments.
Referenced by CompareRules::operator()().
const ConsistentPhrase & Rule::GetConsistentPhrase | ( | ) | const |
Definition at line 44 of file Rule.cpp.
References NonTerm::GetConsistentPhrase(), and m_lhs.
Referenced by Rules::CalcFractionalCount(), and Rules::Extend().
float Rule::GetCount | ( | ) | const [inline] |
Definition at line 55 of file Rule.h.
References m_count.
Referenced by Rules::MergeRules().
const NonTerm& Rule::GetLHS | ( | ) | const [inline] |
Definition at line 44 of file Rule.h.
References m_lhs.
Referenced by CompareRules::operator()().
int Rule::GetNextSourcePosForNonTerm | ( | ) | const |
Definition at line 82 of file Rule.cpp.
References ConsistentPhrase::corners, NonTerm::GetConsistentPhrase(), m_lhs, and m_nonterms.
Referenced by Rules::Extend().
const RulePhrase& Rule::GetPhrase | ( | Moses::FactorDirection | direction | ) | const [inline] |
Definition at line 74 of file Rule.h.
References Moses::Input, m_source, and m_target.
Referenced by CompareRules::operator()().
const Properties& Rule::GetProperties | ( | ) | const [inline] |
Definition at line 63 of file Rule.h.
References m_properties.
Referenced by CompareRules::operator()().
int Rule::GetScope | ( | const Parameter & | params | ) | const [protected] |
Definition at line 448 of file Rule.cpp.
References RulePhrase::GetSize(), Moses::Input, NonTerm::IsHiero(), RuleSymbol::IsNonTerm(), and m_source.
Referenced by Prevalidate().
bool Rule::IsValid | ( | ) | const [inline] |
Definition at line 36 of file Rule.h.
References m_isValid.
Referenced by Rules::CreateRule(), and Rules::Extend().
void Rule::NonTermContext | ( | int | sourceTarget, | |
int | factors, | |||
size_t | ntInd, | |||
const ConsistentPhrase & | cp, | |||
std::ostream & | out | |||
) | const [protected] |
Definition at line 184 of file Rule.cpp.
References ConsistentPhrase::corners, AlignedSentence::GetPhrase(), Moses::Input, m_alignedSentence, NonTermContextFactor(), and Moses::Output.
Referenced by CreateProperties().
void Rule::NonTermContextFactor | ( | int | factor, | |
const Word & | word, | |||
std::ostream & | out | |||
) | const [protected] |
Definition at line 179 of file Rule.cpp.
References Word::GetString().
Referenced by NonTermContext().
void Rule::Output | ( | std::ostream & | out, | |
bool | forward | |||
) | const |
Definition at line 125 of file Rule.cpp.
References Moses::Input, m_alignments, m_count, m_lhs, m_properties, m_source, m_target, Moses::Output, NonTerm::Output(), and RulePhrase::Output().
Referenced by Rules::Output().
void Rule::Prevalidate | ( | const Parameter & | params | ) |
Definition at line 226 of file Rule.cpp.
References RulePhrase::Back(), ContainTerm(), ConsistentPhrase::corners, Word::GetAlignment(), NonTerm::GetConsistentPhrase(), GetScope(), RulePhrase::GetSize(), NonTerm::GetWidth(), ConsistentPhrase::GetWidth(), Moses::Input, NonTerm::IsHiero(), RuleSymbol::IsNonTerm(), m_canRecurse, m_isValid, m_lhs, m_nonterms, m_source, Parameter::maxHieroNonTerm, Parameter::maxNonTerm, Parameter::maxScope, Parameter::maxSpanFreeNonTermSource, Parameter::maxSymbolsSource, Parameter::minHoleSource, Parameter::minHoleSourceSyntax, Parameter::minScope, Parameter::mixedSyntaxType, Parameter::nieceTerminal, Parameter::nonTermConsecSource, Parameter::nonTermConsecSourceMixedSyntax, overlap(), Parameter::requireAlignedWord, Parameter::scopeSpan, ConsistentPhrase::TargetOverlap(), and UNDEFINED.
Referenced by Rules::CreateRule(), and Rules::Extend().
void Rule::SetCount | ( | float | count | ) | [inline] |
Definition at line 52 of file Rule.h.
References m_count.
Referenced by Rules::CalcFractionalCount(), Rules::Consolidate(), and Rules::MergeRules().
const AlignedSentence& Rule::m_alignedSentence [protected] |
Definition at line 80 of file Rule.h.
Referenced by ContainTerm(), CreateSource(), CreateTarget(), and NonTermContext().
Alignments Rule::m_alignments [protected] |
Definition at line 84 of file Rule.h.
Referenced by CreateAlignments(), Debug(), GetAlignments(), and Output().
bool Rule::m_canRecurse [protected] |
float Rule::m_count [protected] |
bool Rule::m_isValid [protected] |
const NonTerm& Rule::m_lhs [protected] |
Definition at line 79 of file Rule.h.
Referenced by CreateProperties(), CreateSource(), CreateTarget(), Debug(), GetConsistentPhrase(), GetLHS(), GetNextSourcePosForNonTerm(), Output(), and Prevalidate().
std::vector<const NonTerm*> Rule::m_nonterms [protected] |
Definition at line 87 of file Rule.h.
Referenced by CreateProperties(), CreateSource(), CreateTarget(), GetNextSourcePosForNonTerm(), Prevalidate(), and Rule().
Properties Rule::m_properties [protected] |
Definition at line 92 of file Rule.h.
Referenced by CreateProperties(), GetProperties(), and Output().
RulePhrase Rule::m_source [protected] |
Definition at line 81 of file Rule.h.
Referenced by CreateAlignments(), CreateSource(), Debug(), GetPhrase(), GetScope(), Output(), and Prevalidate().
RulePhrase Rule::m_target [protected] |
Definition at line 81 of file Rule.h.
Referenced by CreateAlignments(), CreateTarget(), Debug(), GetPhrase(), and Output().