mirror of
https://github.com/moses-smt/mosesdecoder.git
synced 2024-12-26 21:42:19 +03:00
variable number of translation component scores
git-svn-id: https://mosesdecoder.svn.sourceforge.net/svnroot/mosesdecoder/trunk@12 1f5c12ca-751b-0410-a591-d2e778427230
This commit is contained in:
parent
a472843d2e
commit
831d845afa
@ -5,22 +5,32 @@
|
||||
#include "PhraseDictionary.h"
|
||||
|
||||
TransScoreComponent::TransScoreComponent(const PhraseDictionary *phraseDictionary)
|
||||
: m_phraseDictionary(phraseDictionary)
|
||||
{
|
||||
m_phraseDictionary = phraseDictionary;
|
||||
m_scoreComponent = (float*) malloc(sizeof(float) * phraseDictionary->GetNoScoreComponent());
|
||||
}
|
||||
|
||||
TransScoreComponent::TransScoreComponent(const TransScoreComponent ©)
|
||||
:m_phraseDictionary(copy.m_phraseDictionary)
|
||||
{
|
||||
for (size_t i = 0 ; i < NUM_PHRASE_SCORES ; i++)
|
||||
size_t noScoreComponent = m_phraseDictionary->GetNoScoreComponent();
|
||||
m_scoreComponent = (float*) malloc(sizeof(float) * noScoreComponent);
|
||||
|
||||
for (size_t i = 0 ; i < noScoreComponent ; i++)
|
||||
{
|
||||
m_scoreComponent[i] = copy[i];
|
||||
}
|
||||
}
|
||||
|
||||
TransScoreComponent::~TransScoreComponent()
|
||||
{
|
||||
free(m_scoreComponent);
|
||||
}
|
||||
|
||||
void TransScoreComponent::Reset()
|
||||
{
|
||||
for (size_t i = 0 ; i < NUM_PHRASE_SCORES ; i++)
|
||||
size_t noScoreComponent = m_phraseDictionary->GetNoScoreComponent();
|
||||
for (size_t i = 0 ; i < noScoreComponent ; i++)
|
||||
{
|
||||
m_scoreComponent[i] = 0;
|
||||
}
|
||||
|
@ -29,7 +29,7 @@ class TransScoreComponent
|
||||
{
|
||||
protected:
|
||||
const PhraseDictionary *m_phraseDictionary;
|
||||
float m_scoreComponent[NUM_PHRASE_SCORES];
|
||||
float *m_scoreComponent;
|
||||
public:
|
||||
TransScoreComponent()
|
||||
{ // needed by TransScoreComponentCollection
|
||||
@ -37,6 +37,7 @@ public:
|
||||
}
|
||||
TransScoreComponent(const PhraseDictionary *phraseDictionary);
|
||||
TransScoreComponent(const TransScoreComponent ©);
|
||||
~TransScoreComponent();
|
||||
void Reset();
|
||||
|
||||
size_t GetPhraseDictionaryId() const;
|
||||
|
Loading…
Reference in New Issue
Block a user