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

Rand.h « LM « moses - github.com/moses-smt/mosesdecoder.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
blob: 54b5738b6e5b7c539443c1ff4a96fea11dadb2b6 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
#ifndef moses_LM_Rand_h
#define moses_LM_Rand_h
/***********************************************************************
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 <vector>
#include <string>
#include <stdint.h>
#include "SingleFactor.h"
#include "moses/TypeDef.h"
#include "moses/Word.h"
//#include "RandLM.h"

namespace randlm
{
class RandLM;
}

namespace Moses
{
class LanguageModelRandLM : public LanguageModelSingleFactor
{
public:
  LanguageModelRandLM(const std::string &line);
  ~LanguageModelRandLM();

  void Load(AllOptions::ptr const& opts);
  virtual LMResult GetValue(const std::vector<const Word*> &contextFactor, State* finalState = NULL) const;
  void InitializeForInput(ttasksptr const& ttask);
  void CleanUpAfterSentenceProcessing(const InputType& source);

protected:
  //std::vector<randlm::WordID> m_randlm_ids_vec;
  std::vector<uint32_t> m_randlm_ids_vec; // Ken made me do this

  randlm::RandLM* m_lm;
  uint32_t m_oov_id;
  void CreateFactors(FactorCollection &factorCollection);
  uint32_t GetLmID( const std::string &str ) const;
  uint32_t GetLmID( const Factor *factor ) const;

};

}

#endif