mirror of
https://github.com/moses-smt/mosesdecoder.git
synced 2025-01-08 20:46:59 +03:00
28 lines
560 B
C
28 lines
560 B
C
|
#pragma once
|
||
|
#include "Phrase.h"
|
||
|
#include "PhraseImpl.h"
|
||
|
|
||
|
namespace Moses2
|
||
|
{
|
||
|
|
||
|
class SubPhrase : public Phrase
|
||
|
{
|
||
|
friend std::ostream& operator<<(std::ostream &, const SubPhrase &);
|
||
|
public:
|
||
|
SubPhrase(const PhraseImpl &origPhrase, size_t start, size_t end);
|
||
|
virtual const Word& operator[](size_t pos) const
|
||
|
{ return (*m_origPhrase)[pos + m_start]; }
|
||
|
|
||
|
virtual size_t GetSize() const
|
||
|
{ return m_end - m_start + 1; }
|
||
|
|
||
|
SubPhrase GetSubPhrase(size_t start, size_t end) const;
|
||
|
|
||
|
protected:
|
||
|
const PhraseImpl *m_origPhrase;
|
||
|
size_t m_start, m_end;
|
||
|
};
|
||
|
|
||
|
}
|
||
|
|