mirror of
https://github.com/moses-smt/mosesdecoder.git
synced 2024-12-27 05:55:02 +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"
|
#include "PhraseDictionary.h"
|
||||||
|
|
||||||
TransScoreComponent::TransScoreComponent(const PhraseDictionary *phraseDictionary)
|
TransScoreComponent::TransScoreComponent(const PhraseDictionary *phraseDictionary)
|
||||||
|
: m_phraseDictionary(phraseDictionary)
|
||||||
{
|
{
|
||||||
m_phraseDictionary = phraseDictionary;
|
m_scoreComponent = (float*) malloc(sizeof(float) * phraseDictionary->GetNoScoreComponent());
|
||||||
}
|
}
|
||||||
|
|
||||||
TransScoreComponent::TransScoreComponent(const TransScoreComponent ©)
|
TransScoreComponent::TransScoreComponent(const TransScoreComponent ©)
|
||||||
:m_phraseDictionary(copy.m_phraseDictionary)
|
: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];
|
m_scoreComponent[i] = copy[i];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
TransScoreComponent::~TransScoreComponent()
|
||||||
|
{
|
||||||
|
free(m_scoreComponent);
|
||||||
|
}
|
||||||
|
|
||||||
void TransScoreComponent::Reset()
|
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;
|
m_scoreComponent[i] = 0;
|
||||||
}
|
}
|
||||||
|
@ -29,7 +29,7 @@ class TransScoreComponent
|
|||||||
{
|
{
|
||||||
protected:
|
protected:
|
||||||
const PhraseDictionary *m_phraseDictionary;
|
const PhraseDictionary *m_phraseDictionary;
|
||||||
float m_scoreComponent[NUM_PHRASE_SCORES];
|
float *m_scoreComponent;
|
||||||
public:
|
public:
|
||||||
TransScoreComponent()
|
TransScoreComponent()
|
||||||
{ // needed by TransScoreComponentCollection
|
{ // needed by TransScoreComponentCollection
|
||||||
@ -37,6 +37,7 @@ public:
|
|||||||
}
|
}
|
||||||
TransScoreComponent(const PhraseDictionary *phraseDictionary);
|
TransScoreComponent(const PhraseDictionary *phraseDictionary);
|
||||||
TransScoreComponent(const TransScoreComponent ©);
|
TransScoreComponent(const TransScoreComponent ©);
|
||||||
|
~TransScoreComponent();
|
||||||
void Reset();
|
void Reset();
|
||||||
|
|
||||||
size_t GetPhraseDictionaryId() const;
|
size_t GetPhraseDictionaryId() const;
|
||||||
|
Loading…
Reference in New Issue
Block a user