2008-06-11 14:52:57 +04:00
|
|
|
// $Id$
|
|
|
|
|
|
|
|
#include "TranslationOptionCollectionConfusionNet.h"
|
2013-06-21 04:17:17 +04:00
|
|
|
#include "ConfusionNet.h"
|
2008-06-11 14:52:57 +04:00
|
|
|
#include "DecodeStep.h"
|
|
|
|
#include "FactorCollection.h"
|
|
|
|
|
2008-10-09 03:51:26 +04:00
|
|
|
namespace Moses
|
|
|
|
{
|
2011-02-24 16:14:42 +03:00
|
|
|
|
2008-06-11 14:52:57 +04:00
|
|
|
/** constructor; just initialize the base class */
|
2013-05-11 17:13:26 +04:00
|
|
|
TranslationOptionCollectionConfusionNet::TranslationOptionCollectionConfusionNet(
|
2013-05-29 21:16:15 +04:00
|
|
|
const ConfusionNet &input
|
|
|
|
, size_t maxNoTransOptPerCoverage, float translationOptionThreshold)
|
2013-06-21 04:17:17 +04:00
|
|
|
: TranslationOptionCollection(input, maxNoTransOptPerCoverage, translationOptionThreshold) {}
|
2008-06-11 14:52:57 +04:00
|
|
|
|
|
|
|
/* forcibly create translation option for a particular source word.
|
2011-02-24 16:14:42 +03:00
|
|
|
* call the base class' ProcessOneUnknownWord() for each possible word in the confusion network
|
2008-06-11 14:52:57 +04:00
|
|
|
* at a particular source position
|
|
|
|
*/
|
2011-02-24 16:14:42 +03:00
|
|
|
void TranslationOptionCollectionConfusionNet::ProcessUnknownWord(size_t sourcePos)
|
2008-06-11 14:52:57 +04:00
|
|
|
{
|
2011-02-24 16:14:42 +03:00
|
|
|
ConfusionNet const& source=dynamic_cast<ConfusionNet const&>(m_source);
|
|
|
|
|
|
|
|
ConfusionNet::Column const& coll=source.GetColumn(sourcePos);
|
|
|
|
size_t j=0;
|
|
|
|
for(ConfusionNet::Column::const_iterator i=coll.begin(); i!=coll.end(); ++i) {
|
|
|
|
ProcessOneUnknownWord(i->first ,sourcePos, source.GetColumnIncrement(sourcePos, j++),&(i->second));
|
|
|
|
}
|
|
|
|
|
2008-06-11 14:52:57 +04:00
|
|
|
}
|
|
|
|
|
2008-10-09 03:51:26 +04:00
|
|
|
}
|
|
|
|
|
|
|
|
|