mirror of
https://github.com/moses-smt/mosesdecoder.git
synced 2024-12-28 14:32:38 +03:00
variable number of score components for phrase trans
git-svn-id: https://mosesdecoder.svn.sourceforge.net/svnroot/mosesdecoder/trunk@79 1f5c12ca-751b-0410-a591-d2e778427230
This commit is contained in:
parent
257bced4de
commit
e338a6dbc0
@ -143,7 +143,7 @@ void IOCommandLine::SetNBest(const LatticePathList &nBestList, long translationI
|
||||
for (iterTrans = transScoreComponent.begin() ; iterTrans != transScoreComponent.end() ; ++iterTrans)
|
||||
{
|
||||
const ScoreComponent &transScore = iterTrans->second;
|
||||
for (size_t i = 0 ; i < NUM_PHRASE_SCORES ; i++)
|
||||
for (size_t i = 0 ; i < transScore.GetNoScoreComponent() ; i++)
|
||||
{
|
||||
m_nBestFile << transScore[i] << " ";
|
||||
}
|
||||
|
@ -101,7 +101,10 @@ Hypothesis::Hypothesis(const Hypothesis &prevHypo, const TranslationOption &tran
|
||||
const ScoreComponent &possComponent = transOpt.GetScoreComponents();
|
||||
ScoreComponent &transComponent = m_transScoreComponent.GetScoreComponent(possComponent.GetDictionary());
|
||||
|
||||
for (size_t i = 0 ; i < NUM_PHRASE_SCORES ; i++)
|
||||
const size_t noScoreComponent = possComponent.GetNoScoreComponent();
|
||||
assert(noScoreComponent == transComponent.GetNoScoreComponent());
|
||||
|
||||
for (size_t i = 0 ; i < noScoreComponent ; i++)
|
||||
{
|
||||
transComponent[i] += possComponent[i];
|
||||
}
|
||||
|
@ -46,3 +46,18 @@ void ScoreComponent::Reset()
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
std::ostream& operator<<(std::ostream &out, const ScoreComponent &scoreComponent)
|
||||
{
|
||||
const size_t noScoreComponent = scoreComponent.GetNoScoreComponent();
|
||||
if (noScoreComponent > 0)
|
||||
{
|
||||
out << scoreComponent[0];
|
||||
for (size_t i = 1 ; i < noScoreComponent ; i++)
|
||||
{
|
||||
out << "," << scoreComponent[i];
|
||||
}
|
||||
}
|
||||
return out;
|
||||
}
|
||||
|
||||
|
@ -71,13 +71,4 @@ public:
|
||||
}
|
||||
};
|
||||
|
||||
inline std::ostream& operator<<(std::ostream &out, const ScoreComponent &transScoreComponent)
|
||||
{
|
||||
out << transScoreComponent[0];
|
||||
for (size_t i = 1 ; i < NUM_PHRASE_SCORES ; i++)
|
||||
{
|
||||
out << "," << transScoreComponent[i];
|
||||
}
|
||||
return out;
|
||||
}
|
||||
|
||||
std::ostream& operator<<(std::ostream &out, const ScoreComponent &scoreComponent);
|
||||
|
@ -31,7 +31,6 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
|
||||
#define NOT_FOUND std::numeric_limits<size_t>::max()
|
||||
|
||||
const size_t NUM_PHRASE_SCORES = 5;
|
||||
const size_t DEFAULT_MAX_HYPOSTACK_SIZE = 200;
|
||||
const size_t ARRAY_SIZE_INCR = 20; //amount by which a hypostack gets resized when necessary
|
||||
const float LOWEST_SCORE = -100.0f;
|
||||
|
Loading…
Reference in New Issue
Block a user