File size: 1,049 Bytes
158b61b
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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
#pragma once

#include <vector>
#include <string>

class Alignment;
class PhrasePair;
class SuffixArray;
class TargetCorpus;
class Mismatch;

class PhrasePairCollection
{
public:
  typedef unsigned int INDEX;

private:
  SuffixArray *m_suffixArray;
  TargetCorpus *m_targetCorpus;
  Alignment *m_alignment;
  std::vector<std::vector<PhrasePair*> > m_collection;
  std::vector< Mismatch* > m_mismatch, m_unaligned;
  int m_size;
  int m_max_lookup;
  int m_max_translation;
  int m_max_example;

  // No copying allowed.
  PhrasePairCollection(const PhrasePairCollection&);
  void operator=(const PhrasePairCollection&);

public:
  PhrasePairCollection ( SuffixArray *, TargetCorpus *, Alignment *, int, int );
  ~PhrasePairCollection ();

  int GetCollection( const std::vector<std::string >& sourceString );
  void Print(bool pretty) const;
  void PrintHTML() const;
};

// sorting helper
struct CompareBySize {
  bool operator()(const std::vector<PhrasePair*>& a, const std::vector<PhrasePair*>& b ) const {
    return a.size() > b.size();
  }
};