File size: 1,149 Bytes
158b61b |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 |
/*
* Word.h
*
* Created on: 23 Oct 2015
* Author: hieu
*/
#pragma once
#include "../Word.h"
namespace Moses2
{
class ManagerBase;
namespace SCFG
{
class Hypothesis;
class Word: public Moses2::Word
{
public:
bool isNonTerminal;
explicit Word() {}
explicit Word(const SCFG::Word ©);
void CreateFromString(FactorCollection &vocab,
const System &system,
const std::string &str);
bool operator==(const SCFG::Word &compare) const {
int cmp = Moses2::Word::Compare(compare);
if (cmp == 0 && isNonTerminal == compare.isNonTerminal) {
return true;
} else {
return false;
}
}
size_t hash() const;
virtual size_t hash(const std::vector<FactorType> &factors) const;
virtual void OutputToStream(const System &system, std::ostream &out) const;
virtual void OutputToStream(
const ManagerBase &mgr,
size_t targetPos,
const SCFG::Hypothesis &hypo,
std::ostream &out) const;
virtual std::string Debug(const System &system) const;
protected:
};
inline size_t hash_value(const SCFG::Word &word)
{
return word.hash();
}
}
}
|