Merge github.com:moses-smt/mosesdecoder into weight-new

This commit is contained in:
Hieu Hoang 2013-03-28 10:27:19 +00:00
commit 9f5104bc62

View File

@ -25,6 +25,7 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
#include "Word.h"
#include "TypeDef.h"
#include "StaticData.h" // needed to determine the FactorDelimiter
#include "util/exception.hh"
#include "util/tokenize_piece.hh"
using namespace std;
@ -95,6 +96,8 @@ std::string Word::GetString(FactorType factorType) const
return NULL;
}
class StrayFactorException : public util::Exception {};
void Word::CreateFromString(FactorDirection direction
, const std::vector<FactorType> &factorOrder
, const StringPiece &str
@ -106,7 +109,7 @@ void Word::CreateFromString(FactorDirection direction
for (size_t ind = 0; ind < factorOrder.size() && fit; ++ind, ++fit) {
m_factorArray[factorOrder[ind]] = factorCollection.AddFactor(*fit);
}
CHECK(!fit);
UTIL_THROW_IF(fit, StrayFactorException, "You have configured " << factorOrder.size() << " factors but the word " << str << " contains factor delimiter " << StaticData::Instance().GetFactorDelimiter() << " too many times.");
// assume term/non-term same for all factors
m_isNonTerminal = isNonTerminal;