#include <Phrase.h>

Public Member Functions | |
| Phrase (size_t reserveSize) | |
| Phrase (const std::vector< const Word * > &mergeWords) | |
| virtual | ~Phrase () |
| void | CreateFromString (const std::vector< FactorType > &factorOrder, const StringPiece &phraseString, const StringPiece &factorDelimiter) |
| void | CreateFromStringNewFormat (FactorDirection direction, const std::vector< FactorType > &factorOrder, const std::string &phraseString, const std::string &factorDelimiter, Word &lhs) |
| void | MergeFactors (const Phrase ©) |
| void | MergeFactors (const Phrase ©, FactorType factorType) |
| copy a single factor (specified by factorType) | |
| void | MergeFactors (const Phrase ©, const std::vector< FactorType > &factorVec) |
| copy all factors specified in factorVec and none others | |
| bool | IsCompatible (const Phrase &inputPhrase) const |
| bool | IsCompatible (const Phrase &inputPhrase, FactorType factorType) const |
| bool | IsCompatible (const Phrase &inputPhrase, const std::vector< FactorType > &factorVec) const |
| size_t | GetSize () const |
| number of words | |
| const Word & | GetWord (size_t pos) const |
| word at a particular position | |
| Word & | GetWord (size_t pos) |
| const Factor * | GetFactor (size_t pos, FactorType factorType) const |
| particular factor at a particular position | |
| void | SetFactor (size_t pos, FactorType factorType, const Factor *factor) |
| size_t | GetNumTerminals () const |
| bool | Contains (const std::vector< std::vector< std::string > > &subPhraseVector, const std::vector< FactorType > &inputFactor) const |
| whether the 2D vector is a substring of this phrase | |
| Word & | AddWord () |
| create an empty word at the end of the phrase | |
| void | AddWord (const Word &newWord) |
| create copy of input word at the end of the phrase | |
| void | Append (const Phrase &endPhrase) |
| void | PrependWord (const Word &newWord) |
| void | Clear () |
| void | RemoveWord (size_t pos) |
| Phrase | GetSubString (const WordsRange &wordsRange) const |
| create new phrase class that is a substring of this phrase | |
| std::string | GetStringRep (const std::vector< FactorType > factorsToPrint) const |
| return a string rep of the phrase. Each factor is separated by the factor delimiter as specified in StaticData class | |
| TO_STRING () | |
| int | Compare (const Phrase &other) const |
| bool | operator< (const Phrase &compare) const |
| bool | operator== (const Phrase &compare) const |
Static Public Member Functions | |
| static void | InitializeMemPool () |
| static void | FinalizeMemPool () |
Friends | |
| std::ostream & | operator<< (std::ostream &, const Phrase &) |
Definition at line 40 of file Phrase.h.
| Moses::Phrase::Phrase | ( | size_t | reserveSize | ) |
create empty phrase
Definition at line 40 of file Phrase.cpp.
| Moses::Phrase::Phrase | ( | const std::vector< const Word * > & | mergeWords | ) |
create phrase from vectors of words
| Moses::Phrase::~Phrase | ( | ) | [virtual] |
destructor
Definition at line 53 of file Phrase.cpp.
| void Moses::Phrase::AddWord | ( | const Word & | newWord | ) | [inline] |
| Word & Moses::Phrase::AddWord | ( | ) |
create an empty word at the end of the phrase
Definition at line 112 of file Phrase.cpp.
Referenced by AddWord(), Append(), Moses::PDTAimp::CacheSource(), calcNgramExpectations(), CreateFromString(), CreateFromStringNewFormat(), Moses::ChartHypothesis::CreateOutputPhrase(), Moses::PDTAimp::CreateTargetPhrase(), extract_ngrams(), Moses::ChartTrellisNode::GetOutputPhrase(), Edge::GetPhraseSuffix(), GetSubString(), Moses::TrellisPath::GetSurfacePhrase(), PrependWord(), Moses::TranslationOptionCollection::ProcessOneUnknownWord(), and Moses::ChartTranslationOptionCollection::ProcessOneUnknownWord().

| void Moses::Phrase::Append | ( | const Phrase & | endPhrase | ) |
appends a phrase at the end of current phrase
Definition at line 118 of file Phrase.cpp.
References AddWord(), GetSize(), and GetWord().
Referenced by Moses::ChartTrellisNode::GetOutputPhrase(), and Moses::TrellisPath::GetTargetPhrase().


| int Moses::Phrase::Compare | ( | const Phrase & | other | ) | const |
Definition at line 208 of file Phrase.cpp.
References GetSize(), and GetWord().
Referenced by operator<(), and operator==().


