mosesdecoder/contrib/other-builds/moses2/Word.h

39 lines
659 B
C
Raw Normal View History

2015-10-23 18:46:35 +03:00
/*
* Word.h
*
* Created on: 23 Oct 2015
* Author: hieu
*/
2015-10-23 22:53:36 +03:00
#pragma once
2015-10-26 19:32:47 +03:00
#include <iostream>
2015-10-23 22:53:36 +03:00
#include "TypeDef.h"
2015-11-13 13:40:55 +03:00
#include "legacy/Factor.h"
2015-11-13 01:51:13 +03:00
#include "legacy/FactorCollection.h"
2015-10-23 18:46:35 +03:00
class Word {
2015-10-26 19:32:47 +03:00
friend std::ostream& operator<<(std::ostream &, const Word &);
2015-10-23 18:46:35 +03:00
public:
2015-10-24 01:19:31 +03:00
Word();
virtual ~Word();
2015-11-13 01:51:13 +03:00
void CreateFromString(FactorCollection &vocab, const std::string &str);
2015-10-26 17:58:59 +03:00
2015-10-24 01:19:31 +03:00
size_t hash() const;
2015-10-24 14:39:15 +03:00
bool operator==(const Word &compare) const;
2015-10-23 22:53:36 +03:00
2015-11-13 01:51:13 +03:00
const Factor* operator[](size_t ind) const {
2015-10-28 20:47:37 +03:00
return m_factors[ind];
}
2015-11-13 01:51:13 +03:00
const Factor*& operator[](size_t ind) {
2015-10-28 20:47:37 +03:00
return m_factors[ind];
}
2015-10-23 22:53:36 +03:00
protected:
2015-11-13 01:51:13 +03:00
const Factor *m_factors[MAX_NUM_FACTORS];
2015-10-26 17:58:59 +03:00
2015-10-23 18:46:35 +03:00
};