Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/moses-smt/mosesdecoder.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
path: root/moses
diff options
context:
space:
mode:
authorHieu Hoang <hieuhoang@gmail.com>2015-02-18 18:11:03 +0300
committerHieu Hoang <hieuhoang@gmail.com>2015-02-18 18:11:03 +0300
commitb2232560403f2c42e90b88869e1124558f115d1b (patch)
treecd771d131b26dd18cdaebe8027c2b7fc97b5eca2 /moses
parenta4130744c33f2af3b7af9ed8158ab4b2c0b7eb9b (diff)
park Joint LM. Doesn't work anymore
Diffstat (limited to 'moses')
-rw-r--r--moses/LM/Jamfile2
-rw-r--r--moses/LM/Joint.cpp22
-rw-r--r--moses/LM/Joint.h139
3 files changed, 1 insertions, 162 deletions
diff --git a/moses/LM/Jamfile b/moses/LM/Jamfile
index 826e0b7f1..64e460ca9 100644
--- a/moses/LM/Jamfile
+++ b/moses/LM/Jamfile
@@ -133,7 +133,7 @@ obj ORLM.o : ORLM.cpp ..//headers ../TranslationModel/DynSAInclude//dynsa : : :
#Top-level LM library. If you've added a file that doesn't depend on external
#libraries, put it here.
-alias LM : Backward.cpp BackwardLMState.cpp Base.cpp BilingualLM.cpp Implementation.cpp Joint.cpp Ken.cpp MultiFactor.cpp Remote.cpp SingleFactor.cpp SkeletonLM.cpp ORLM.o
+alias LM : Backward.cpp BackwardLMState.cpp Base.cpp BilingualLM.cpp Implementation.cpp Ken.cpp MultiFactor.cpp Remote.cpp SingleFactor.cpp SkeletonLM.cpp ORLM.o
../../lm//kenlm ..//headers $(dependencies) ;
alias macros : : : : <define>$(lmmacros) ;
diff --git a/moses/LM/Joint.cpp b/moses/LM/Joint.cpp
deleted file mode 100644
index 6db7f1100..000000000
--- a/moses/LM/Joint.cpp
+++ /dev/null
@@ -1,22 +0,0 @@
-// $Id$
-
-/***********************************************************************
-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
-***********************************************************************/
-
-#include "Joint.h"
diff --git a/moses/LM/Joint.h b/moses/LM/Joint.h
deleted file mode 100644
index 1dbdb019e..000000000
--- a/moses/LM/Joint.h
+++ /dev/null
@@ -1,139 +0,0 @@
-// $Id$
-
-/***********************************************************************
-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
-***********************************************************************/
-
-#ifndef moses_LanguageModelJoint_h
-#define moses_LanguageModelJoint_h
-
-#include <vector>
-#include <string>
-#include <sstream>
-#include "SingleFactor.h"
-#include "MultiFactor.h"
-#include "moses/Word.h"
-#include "moses/FactorTypeSet.h"
-#include "moses/FactorCollection.h"
-
-namespace Moses
-{
-
-class Phrase;
-class FactorCollection;
-
-/** LM of multiple factors. A simple extension of single factor LM - factors backoff together.
- * Rather slow as this uses string concatenation/split.
- * Not used for a long time
- */
-class LanguageModelJoint : public LanguageModelMultiFactor
-{
-protected:
- LanguageModelSingleFactor *m_lmImpl;
- std::vector<FactorType> m_factorTypesOrdered;
-
- size_t m_implFactor;
-public:
- LanguageModelJoint(const std::string &line, LanguageModelSingleFactor *lmImpl)
- :LanguageModelMultiFactor(line) {
- m_lmImpl = lmImpl;
- }
-
- ~LanguageModelJoint() {
- delete m_lmImpl;
- }
-
- bool Load(const std::string &filePath
- , const std::vector<FactorType> &factorTypes
- , size_t nGramOrder) {
- m_factorTypes = FactorMask(factorTypes);
- m_filePath = filePath;
- m_nGramOrder = nGramOrder;
-
- m_factorTypesOrdered= factorTypes;
- m_implFactor = 0;
-
- FactorCollection &factorCollection = FactorCollection::Instance();
-
- // sentence markers
- for (size_t index = 0 ; index < factorTypes.size() ; ++index) {
- FactorType factorType = factorTypes[index];
- m_sentenceStartWord[factorType] = factorCollection.AddFactor(Output, factorType, BOS_);
- m_sentenceEndWord[factorType] = factorCollection.AddFactor(Output, factorType, EOS_);
- }
-
- m_lmImpl->Load();
- }
-
- LMResult GetValueForgotState(const std::vector<const Word*> &contextFactor, FFState &outState) const {
- if (contextFactor.size() == 0) {
- LMResult ret;
- ret.score = 0.0;
- ret.unknown = false;
- return ret;
- }
-
- // joint context for internal LM
- std::vector<const Word*> jointContext;
-
- for (size_t currPos = 0 ; currPos < m_nGramOrder ; ++currPos ) {
- const Word &word = *contextFactor[currPos];
-
- // add word to chunked context
- std::stringstream stream("");
-
- const Factor *factor = word[ m_factorTypesOrdered[0] ];
- stream << factor->GetString();
-
- for (size_t index = 1 ; index < m_factorTypesOrdered.size() ; ++index) {
- FactorType factorType = m_factorTypesOrdered[index];
- const Factor *factor = word[factorType];
- stream << "|" << factor->GetString();
- }
-
- factor = FactorCollection::Instance().AddFactor(Output, m_implFactor, stream.str());
-
- Word* jointWord = new Word;
- jointWord->SetFactor(m_implFactor, factor);
- jointContext.push_back(jointWord);
- }
-
- // calc score on chunked phrase
- LMResult ret = m_lmImpl->GetValueForgotState(jointContext, outState);
-
- RemoveAllInColl(jointContext);
-
- return ret;
- }
-
- const FFState *GetNullContextState() const {
- return m_lmImpl->GetNullContextState();
- }
-
- const FFState *GetBeginSentenceState() const {
- return m_lmImpl->GetBeginSentenceState();
- }
-
- FFState *NewState(const FFState *from) const {
- return m_lmImpl->NewState(from);
- }
-
-};
-
-}
-#endif