mirror of
https://github.com/moses-smt/mosesdecoder.git
synced 2024-12-29 06:52:34 +03:00
52 lines
1.1 KiB
C++
52 lines
1.1 KiB
C++
/*
|
|
* ConsistentPhrase.h
|
|
*
|
|
* Created on: 20 Feb 2014
|
|
* Author: hieu
|
|
*/
|
|
|
|
#pragma once
|
|
|
|
#include <cassert>
|
|
#include <vector>
|
|
#include <iostream>
|
|
#include "moses/TypeDef.h"
|
|
#include "NonTerm.h"
|
|
|
|
class ConsistentPhrase
|
|
{
|
|
public:
|
|
typedef std::vector<NonTerm> NonTerms;
|
|
|
|
std::vector<int> corners;
|
|
|
|
ConsistentPhrase(const ConsistentPhrase ©); // do not implement
|
|
ConsistentPhrase(int sourceStart, int sourceEnd,
|
|
int targetStart, int targetEnd,
|
|
const Parameter ¶ms);
|
|
|
|
virtual ~ConsistentPhrase();
|
|
|
|
int GetWidth(Moses::FactorDirection direction) const
|
|
{ return (direction == Moses::Input) ? corners[1] - corners[0] + 1 : corners[3] - corners[2] + 1; }
|
|
|
|
|
|
void AddNonTerms(const std::string &source,
|
|
const std::string &target);
|
|
const NonTerms &GetNonTerms() const
|
|
{ return m_nonTerms;}
|
|
const NonTerm &GetHieroNonTerm() const
|
|
{ return m_hieroNonTerm;}
|
|
|
|
bool TargetOverlap(const ConsistentPhrase &other) const;
|
|
|
|
bool operator<(const ConsistentPhrase &other) const;
|
|
|
|
std::string Debug() const;
|
|
|
|
protected:
|
|
NonTerms m_nonTerms;
|
|
NonTerm m_hieroNonTerm;
|
|
};
|
|
|