blob: 8b8f5115c0b795934b576faf4ceef20808e94295 (
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
|
#pragma once
/*
* PhraseAlignment.h
* extract
*
* Created by Hieu Hoang on 28/07/2010.
* Copyright 2010 __MyCompanyName__. All rights reserved.
*
*/
#include "tables-core.h"
#include <vector>
#include <set>
#include <map>
// data structure for a single phrase pair
class PhraseAlignment
{
protected:
PHRASE phraseS;
PHRASE phraseT;
std::map<size_t, std::pair<size_t, size_t> > m_ntLengths;
void createAlignVec(size_t sourceSize, size_t targetSize);
void addNTLength(const std::string &tok);
public:
float count;
std::vector< std::set<size_t> > alignedToT;
std::vector< std::set<size_t> > alignedToS;
void create( char*, int );
void clear();
bool equals( const PhraseAlignment& );
bool match( const PhraseAlignment& );
int Compare(const PhraseAlignment &compare) const;
inline bool operator<(const PhraseAlignment &compare) const
{
return Compare(compare) < 0;
}
const PHRASE &GetSource() const {
return phraseS;
}
const PHRASE &GetTarget() const {
return phraseT;
}
const std::map<size_t, std::pair<size_t, size_t> > &GetNTLengths() const
{ return m_ntLengths; }
};
|