2015-10-24 01:19:31 +03:00
|
|
|
/*
|
|
|
|
* TargetPhrases.h
|
|
|
|
*
|
|
|
|
* Created on: 23 Oct 2015
|
|
|
|
* Author: hieu
|
|
|
|
*/
|
|
|
|
|
|
|
|
#pragma once
|
2015-10-24 14:39:15 +03:00
|
|
|
#include <vector>
|
2015-12-10 14:43:51 +03:00
|
|
|
#include "Vector.h"
|
2015-10-24 14:39:15 +03:00
|
|
|
#include "TargetPhrase.h"
|
2015-10-24 01:19:31 +03:00
|
|
|
|
2015-12-10 23:49:30 +03:00
|
|
|
namespace Moses2
|
|
|
|
{
|
|
|
|
|
2015-10-24 01:19:31 +03:00
|
|
|
class TargetPhrases {
|
2015-10-26 21:42:42 +03:00
|
|
|
friend std::ostream& operator<<(std::ostream &, const TargetPhrases &);
|
2016-02-25 16:26:31 +03:00
|
|
|
typedef Array<const TargetPhrase*> Coll;
|
2015-10-24 01:19:31 +03:00
|
|
|
public:
|
2015-10-25 22:55:22 +03:00
|
|
|
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();
|
|
|
|
}
|
|
|
|
|
2016-02-25 16:26:31 +03:00
|
|
|
TargetPhrases(MemPool &pool, size_t size);
|
2016-01-21 14:22:55 +03:00
|
|
|
//TargetPhrases(MemPool &pool, const System &system, const TargetPhrases ©);
|
2015-10-24 01:19:31 +03:00
|
|
|
virtual ~TargetPhrases();
|
|
|
|
|
2015-10-24 14:39:15 +03:00
|
|
|
void AddTargetPhrase(const TargetPhrase &targetPhrase)
|
|
|
|
{
|
2015-12-10 16:28:18 +03:00
|
|
|
m_coll[m_currInd++] = &targetPhrase;
|
2015-10-24 14:39:15 +03:00
|
|
|
}
|
2015-10-30 22:10:04 +03:00
|
|
|
|
|
|
|
size_t GetSize() const
|
|
|
|
{ return m_coll.size(); }
|
2015-11-06 13:55:04 +03:00
|
|
|
|
2015-11-26 22:08:34 +03:00
|
|
|
const TargetPhrase& operator[](size_t ind) const
|
|
|
|
{ return *m_coll[ind]; }
|
|
|
|
|
2015-11-06 13:55:04 +03:00
|
|
|
void SortAndPrune(size_t tableLimit);
|
|
|
|
|
2016-01-21 14:22:55 +03:00
|
|
|
//const TargetPhrases *Clone(MemPool &pool, const System &system) const;
|
2015-10-24 01:19:31 +03:00
|
|
|
protected:
|
2015-10-25 22:55:22 +03:00
|
|
|
Coll m_coll;
|
2015-12-10 16:28:18 +03:00
|
|
|
size_t m_currInd;
|
2015-10-24 01:19:31 +03:00
|
|
|
};
|
|
|
|
|
2015-12-10 23:49:30 +03:00
|
|
|
}
|
|
|
|
|