mirror of
https://github.com/moses-smt/mosesdecoder.git
synced 2024-12-28 14:32:38 +03:00
1e1eb4d29e
git-svn-id: https://mosesdecoder.svn.sourceforge.net/svnroot/mosesdecoder/trunk@4225 1f5c12ca-751b-0410-a591-d2e778427230
54 lines
1.1 KiB
C++
54 lines
1.1 KiB
C++
#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; }
|
|
|
|
};
|