| bool Moses::Phrase::Contains | ( | const std::vector< std::vector< std::string > > & | subPhraseVector, | |
| const std::vector< FactorType > & | inputFactor | |||
| ) | const |
whether the 2D vector is a substring of this phrase
| void Moses::Phrase::CreateFromString | ( | const std::vector< FactorType > & | factorOrder, | |
| const StringPiece & | phraseString, | |||
| const StringPiece & | factorDelimiter | |||
| ) |
Fills phrase with words from format string, typically from phrase table or sentence input
| factorOrder | factor types of each element in 2D string vector | |
| phraseString | formatted input string to parse | |
| factorDelimiter | delimiter between factors. |
Definition at line 139 of file Phrase.cpp.
References Moses::FactorCollection::AddFactor(), AddWord(), index, Moses::FactorCollection::Instance(), StringPiece::size(), and TRACE_ERR.
Referenced by Moses::BilingualDynSuffixArray::addSntPair(), Moses::StaticData::LoadData(), main(), Moses::ProcessAndStripXMLTags(), and Moses::TargetPhrase::TargetPhrase().


| void Moses::Phrase::CreateFromStringNewFormat | ( | FactorDirection | direction, | |
| const std::vector< FactorType > & | factorOrder, | |||
| const std::string & | phraseString, | |||
| const std::string & | factorDelimiter, | |||
| Word & | lhs | |||
| ) |
Definition at line 161 of file Phrase.cpp.
References AddWord(), CHECK, Moses::Word::CreateFromString(), Moses::Input, Moses::Word::IsNonTerminal(), and Moses::Tokenize().
Referenced by Moses::RuleTableLoaderStandard::Load().


| void Moses::Phrase::FinalizeMemPool | ( | ) | [static] |
Definition at line 329 of file Phrase.cpp.
Referenced by Moses::StaticData::~StaticData().

| const Factor* Moses::Phrase::GetFactor | ( | size_t | pos, | |
| FactorType | factorType | |||
| ) | const [inline] |
particular factor at a particular position
Definition at line 103 of file Phrase.h.
Referenced by Moses::Hypothesis::GetCurrFactor(), GetOutputFactors(), Moses::TrellisPath::GetSurfacePhrase(), IsCompatible(), main(), MergeFactors(), OutputSurface(), and Moses::LanguageModelSingleFactor::Useable().

| size_t Moses::Phrase::GetNumTerminals | ( | ) | const |
Definition at line 314 of file Phrase.cpp.
References GetSize(), GetWord(), and Moses::Word::IsNonTerminal().

| size_t Moses::Phrase::GetSize | ( | ) | const [inline] |
number of words
Reimplemented in Moses::Sentence.
Definition at line 91 of file Phrase.h.
Referenced by Moses::BilingualDynSuffixArray::addSntPair(), Append(), calcNgramExpectations(), Moses::TranslationOption::CalcScore(), Moses::LanguageModelImplementation::CalcScore(), Compare(), Moses::Hypothesis::Create(), Moses::ChartHypothesis::CreateOutputPhrase(), Moses::PhraseDictionaryMemory::CreateTargetPhraseCollection(), Moses::SyntacticLanguageModel::Evaluate(), Moses::WordPenaltyProducer::Evaluate(), Moses::LanguageModelImplementation::EvaluateChart(), GetNumTerminals(), Moses::PhraseDictionarySCFG::GetOrCreateNode(), GetOutputFactors(), Moses::ChartTrellisNode::GetOutputPhrase(), GetOutputWords(), Edge::GetPhraseSuffix(), Moses::LexicalReorderingTableTree::GetScore(), Moses::LexicalReorderingTableMemory::GetScore(), Moses::TrellisPath::GetSurfacePhrase(), Moses::PhraseDictionaryMemory::GetTargetPhraseCollection(), Moses::PDTAimp::GetTargetPhraseCollection(), Moses::BilingualDynSuffixArray::GetTargetPhrasesByLexicalWeight(), Edge::GetWordsSize(), IsCompatible(), Moses::TranslationOption::IsDeletionOption(), LatticeMBRSolution::LatticeMBRSolution(), main(), MergeFactors(), Moses::TranslationOption::MergeNewFeatures(), Moses::TargetPhrase::MergeNext(), Moses::operator<<(), OutputAlignment(), OutputBestHypo(), OutputSurface(), PrependWord(), Moses::Hypothesis::PrintHypothesis(), Moses::DecodeStepTranslation::Process(), Moses::DecodeStepGeneration::Process(), Moses::SearchNormal::SearchNormal(), Moses::ReorderingConstraint::SetMonotoneAtPunctuation(), Moses::LanguageModelSingleFactor::Useable(), and Moses::LanguageModelMultiFactor::Useable().

| std::string Moses::Phrase::GetStringRep | ( | const std::vector< FactorType > | factorsToPrint | ) | const |
return a string rep of the phrase. Each factor is separated by the factor delimiter as specified in StaticData class
Referenced by main(), and Moses::OutputSearchNode().

| Phrase Moses::Phrase::GetSubString | ( | const WordsRange & | wordsRange | ) | const |
create new phrase class that is a substring of this phrase
Reimplemented in Moses::Sentence.
Definition at line 90 of file Phrase.cpp.
References AddWord(), Moses::WordsRange::GetEndPos(), Moses::WordsRange::GetNumWordsCovered(), Moses::WordsRange::GetStartPos(), and GetWord().
Referenced by Moses::Hypothesis::Create(), Moses::LexicalReorderingTableMemory::GetScore(), and Moses::Hypothesis::PrintHypothesis().


