diff options
author | eherbst <eherbst@1f5c12ca-751b-0410-a591-d2e778427230> | 2006-07-20 02:05:52 +0400 |
---|---|---|
committer | eherbst <eherbst@1f5c12ca-751b-0410-a591-d2e778427230> | 2006-07-20 02:05:52 +0400 |
commit | 7a6600617e6b75993ec6015f39fe6af441a6a7a2 (patch) | |
tree | e4593f17925f9c95fd29987362c793aa2e89fc9d /moses | |
parent | caf6cfe912b9cae1effa6afc5e73b75ebd4222ab (diff) |
minor cleaning-up
git-svn-id: https://mosesdecoder.svn.sourceforge.net/svnroot/mosesdecoder/trunk@196 1f5c12ca-751b-0410-a591-d2e778427230
Diffstat (limited to 'moses')
-rw-r--r-- | moses/src/Makefile.am | 11 | ||||
-rwxr-xr-x | moses/src/Manager.cpp | 2 | ||||
-rwxr-xr-x | moses/src/Parameter.cpp | 1 | ||||
-rwxr-xr-x | moses/src/Phrase.cpp | 2 | ||||
-rwxr-xr-x | moses/src/PhraseDictionary.cpp | 7 | ||||
-rwxr-xr-x | moses/src/StaticData.cpp | 21 | ||||
-rwxr-xr-x | moses/src/StaticData.h | 2 | ||||
-rw-r--r-- | moses/src/WordDeletionTable.h | 55 |
8 files changed, 17 insertions, 84 deletions
diff --git a/moses/src/Makefile.am b/moses/src/Makefile.am index c8a319b54..a4710f6f1 100644 --- a/moses/src/Makefile.am +++ b/moses/src/Makefile.am @@ -30,11 +30,12 @@ libmoses_a_SOURCES = \ TranslationOptionCollection.cpp \ TranslationOptionCollectionText.cpp \ TranslationOptionCollectionConfusionNet.cpp \ - UserMessage.cpp \ - Util.cpp \ - WeightOptimization.cpp \ - Word.cpp \ - WordsBitmap.cpp \ + UnknownWordHandler.cpp \ + UserMessage.cpp \ + Util.cpp \ + WeightOptimization.cpp \ + Word.cpp \ + WordsBitmap.cpp \ WordsRange.cpp if INTERNAL_LM diff --git a/moses/src/Manager.cpp b/moses/src/Manager.cpp index 11a403bc0..c516fab81 100755 --- a/moses/src/Manager.cpp +++ b/moses/src/Manager.cpp @@ -351,8 +351,6 @@ void Manager::ProcessTranslation(const Hypothesis &hypothesis, const DecodeStep } outputHypoColl.AddNoPrune( newHypo ); } - - } #if 0 diff --git a/moses/src/Parameter.cpp b/moses/src/Parameter.cpp index f12ed72cc..133b1fb52 100755 --- a/moses/src/Parameter.cpp +++ b/moses/src/Parameter.cpp @@ -41,7 +41,6 @@ PARAM_VEC &Parameter::AddParam(const string ¶mName) Parameter::Parameter() { AddParam("ttable-file"); - AddParam("dtable-file"); AddParam("lmodel-file"); AddParam("ttable-limit"); AddParam("weight-d"); diff --git a/moses/src/Phrase.cpp b/moses/src/Phrase.cpp index fc17ccf09..4b8185b48 100755 --- a/moses/src/Phrase.cpp +++ b/moses/src/Phrase.cpp @@ -134,7 +134,7 @@ void Phrase::CreateFromString(const std::vector<FactorType> &factorOrder CreateFromString(factorOrder, phraseVector, factorCollection); } -bool Phrase::operator< (const Phrase &compare) const +bool Phrase::operator < (const Phrase &compare) const { #ifdef min #undef min diff --git a/moses/src/PhraseDictionary.cpp b/moses/src/PhraseDictionary.cpp index 8dfb88702..2280b803b 100755 --- a/moses/src/PhraseDictionary.cpp +++ b/moses/src/PhraseDictionary.cpp @@ -96,10 +96,7 @@ void PhraseDictionary::Load(const std::vector<FactorType> &input phraseVector = Phrase::Parse(tokens[0]); prevSourcePhrase = tokens[0]; - if (Contains(phraseVector, inputPhraseList, input)) - addPhrase = true; - else - addPhrase = false; + addPhrase = Contains(phraseVector, inputPhraseList, input); } if (addPhrase) @@ -109,7 +106,7 @@ void PhraseDictionary::Load(const std::vector<FactorType> &input TRACE_ERR("Size of scoreVector != number (" <<scoreVector.size() << "!=" <<m_noScoreComponent<<") of score components on line " << line_num); abort(); } - assert(scoreVector.size() == m_noScoreComponent); +// assert(scoreVector.size() == m_noScoreComponent); // source Phrase sourcePhrase(Input); diff --git a/moses/src/StaticData.cpp b/moses/src/StaticData.cpp index c7ea32a28..29e379fb0 100755 --- a/moses/src/StaticData.cpp +++ b/moses/src/StaticData.cpp @@ -96,11 +96,16 @@ bool StaticData::LoadParameters(int argc, char* argv[]) } //source word deletion - if(m_parameter.GetParam("word-deletion").size() > 0) + if(m_parameter.GetParam("weight-e").size() > 0) { + m_wordDeletionWeight = Scan<float>(m_parameter.GetParam("weight-e")[0]); m_wordDeletionEnabled = true; if (GetVerboseLevel() > 0) { std::cerr << "Word deletion enabled." << std::endl; } - } else { m_wordDeletionEnabled = false; } + } + else + { + m_wordDeletionEnabled = false; + } // load Lexical Reordering model // check to see if the lexical reordering parameter exists @@ -217,18 +222,6 @@ bool StaticData::LoadParameters(int argc, char* argv[]) lm->Load(i, languageModelFile, m_factorCollection, factorType, weightAll[i], nGramOrder); timer.check(("Finished loading LanguageModel " + languageModelFile).c_str()); m_languageModel[type].push_back(lm); - - /* - const Factor *f0 = m_factorCollection.AddFactor(Target, Surface, "it") - ,*f1 = m_factorCollection.AddFactor(Target, Surface, "market") - ,*f2 = m_factorCollection.AddFactor(Target, Surface, "economy"); - vector<const Factor*> contextFactor(3); - contextFactor[0] = f0; - contextFactor[1] = f1; - contextFactor[2] = f2; - float v = UntransformSRIScore(lm->GetValue(contextFactor)); - TRACE_ERR(v << endl); - */ } CompareHypothesisCollection::SetMaxNGramOrder(nGramMaxOrder); } diff --git a/moses/src/StaticData.h b/moses/src/StaticData.h index dafc1a9ea..11debcd22 100755 --- a/moses/src/StaticData.h +++ b/moses/src/StaticData.h @@ -50,7 +50,7 @@ protected: // Initial = 0 = can be used when creating poss trans // Other = 1 = used to calculate LM score once all steps have been processed float m_beamThreshold - ,m_weightDistortion, m_weightWordPenalty; + ,m_weightDistortion, m_weightWordPenalty, m_wordDeletionWeight; // PhraseTrans, Generation & LanguageModelScore has multiple weights. int m_maxDistortion; // do it differently from old pharaoh diff --git a/moses/src/WordDeletionTable.h b/moses/src/WordDeletionTable.h deleted file mode 100644 index 8fedf913c..000000000 --- a/moses/src/WordDeletionTable.h +++ /dev/null @@ -1,55 +0,0 @@ -/*********************************************************************** -Moses - factored phrase-based language decoder -Copyright (C) 2006 University of Edinburgh - -This library is free software; you can redistribute it and/or -modify it under the terms of the GNU Lesser General Public -License as published by the Free Software Foundation; either -version 2.1 of the License, or (at your option) any later version. - -This library is distributed in the hope that it will be useful, -but WITHOUT ANY WARRANTY; without even the implied warranty of -MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -Lesser General Public License for more details. - -You should have received a copy of the GNU Lesser General Public -License along with this library; if not, write to the Free Software -Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA -***********************************************************************/ - -#pragma once - -#include <map> -#include <string> -#include <stdexcept> -#include "Phrase.h" - -class StaticData; - -class WordDeletionTable -{ - typedef float COST_TYPE; - - protected: - - std::map<Phrase, COST_TYPE> m_deletionCosts; //map each source-language phrase to the cost of deleting it - - public: - - /*** - * should only be called once for a given instance - */ - void Load(const std::string& filename, StaticData& staticData); - - /*** - * \throw invalid_argument if the given phrase isn't in our table - */ - COST_TYPE GetDeletionCost(const Phrase& sourcePhrase) const throw(std::invalid_argument) - { - std::cout << "WordDeletionTable::GetDeletionCost()" << std::endl; - std::map<Phrase, COST_TYPE>::const_iterator i = m_deletionCosts.find(sourcePhrase); - if(i == m_deletionCosts.end()) - throw std::invalid_argument("WordDeletionTable::GetDeletionCost()"); - return i->second; - } -}; |