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

TargetPhrases.h « SCFG « moses2 « contrib - github.com/moses-smt/mosesdecoder.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
blob: 22502b3ef16ad287583a4bea4ae60cbbb5dea60c (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
62
63
64
65
66
67
/*
 * TargetPhrases.h
 *
 *  Created on: 15 Apr 2016
 *      Author: hieu
 */

#pragma once
#include <vector>
#include <stddef.h>
#include "../Vector.h"

namespace Moses2
{
class MemPool;
class System;

namespace SCFG
{
class TargetPhraseImpl;

class TargetPhrases
{
  typedef Moses2::Vector<const SCFG::TargetPhraseImpl*> Coll;

public:
  typedef Coll::iterator iterator;
  typedef Coll::const_iterator const_iterator;
  //! iterators
  const_iterator begin() const
  {
    return m_coll.begin();
  }
  const_iterator end() const
  {
    return m_coll.end();
  }

  const SCFG::TargetPhraseImpl& operator[](size_t ind) const
  {
    return *m_coll[ind];
  }

  TargetPhrases(MemPool &pool);
  TargetPhrases(MemPool &pool, size_t size);
  virtual ~TargetPhrases();

  size_t GetSize() const
  { return m_coll.size(); }

  void AddTargetPhrase(const SCFG::TargetPhraseImpl &targetPhrase)
  {
    m_coll.push_back(&targetPhrase);
  }

  void SortAndPrune(size_t tableLimit);

  std::string Debug(const System &system) const;

protected:
  Coll m_coll;

};

}
} /* namespace Moses2 */