| const Word& Moses::Phrase::GetWord | ( | size_t | pos | ) | const [inline] |
word at a particular position
Reimplemented in Moses::Sentence.
Definition at line 96 of file Phrase.h.
Referenced by Moses::BilingualDynSuffixArray::addSntPair(), Append(), calcNgramExpectations(), Moses::LanguageModelImplementation::CalcScore(), Compare(), Moses::ChartHypothesis::CreateOutputPhrase(), Moses::PhraseDictionaryMemory::CreateTargetPhraseCollection(), Moses::SyntacticLanguageModel::Evaluate(), Moses::LanguageModelImplementation::EvaluateChart(), Moses::Hypothesis::GetCurrWord(), GetNumTerminals(), Moses::PhraseDictionarySCFG::GetOrCreateNode(), Moses::UTrieNode::GetOrCreateTargetPhraseCollection(), Moses::ChartTrellisNode::GetOutputPhrase(), GetOutputWords(), Edge::GetPhraseSuffix(), GetSubString(), Moses::PhraseDictionaryMemory::GetTargetPhraseCollection(), Moses::PDTAimp::GetTargetPhraseCollection(), LatticeMBRSolution::LatticeMBRSolution(), Moses::TargetPhrase::MergeNext(), Moses::operator<<(), Moses::DecodeStepGeneration::Process(), Moses::ReorderingConstraint::SetMonotoneAtPunctuation(), and Moses::LanguageModelMultiFactor::Useable().

| void Moses::Phrase::InitializeMemPool | ( | ) | [static] |
No longer does anything as not using mem pool for Phrase class anymore
Definition at line 325 of file Phrase.cpp.
Referenced by Moses::StaticData::StaticData().

| bool Moses::Phrase::IsCompatible | ( | const Phrase & | inputPhrase, | |
| const std::vector< FactorType > & | factorVec | |||
| ) | const |
Definition at line 299 of file Phrase.cpp.
References GetFactor(), and GetSize().

| bool Moses::Phrase::IsCompatible | ( | const Phrase & | inputPhrase, | |
| FactorType | factorType | |||
| ) | const |
Definition at line 287 of file Phrase.cpp.
References GetFactor(), and GetSize().

| bool Moses::Phrase::IsCompatible | ( | const Phrase & | inputPhrase | ) | const |
compare 2 phrases to ensure no factors are lost if the phrases are merged must run IsCompatible() to ensure incompatible factors aren't being overwritten
Definition at line 265 of file Phrase.cpp.
References GetFactor(), GetSize(), Moses::MAX_NUM_FACTORS, and NULL.
Referenced by Moses::Hypothesis::Create(), Moses::TranslationOption::IsCompatible(), and Moses::TargetPhrase::MergeNext().


| void Moses::Phrase::MergeFactors | ( | const Phrase & | copy, | |
| const std::vector< FactorType > & | factorVec | |||
| ) |
copy all factors specified in factorVec and none others
Definition at line 79 of file Phrase.cpp.
References CHECK, GetFactor(), GetSize(), and SetFactor().

| void Moses::Phrase::MergeFactors | ( | const Phrase & | copy, | |
| FactorType | factorType | |||
| ) |
copy a single factor (specified by factorType)
Definition at line 72 of file Phrase.cpp.
References CHECK, GetFactor(), GetSize(), and SetFactor().

| void Moses::Phrase::MergeFactors | ( | const Phrase & | copy | ) |
copy factors from the other phrase to this phrase. IsCompatible() must be run beforehand to ensure incompatible factors aren't overwritten
Definition at line 57 of file Phrase.cpp.
References CHECK, GetFactor(), GetSize(), Moses::MAX_NUM_FACTORS, NULL, and SetFactor().
Referenced by Moses::TranslationOption::MergeNewFeatures().


| bool Moses::Phrase::operator< | ( | const Phrase & | compare | ) | const [inline] |
| bool Moses::Phrase::operator== | ( | const Phrase & | compare | ) | const [inline] |
| void Moses::Phrase::PrependWord | ( | const Word & | newWord | ) |
Definition at line 126 of file Phrase.cpp.
References AddWord(), and GetSize().

| void Moses::Phrase::RemoveWord | ( | size_t | pos | ) | [inline] |
| void Moses::Phrase::SetFactor | ( | size_t | pos, | |
| FactorType | factorType, | |||
| const Factor * | factor | |||
| ) | [inline] |
Definition at line 107 of file Phrase.h.
Referenced by MergeFactors().

| Moses::Phrase::TO_STRING | ( | ) |
Reimplemented in Moses::TargetPhrase.
| std::ostream& operator<< | ( | std::ostream & | , | |
| const Phrase & | ||||
| ) | [friend] |
1.5.9