diff options
author | Barry Haddow <barry.haddow@gmail.com> | 2011-11-21 14:49:26 +0400 |
---|---|---|
committer | Barry Haddow <barry.haddow@gmail.com> | 2011-11-21 14:49:26 +0400 |
commit | 3dc30fd51a77a7f4df1a213e182f7e69fd3b076a (patch) | |
tree | 2ba4619784f4aad43cec79fda4facc3215a421ac | |
parent | c757e394946cd6cd6da2e4b2e88b1cccaa4759ae (diff) |
Remove direction from Phrase
28 files changed, 53 insertions, 87 deletions
diff --git a/misc/queryLexicalTable.cpp b/misc/queryLexicalTable.cpp index ef6e741c1..166549267 100644 --- a/misc/queryLexicalTable.cpp +++ b/misc/queryLexicalTable.cpp @@ -86,7 +86,7 @@ int main(int argc, char** argv) if(use_context) { c_mask.push_back(0); } - Phrase e(Output, 0),f(Input, 0),c(Output, 0); + Phrase e( 0),f(0),c(0); e.CreateFromString(e_mask, query_e, "|"); f.CreateFromString(f_mask, query_f, "|"); c.CreateFromString(c_mask, query_c,"|"); diff --git a/moses-chart-cmd/src/IOWrapper.cpp b/moses-chart-cmd/src/IOWrapper.cpp index 667ebdc06..2d9ee1dcb 100644 --- a/moses-chart-cmd/src/IOWrapper.cpp +++ b/moses-chart-cmd/src/IOWrapper.cpp @@ -279,7 +279,7 @@ void IOWrapper::OutputBestHypo(const ChartHypothesis *hypo, long translationId, if (StaticData::Instance().IsPathRecoveryEnabled()) { out << "||| "; } - Phrase outPhrase(Output, ARRAY_SIZE_INCR); + Phrase outPhrase(ARRAY_SIZE_INCR); hypo->CreateOutputPhrase(outPhrase); // delete 1st & last diff --git a/moses-cmd/src/LatticeMBR.cpp b/moses-cmd/src/LatticeMBR.cpp index ef7a5f71a..c96d2794f 100644 --- a/moses-cmd/src/LatticeMBR.cpp +++ b/moses-cmd/src/LatticeMBR.cpp @@ -36,7 +36,7 @@ void extract_ngrams(const vector<Word >& sentence, map < Phrase, int > & allngr { for (int k = 0; k < (int)bleu_order; k++) { for(int i =0; i < max((int)sentence.size()-k,0); i++) { - Phrase ngram(Output, k+1); + Phrase ngram( k+1); for ( int j = i; j<= i+k; j++) { ngram.AddWord(sentence[j]); } @@ -403,7 +403,7 @@ const NgramHistory& Edge::GetNgrams(map<const Hypothesis*, vector<Edge> > & inco for (size_t start = 0; start < currPhrase.GetSize(); ++start) { for (size_t end = start; end < start + bleu_order; ++end) { if (end < currPhrase.GetSize()) { - Phrase edgeNgram(Output, end-start+1); + Phrase edgeNgram(end-start+1); for (size_t index = start; index <= end; ++index) { edgeNgram.AddWord(currPhrase.GetWord(index)); } @@ -434,8 +434,8 @@ const NgramHistory& Edge::GetNgrams(map<const Hypothesis*, vector<Edge> > & inco cerr << "edgeInNgram: " << edgeIncomingNgram << endl; } - Phrase edgeSuffix(Output, ARRAY_SIZE_INCR); - Phrase ngramSuffix(Output, ARRAY_SIZE_INCR); + Phrase edgeSuffix(ARRAY_SIZE_INCR); + Phrase ngramSuffix(ARRAY_SIZE_INCR); GetPhraseSuffix(edgeWords,back,edgeSuffix); GetPhraseSuffix(edgeIncomingNgram,back,ngramSuffix); diff --git a/moses/src/BilingualDynSuffixArray.cpp b/moses/src/BilingualDynSuffixArray.cpp index bcccd698b..4ae3ab932 100644 --- a/moses/src/BilingualDynSuffixArray.cpp +++ b/moses/src/BilingualDynSuffixArray.cpp @@ -46,9 +46,9 @@ bool BilingualDynSuffixArray::Load( InputFileStream sourceStrme(source); InputFileStream targetStrme(target); cerr << "Loading source corpus...\n"; - LoadCorpus(sourceStrme, m_inputFactors, Input, *m_srcCorpus, m_srcSntBreaks, m_srcVocab); + LoadCorpus(sourceStrme, m_inputFactors, *m_srcCorpus, m_srcSntBreaks, m_srcVocab); cerr << "Loading target corpus...\n"; - LoadCorpus(targetStrme, m_outputFactors, Output, *m_trgCorpus, m_trgSntBreaks, m_trgVocab); + LoadCorpus(targetStrme, m_outputFactors,*m_trgCorpus, m_trgSntBreaks, m_trgVocab); CHECK(m_srcSntBreaks.size() == m_trgSntBreaks.size()); // build suffix arrays and auxilliary arrays @@ -176,7 +176,7 @@ void BilingualDynSuffixArray::CleanUp() } int BilingualDynSuffixArray::LoadCorpus(InputFileStream& corpus, const FactorList& factors, - const FactorDirection& direction, std::vector<wordID_t>& cArray, std::vector<wordID_t>& sntArray, + std::vector<wordID_t>& cArray, std::vector<wordID_t>& sntArray, Vocab* vocab) { std::string line, word; @@ -185,7 +185,7 @@ int BilingualDynSuffixArray::LoadCorpus(InputFileStream& corpus, const FactorLis const std::string& factorDelimiter = StaticData::Instance().GetFactorDelimiter(); while(getline(corpus, line)) { sntArray.push_back(sntIdx); - Phrase phrase(direction, ARRAY_SIZE_INCR); + Phrase phrase(ARRAY_SIZE_INCR); // parse phrase phrase.CreateFromString( factors, line, factorDelimiter); // store words in vocabulary and corpus @@ -458,7 +458,7 @@ void BilingualDynSuffixArray::addSntPair(string& source, string& target, string& const std::string& factorDelimiter = StaticData::Instance().GetFactorDelimiter(); const unsigned oldSrcCrpSize = m_srcCorpus->size(), oldTrgCrpSize = m_trgCorpus->size(); cerr << "old source corpus size = " << oldSrcCrpSize << "\told target size = " << oldTrgCrpSize << endl; - Phrase sphrase(Input, ARRAY_SIZE_INCR); + Phrase sphrase(ARRAY_SIZE_INCR); sphrase.CreateFromString(m_inputFactors, source, factorDelimiter); m_srcVocab->MakeOpen(); wordID_t sIDs[sphrase.GetSize()]; @@ -473,7 +473,7 @@ void BilingualDynSuffixArray::addSntPair(string& source, string& target, string& } m_srcSntBreaks.push_back(oldSrcCrpSize); // former end of corpus is index of new sentence m_srcVocab->MakeClosed(); - Phrase tphrase(Output, ARRAY_SIZE_INCR); + Phrase tphrase(ARRAY_SIZE_INCR); tphrase.CreateFromString(m_outputFactors, target, factorDelimiter); m_trgVocab->MakeOpen(); wordID_t tIDs[tphrase.GetSize()]; diff --git a/moses/src/BilingualDynSuffixArray.h b/moses/src/BilingualDynSuffixArray.h index ddc9a609b..137978c14 100644 --- a/moses/src/BilingualDynSuffixArray.h +++ b/moses/src/BilingualDynSuffixArray.h @@ -109,7 +109,7 @@ private: const size_t m_maxPhraseLength, m_maxSampleSize; int LoadCorpus(InputFileStream&, const std::vector<FactorType>& factors, - const FactorDirection& direction, std::vector<wordID_t>&, std::vector<wordID_t>&, + std::vector<wordID_t>&, std::vector<wordID_t>&, Vocab*); int LoadAlignments(InputFileStream& aligs); int LoadRawAlignments(InputFileStream& aligs); diff --git a/moses/src/ChartHypothesis.cpp b/moses/src/ChartHypothesis.cpp index cd3448f43..9c618d73d 100644 --- a/moses/src/ChartHypothesis.cpp +++ b/moses/src/ChartHypothesis.cpp @@ -108,7 +108,7 @@ void ChartHypothesis::CreateOutputPhrase(Phrase &outPhrase) const /** Return full output phrase */ Phrase ChartHypothesis::GetOutputPhrase() const { - Phrase outPhrase(Output, ARRAY_SIZE_INCR); + Phrase outPhrase(ARRAY_SIZE_INCR); CreateOutputPhrase(outPhrase); return outPhrase; } diff --git a/moses/src/ChartTranslationOptionCollection.cpp b/moses/src/ChartTranslationOptionCollection.cpp index 1b87b7317..987616add 100644 --- a/moses/src/ChartTranslationOptionCollection.cpp +++ b/moses/src/ChartTranslationOptionCollection.cpp @@ -197,7 +197,7 @@ void ChartTranslationOptionCollection::ProcessOneUnknownWord(const Word &sourceW // modify the starting bitmap } - Phrase* m_unksrc = new Phrase(Input, 1); + Phrase* m_unksrc = new Phrase(1); m_unksrc->AddWord() = sourceWord; m_unksrcs.push_back(m_unksrc); diff --git a/moses/src/ChartTrellisNode.cpp b/moses/src/ChartTrellisNode.cpp index 67735e778..ce3c9eaf7 100644 --- a/moses/src/ChartTrellisNode.cpp +++ b/moses/src/ChartTrellisNode.cpp @@ -76,7 +76,7 @@ ChartTrellisNode::~ChartTrellisNode() Phrase ChartTrellisNode::GetOutputPhrase() const { // exactly like same fn in hypothesis, but use trellis nodes instead of prevHypos pointer - Phrase ret(Output, ARRAY_SIZE_INCR); + Phrase ret(ARRAY_SIZE_INCR); const ChartTranslationOption &transOpt = m_hypo.GetTranslationOption(); diff --git a/moses/src/DecodeStepGeneration.cpp b/moses/src/DecodeStepGeneration.cpp index 94427bff7..0f0c5c2dc 100644 --- a/moses/src/DecodeStepGeneration.cpp +++ b/moses/src/DecodeStepGeneration.cpp @@ -149,7 +149,7 @@ void DecodeStepGeneration::Process(const TranslationSystem* system } // merge with existing trans opt - Phrase genPhrase(Output, mergeWords); + Phrase genPhrase( mergeWords); TranslationOption *newTransOpt = MergeGeneration(inputPartialTranslOpt, genPhrase, generationScore); if (newTransOpt != NULL) { outputPartialTranslOptColl.Add(system, newTransOpt); diff --git a/moses/src/LM/Implementation.cpp b/moses/src/LM/Implementation.cpp index 7773e8482..f649eef06 100644 --- a/moses/src/LM/Implementation.cpp +++ b/moses/src/LM/Implementation.cpp @@ -310,8 +310,8 @@ private: public: LanguageModelChartState(const ChartHypothesis &hypo, int featureID, size_t order) :m_lmRightContext(NULL) - ,m_contextPrefix(Output, order - 1) - ,m_contextSuffix(Output, order - 1) + ,m_contextPrefix(order - 1) + ,m_contextSuffix( order - 1) ,m_hypo(hypo) { m_numTargetTerminals = hypo.GetCurrTargetPhrase().GetNumTerminals(); diff --git a/moses/src/LexicalReordering.cpp b/moses/src/LexicalReordering.cpp index 3053726b6..0cafa8198 100644 --- a/moses/src/LexicalReordering.cpp +++ b/moses/src/LexicalReordering.cpp @@ -69,7 +69,7 @@ LexicalReordering::~LexicalReordering() Scores LexicalReordering::GetProb(const Phrase& f, const Phrase& e) const { - return m_table->GetScore(f, e, Phrase(Output, ARRAY_SIZE_INCR)); + return m_table->GetScore(f, e, Phrase(ARRAY_SIZE_INCR)); } FFState* LexicalReordering::Evaluate(const Hypothesis& hypo, diff --git a/moses/src/LexicalReorderingTable.cpp b/moses/src/LexicalReorderingTable.cpp index 08c3c4c1b..00be0a495 100644 --- a/moses/src/LexicalReorderingTable.cpp +++ b/moses/src/LexicalReorderingTable.cpp @@ -571,8 +571,8 @@ void LexicalReorderingTableTree::auxCacheForSrcPhrase(const Phrase& f) if(m_FactorsE.empty()) { //f is all of key... Candidates cands; - m_Table->GetCandidates(MakeTableKey(f,Phrase(Output, ARRAY_SIZE_INCR)),&cands); - m_Cache[MakeCacheKey(f,Phrase(Output, ARRAY_SIZE_INCR))] = cands; + m_Table->GetCandidates(MakeTableKey(f,Phrase(ARRAY_SIZE_INCR)),&cands); + m_Cache[MakeCacheKey(f,Phrase(ARRAY_SIZE_INCR))] = cands; } else { ObjectPool<PPimp> pool; PPimp* pPos = m_Table->GetRoot(); diff --git a/moses/src/PDTAimp.h b/moses/src/PDTAimp.h index 172c4862c..7a1c40cae 100644 --- a/moses/src/PDTAimp.h +++ b/moses/src/PDTAimp.h @@ -236,11 +236,11 @@ public: std::vector<float> scores; Phrase src; - State() : range(0,0),scores(0),src(Input, ARRAY_SIZE_INCR) {} + State() : range(0,0),scores(0),src(ARRAY_SIZE_INCR) {} State(Position b,Position e,const PPtr& v,const std::vector<float>& sv=std::vector<float>(0)) - : ptr(v),range(b,e),scores(sv),src(Input, ARRAY_SIZE_INCR) {} + : ptr(v),range(b,e),scores(sv),src(ARRAY_SIZE_INCR) {} State(Range const& r,const PPtr& v,const std::vector<float>& sv=std::vector<float>(0)) - : ptr(v),range(r),scores(sv),src(Input, ARRAY_SIZE_INCR) {} + : ptr(v),range(r),scores(sv),src(ARRAY_SIZE_INCR) {} Position begin() const { return range.first; diff --git a/moses/src/Phrase.cpp b/moses/src/Phrase.cpp index db241bfe9..45ad41d95 100644 --- a/moses/src/Phrase.cpp +++ b/moses/src/Phrase.cpp @@ -36,31 +36,13 @@ using namespace std; namespace Moses { -Phrase::Phrase(const Phrase ©) - :m_direction(copy.m_direction) - ,m_words(copy.m_words) -{ -} - -Phrase& Phrase::operator=(const Phrase& x) -{ - if(this!=&x) { - - m_direction=x.m_direction; - m_words = x.m_words; - } - return *this; -} - -Phrase::Phrase(FactorDirection direction, size_t reserveSize) - : m_direction(direction) +Phrase::Phrase(size_t reserveSize) { m_words.reserve(reserveSize); } -Phrase::Phrase(FactorDirection direction, const vector< const Word* > &mergeWords) - :m_direction(direction) +Phrase::Phrase(const vector< const Word* > &mergeWords) { m_words.reserve(mergeWords.size()); for (size_t currPos = 0 ; currPos < mergeWords.size() ; currPos++) { @@ -76,7 +58,7 @@ void Phrase::MergeFactors(const Phrase ©) { CHECK(GetSize() == copy.GetSize()); size_t size = GetSize(); - const size_t maxNumFactors = StaticData::Instance().GetMaxNumFactors(this->GetDirection()); + const size_t maxNumFactors = MAX_NUM_FACTORS; for (size_t currPos = 0 ; currPos < size ; currPos++) { for (unsigned int currFactor = 0 ; currFactor < maxNumFactors ; currFactor++) { FactorType factorType = static_cast<FactorType>(currFactor); @@ -107,7 +89,7 @@ void Phrase::MergeFactors(const Phrase ©, const std::vector<FactorType>& fac Phrase Phrase::GetSubString(const WordsRange &wordsRange) const { - Phrase retPhrase(m_direction, wordsRange.GetNumWordsCovered()); + Phrase retPhrase(wordsRange.GetNumWordsCovered()); for (size_t currPos = wordsRange.GetStartPos() ; currPos <= wordsRange.GetEndPos() ; currPos++) { Word &word = retPhrase.AddWord(); @@ -288,7 +270,7 @@ bool Phrase::IsCompatible(const Phrase &inputPhrase) const const size_t size = GetSize(); - const size_t maxNumFactors = StaticData::Instance().GetMaxNumFactors(this->GetDirection()); + const size_t maxNumFactors = MAX_NUM_FACTORS; for (size_t currPos = 0 ; currPos < size ; currPos++) { for (unsigned int currFactor = 0 ; currFactor < maxNumFactors ; currFactor++) { FactorType factorType = static_cast<FactorType>(currFactor); diff --git a/moses/src/Phrase.h b/moses/src/Phrase.h index e8f864a97..95f3a83e6 100644 --- a/moses/src/Phrase.h +++ b/moses/src/Phrase.h @@ -42,10 +42,6 @@ class Phrase friend std::ostream& operator<<(std::ostream&, const Phrase&); private: - FactorDirection m_direction; /** Reusing Direction enum to really mean which language - Input = Source, Output = Target. - Not really used, but nice to know for debugging purposes - */ std::vector<Word> m_words; public: @@ -53,16 +49,11 @@ public: static void InitializeMemPool(); static void FinalizeMemPool(); - /** copy constructor */ - Phrase(const Phrase ©); - Phrase& operator=(const Phrase&); - /** create empty phrase - * \param direction = language (Input = Source, Output = Target) */ - Phrase(FactorDirection direction, size_t reserveSize); + Phrase(size_t reserveSize); /** create phrase from vectors of words */ - Phrase(FactorDirection direction, const std::vector< const Word* > &mergeWords); + Phrase(const std::vector< const Word* > &mergeWords); /** destructor */ virtual ~Phrase(); @@ -96,11 +87,6 @@ public: bool IsCompatible(const Phrase &inputPhrase, FactorType factorType) const; bool IsCompatible(const Phrase &inputPhrase, const std::vector<FactorType>& factorVec) const; - //! really means what language. Input = Source, Output = Target - inline FactorDirection GetDirection() const { - return m_direction; - } - //! number of words inline size_t GetSize() const { return m_words.size(); diff --git a/moses/src/PhraseDictionaryMemory.cpp b/moses/src/PhraseDictionaryMemory.cpp index 7eed64736..5e159efed 100644 --- a/moses/src/PhraseDictionaryMemory.cpp +++ b/moses/src/PhraseDictionaryMemory.cpp @@ -75,7 +75,7 @@ bool PhraseDictionaryMemory::Load(const std::vector<FactorType> &input size_t numElement = NOT_FOUND; // 3=old format, 5=async format which include word alignment info const std::string& factorDelimiter = staticData.GetFactorDelimiter(); - Phrase sourcePhrase(Input, 0); + Phrase sourcePhrase(0); std::vector<float> scv; scv.reserve(m_numScoreComponent); diff --git a/moses/src/RuleTableLoaderCompact.cpp b/moses/src/RuleTableLoaderCompact.cpp index 39d437b80..21d146bec 100644 --- a/moses/src/RuleTableLoaderCompact.cpp +++ b/moses/src/RuleTableLoaderCompact.cpp @@ -63,12 +63,12 @@ bool RuleTableLoaderCompact::Load(const std::vector<FactorType> &input, // Load source phrases. std::vector<Phrase> sourcePhrases; std::vector<size_t> sourceLhsIds; - LoadPhraseSection(reader, Input, vocab, sourcePhrases, sourceLhsIds); + LoadPhraseSection(reader, vocab, sourcePhrases, sourceLhsIds); // Load target phrases. std::vector<Phrase> targetPhrases; std::vector<size_t> targetLhsIds; - LoadPhraseSection(reader, Output, vocab, targetPhrases, targetLhsIds); + LoadPhraseSection(reader, vocab, targetPhrases, targetLhsIds); // Load alignments. std::vector<const AlignmentInfo *> alignmentSets; @@ -111,7 +111,6 @@ void RuleTableLoaderCompact::LoadVocabularySection( void RuleTableLoaderCompact::LoadPhraseSection( LineReader &reader, - FactorDirection direction, const std::vector<Word> &vocab, std::vector<Phrase> &rhsPhrases, std::vector<size_t> &lhsIds) @@ -121,7 +120,7 @@ void RuleTableLoaderCompact::LoadPhraseSection( const size_t phraseCount = std::atoi(reader.m_line.c_str()); // Reads lines, storing Phrase object for each RHS and vocab ID for each LHS. - rhsPhrases.resize(phraseCount, Phrase(direction, 0)); + rhsPhrases.resize(phraseCount, Phrase(0)); lhsIds.resize(phraseCount); std::vector<size_t> tokenPositions; for (size_t i = 0; i < phraseCount; ++i) { diff --git a/moses/src/RuleTableLoaderCompact.h b/moses/src/RuleTableLoaderCompact.h index 9f960683d..add082291 100644 --- a/moses/src/RuleTableLoaderCompact.h +++ b/moses/src/RuleTableLoaderCompact.h @@ -65,7 +65,6 @@ class RuleTableLoaderCompact : public RuleTableLoader std::vector<Word> &); void LoadPhraseSection(LineReader &, - FactorDirection, const std::vector<Word> &, std::vector<Phrase> &, std::vector<size_t> &); diff --git a/moses/src/RuleTableLoaderStandard.cpp b/moses/src/RuleTableLoaderStandard.cpp index a736ab4e2..190241a13 100644 --- a/moses/src/RuleTableLoaderStandard.cpp +++ b/moses/src/RuleTableLoaderStandard.cpp @@ -210,7 +210,7 @@ bool RuleTableLoaderStandard::Load(FormatType format Word sourceLHS, targetLHS; // source - Phrase sourcePhrase(Input, 0); + Phrase sourcePhrase( 0); sourcePhrase.CreateFromStringNewFormat(Input, input, sourcePhraseString, factorDelimiter, sourceLHS); // create target phrase obj diff --git a/moses/src/SearchCubePruning.cpp b/moses/src/SearchCubePruning.cpp index 452e9ff61..4f98208bb 100644 --- a/moses/src/SearchCubePruning.cpp +++ b/moses/src/SearchCubePruning.cpp @@ -41,7 +41,7 @@ SearchCubePruning::SearchCubePruning(Manager& manager, const InputType &source, :Search(manager) ,m_source(source) ,m_hypoStackColl(source.GetSize() + 1) - ,m_initialTargetPhrase(Output, source.m_initialTargetPhrase) + ,m_initialTargetPhrase(source.m_initialTargetPhrase) ,m_start(clock()) ,m_transOptColl(transOptColl) { diff --git a/moses/src/SearchNormal.cpp b/moses/src/SearchNormal.cpp index 334a73bcd..9f26270e9 100644 --- a/moses/src/SearchNormal.cpp +++ b/moses/src/SearchNormal.cpp @@ -16,7 +16,7 @@ SearchNormal::SearchNormal(Manager& manager, const InputType &source, const Tran :Search(manager) ,m_source(source) ,m_hypoStackColl(source.GetSize() + 1) - ,m_initialTargetPhrase(Output, source.m_initialTargetPhrase) + ,m_initialTargetPhrase(source.m_initialTargetPhrase) ,m_start(clock()) ,interrupted_flag(0) ,m_transOptColl(transOptColl) diff --git a/moses/src/Sentence.cpp b/moses/src/Sentence.cpp index 8f497f4ab..08a4f2b4c 100644 --- a/moses/src/Sentence.cpp +++ b/moses/src/Sentence.cpp @@ -34,7 +34,7 @@ namespace Moses { Sentence::Sentence(FactorDirection direction) - : Phrase(direction, 0) + : Phrase(0) , InputType() { CHECK(direction == Input); diff --git a/moses/src/StaticData.cpp b/moses/src/StaticData.cpp index d25a33003..fc920ef07 100644 --- a/moses/src/StaticData.cpp +++ b/moses/src/StaticData.cpp @@ -456,12 +456,12 @@ bool StaticData::LoadData(Parameter *parameter) if (vecStr.size() == 1) { sentenceID++; - Phrase phrase(Output, 0); + Phrase phrase(0); phrase.CreateFromString(GetOutputFactorOrder(), vecStr[0], GetFactorDelimiter()); m_constraints.insert(make_pair(sentenceID,phrase)); } else if (vecStr.size() == 2) { sentenceID = Scan<long>(vecStr[0]); - Phrase phrase(Output, 0); + Phrase phrase(0); phrase.CreateFromString(GetOutputFactorOrder(), vecStr[1], GetFactorDelimiter()); m_constraints.insert(make_pair(sentenceID,phrase)); } else { diff --git a/moses/src/TargetPhrase.cpp b/moses/src/TargetPhrase.cpp index 84afbc2db..e5eaac809 100644 --- a/moses/src/TargetPhrase.cpp +++ b/moses/src/TargetPhrase.cpp @@ -40,8 +40,8 @@ using namespace std; namespace Moses { -TargetPhrase::TargetPhrase(FactorDirection direction, std::string out_string) - :Phrase(direction, 0),m_transScore(0.0), m_fullScore(0.0), m_sourcePhrase(0) +TargetPhrase::TargetPhrase( std::string out_string) + :Phrase(0),m_transScore(0.0), m_fullScore(0.0), m_sourcePhrase(0) , m_alignmentInfo(&AlignmentInfoCollection::Instance().GetEmptyAlignmentInfo()) { @@ -51,8 +51,8 @@ TargetPhrase::TargetPhrase(FactorDirection direction, std::string out_string) } -TargetPhrase::TargetPhrase(FactorDirection direction) - :Phrase(direction, ARRAY_SIZE_INCR) +TargetPhrase::TargetPhrase() + :Phrase(ARRAY_SIZE_INCR) , m_transScore(0.0) , m_fullScore(0.0) , m_sourcePhrase(0) diff --git a/moses/src/TargetPhrase.h b/moses/src/TargetPhrase.h index 6d36304d9..c798d8ced 100644 --- a/moses/src/TargetPhrase.h +++ b/moses/src/TargetPhrase.h @@ -61,8 +61,8 @@ protected: Word m_lhsTarget; public: - TargetPhrase(FactorDirection direction=Output); - TargetPhrase(FactorDirection direction, std::string out_string); + TargetPhrase(); + TargetPhrase(std::string out_string); TargetPhrase(const Phrase &); ~TargetPhrase(); diff --git a/moses/src/TranslationOption.cpp b/moses/src/TranslationOption.cpp index 3fb4dc210..e41e3e1ae 100644 --- a/moses/src/TranslationOption.cpp +++ b/moses/src/TranslationOption.cpp @@ -84,7 +84,7 @@ TranslationOption::TranslationOption(const WordsRange &wordsRange TranslationOption::TranslationOption(const TranslationOption ©) : m_targetPhrase(copy.m_targetPhrase) //, m_sourcePhrase(new Phrase(*copy.m_sourcePhrase)) // TODO use when confusion network trans opt for confusion net properly implemented - , m_sourcePhrase( (copy.m_sourcePhrase == NULL) ? new Phrase(Input, ARRAY_SIZE_INCR) : new Phrase(*copy.m_sourcePhrase)) + , m_sourcePhrase( (copy.m_sourcePhrase == NULL) ? new Phrase(ARRAY_SIZE_INCR) : new Phrase(*copy.m_sourcePhrase)) , m_sourceWordsRange(copy.m_sourceWordsRange) , m_futureScore(copy.m_futureScore) , m_scoreBreakdown(copy.m_scoreBreakdown) @@ -94,7 +94,7 @@ TranslationOption::TranslationOption(const TranslationOption ©) TranslationOption::TranslationOption(const TranslationOption ©, const WordsRange &sourceWordsRange) : m_targetPhrase(copy.m_targetPhrase) //, m_sourcePhrase(new Phrase(*copy.m_sourcePhrase)) // TODO use when confusion network trans opt for confusion net properly implemented - , m_sourcePhrase( (copy.m_sourcePhrase == NULL) ? new Phrase(Input, ARRAY_SIZE_INCR) : new Phrase(*copy.m_sourcePhrase)) + , m_sourcePhrase( (copy.m_sourcePhrase == NULL) ? new Phrase(ARRAY_SIZE_INCR) : new Phrase(*copy.m_sourcePhrase)) , m_sourceWordsRange(sourceWordsRange) , m_futureScore(copy.m_futureScore) , m_scoreBreakdown(copy.m_scoreBreakdown) diff --git a/moses/src/TranslationOptionCollection.cpp b/moses/src/TranslationOptionCollection.cpp index debca5f43..ec1350db4 100644 --- a/moses/src/TranslationOptionCollection.cpp +++ b/moses/src/TranslationOptionCollection.cpp @@ -220,7 +220,7 @@ void TranslationOptionCollection::ProcessOneUnknownWord(const Word &sourceWord,s // modify the starting bitmap } - Phrase* m_unksrc = new Phrase(Input, 1); + Phrase* m_unksrc = new Phrase(1); m_unksrc->AddWord() = sourceWord; m_unksrcs.push_back(m_unksrc); diff --git a/moses/src/TrellisPath.cpp b/moses/src/TrellisPath.cpp index b62232609..c73575b2c 100644 --- a/moses/src/TrellisPath.cpp +++ b/moses/src/TrellisPath.cpp @@ -173,7 +173,7 @@ void TrellisPath::CreateDeviantPaths(TrellisPathList &pathColl) const Phrase TrellisPath::GetTargetPhrase() const { - Phrase targetPhrase(Output, ARRAY_SIZE_INCR); + Phrase targetPhrase(ARRAY_SIZE_INCR); int numHypo = (int) m_path.size(); for (int node = numHypo - 2 ; node >= 0 ; --node) { @@ -191,7 +191,7 @@ Phrase TrellisPath::GetSurfacePhrase() const { const std::vector<FactorType> &outputFactor = StaticData::Instance().GetOutputFactorOrder(); Phrase targetPhrase = GetTargetPhrase() - ,ret(Output, targetPhrase.GetSize()); + ,ret(targetPhrase.GetSize()); for (size_t pos = 0 ; pos < targetPhrase.GetSize() ; ++pos) { Word &newWord = ret.AddWord(); |