mirror of
https://github.com/moses-smt/mosesdecoder.git
synced 2025-01-05 02:22:21 +03:00
55 lines
1.1 KiB
C++
55 lines
1.1 KiB
C++
/*
|
|
* TargetPhrases.h
|
|
*
|
|
* Created on: 23 Oct 2015
|
|
* Author: hieu
|
|
*/
|
|
|
|
#pragma once
|
|
#include <vector>
|
|
#include "Vector.h"
|
|
#include "TargetPhrase.h"
|
|
|
|
namespace Moses2
|
|
{
|
|
|
|
class TargetPhrases {
|
|
friend std::ostream& operator<<(std::ostream &, const TargetPhrases &);
|
|
typedef Vector<const TargetPhrase*> Coll;
|
|
public:
|
|
typedef Coll::iterator iterator;
|
|
typedef Coll::const_iterator const_iterator;
|
|
//! iterators
|
|
const_iterator begin() const {
|
|
return m_coll.begin();
|
|
}
|
|
const_iterator end() const {
|
|
return m_coll.end();
|
|
}
|
|
|
|
TargetPhrases(MemPool &pool, size_t reserve);
|
|
//TargetPhrases(MemPool &pool, const System &system, const TargetPhrases ©);
|
|
virtual ~TargetPhrases();
|
|
|
|
void AddTargetPhrase(const TargetPhrase &targetPhrase)
|
|
{
|
|
m_coll[m_currInd++] = &targetPhrase;
|
|
}
|
|
|
|
size_t GetSize() const
|
|
{ return m_coll.size(); }
|
|
|
|
const TargetPhrase& operator[](size_t ind) const
|
|
{ return *m_coll[ind]; }
|
|
|
|
void SortAndPrune(size_t tableLimit);
|
|
|
|
//const TargetPhrases *Clone(MemPool &pool, const System &system) const;
|
|
protected:
|
|
Coll m_coll;
|
|
size_t m_currInd;
|
|
};
|
|
|
|
}
|
|
|