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

SentenceAlignment.h « phrase-extract.7 « training « scripts - github.com/moses-smt/mosesdecoder.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
blob: a94941309ce1e1840728911f4d29b914583a6ee8 (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
68
69
#pragma once
/*
 *  SentenceAlignment.h
 *  extract
 *
 *  Created by Hieu Hoang on 19/01/2010.
 *  Copyright 2010 __MyCompanyName__. All rights reserved.
 *
 */
#include <vector>
#include <cassert>
#include <iostream>
#include "SyntaxTree.h"
#include "Global.h"
#include "Range.h"

class TunnelCollection;
class Lattice;

class SentenceAlignment 
{
	friend std::ostream& operator<<(std::ostream&, const SentenceAlignment&);

public:
  std::vector<std::string> target;
  std::vector<std::string> source;
  std::vector<int> alignedCountS;
  std::vector< std::vector<int> > alignedToT;
  SyntaxTree sourceTree, targetTree;
	
	//typedef std::vector<Range> Inner;
	//typedef std::vector<Inner> Outer;
	
	//Outer m_s2tTightest, m_t2sTightest;
	
	SentenceAlignment();
	~SentenceAlignment();
  int Create(const std::string &targetString, const std::string &sourceString, const std::string &alignmentString, int sentenceID, const Global &global);
  //  void clear() { delete(alignment); };
	void FindTunnels( const Global &global ) ;

	void CreateLattice(const Global &global);
	void CreateRules(const Global &global);
		
	const TunnelCollection &GetTunnelCollection() const
	{ 
		assert(m_tunnelCollection);
		return *m_tunnelCollection;
	}

	const Lattice &GetLattice() const
	{ 
		assert(m_lattice);
		return *m_lattice;
	}
	
protected:
	TunnelCollection *m_tunnelCollection;
	Lattice *m_lattice;
	
	/*
	void CalcTightestSpan(Outer &tightest);
	void InitTightest(Outer &tightest, size_t len);
	Range &GetTightest(Outer &tightest, size_t startPos, size_t endPos);
	void SetAlignment(size_t source, size_t target);
	void SetAlignment(Outer &tightest, size_t thisPos, size_t thatPos);
	*/
};