Newer
Older
#include <memory>
#include <boost/flyweight.hpp>
static constexpr const char * EOSColName = "EOS";
static constexpr const char * EOSSymbol1 = "1";
static constexpr const char * EOSSymbol0 = "0";
static constexpr const char * headColName = "HEAD";
static constexpr const char * deprelColName = "DEPREL";
static constexpr const char * idColName = "ID";
static constexpr int nbHypothesesMax = 1;
using ValueIterator = std::vector<String>::iterator;
using ConstValueIterator = std::vector<String>::const_iterator;
const Utf8String & rawInput;
std::size_t wordIndex{0};
std::size_t characterIndex{0};
String state{"NONE"};
boost::circular_buffer<String> history{10};
protected :
Config(const Utf8String & rawInput);
public :
virtual std::size_t getNbColumns() const = 0;
virtual std::size_t getColIndex(const std::string & colName) const = 0;
virtual bool hasColIndex(const std::string & colName) const = 0;
virtual std::size_t getFirstLineIndex() const = 0;
virtual const std::string & getColName(int colIndex) const = 0;
std::size_t getIndexOfLine(int lineIndex) const;
std::size_t getIndexOfCol(int colIndex) const;
std::size_t getNbLines() const;
void addLines(unsigned int nbLines);
void resizeLines(unsigned int nbLines);
bool has(int colIndex, int lineIndex, int hypothesisIndex) const;
String & get(int colIndex, int lineIndex, int hypothesisIndex);
const String & getConst(int colIndex, int lineIndex, int hypothesisIndex) const;
String & getLastNotEmpty(int colIndex, int lineIndex);
String & getLastNotEmptyHyp(int colIndex, int lineIndex);
const String & getLastNotEmptyHypConst(int colIndex, int lineIndex) const;
const String & getLastNotEmptyConst(int colIndex, int lineIndex) const;
Franck Dary
committed
const String & getAsFeature(int colIndex, int lineIndex) const;
ValueIterator getIterator(int colIndex, int lineIndex, int hypothesisIndex);
ConstValueIterator getConstIterator(int colIndex, int lineIndex, int hypothesisIndex) const;
virtual ~Config() {}
void printForDebug(FILE * dest) const;
bool has(const std::string & colName, int lineIndex, int hypothesisIndex) const;
String & get(const std::string & colName, int lineIndex, int hypothesisIndex);
const String & getConst(const std::string & colName, int lineIndex, int hypothesisIndex) const;
String & getLastNotEmpty(const std::string & colName, int lineIndex);
const String & getLastNotEmptyConst(const std::string & colName, int lineIndex) const;
String & getLastNotEmptyHyp(const std::string & colName, int lineIndex);
const String & getLastNotEmptyHypConst(const std::string & colName, int lineIndex) const;
Franck Dary
committed
const String & getAsFeature(const std::string & colName, int lineIndex) const;
String & getFirstEmpty(int colIndex, int lineIndex);
String & getFirstEmpty(const std::string & colName, int lineIndex);
util::utf8char getLetter(int letterIndex) const;
void addToHistory(const std::string & transition);
bool isMultiword(std::size_t lineIndex) const;
int getMultiwordSize(std::size_t lineIndex) const;
bool isEmptyNode(std::size_t lineIndex) const;
bool isToken(std::size_t lineIndex) const;
bool moveWordIndex(int relativeMovement);
bool canMoveWordIndex(int relativeMovement) const;
bool canMoveCharacterIndex(int relativeMovement) const;
bool rawInputOnlySeparatorsLeft() const;
std::size_t getWordIndex() const;
std::size_t getCharacterIndex() const;
const String & getHistory(int relativeIndex) const;
std::size_t getStack(int relativeIndex) const;
String getState() const;
void setState(const std::string state);
void addPredicted(const std::set<std::string> & predicted);
bool isPredicted(const std::string & colName) const;
int getCurrentWordId() const;
void setCurrentWordId(int currentWordId);