ModErn Text Analysis
META Enumerates Textual Applications
|
Represents an observation in a tagged sequence. More...
#include <observation.h>
Classes | |
class | exception |
Basic exception class for observation interactions. More... | |
Public Types | |
using | feature_vector = std::vector< std::pair< feature_id, double >> |
internal feature vector for observations | |
Public Member Functions | |
observation (symbol_t sym, tag_t t) | |
Constructs an observation with a tag. More... | |
observation (symbol_t sym) | |
Constructs an observation that does not yet have a tag. More... | |
const symbol_t & | symbol () const |
const tag_t & | tag () const |
const label_id & | label () const |
void | symbol (symbol_t sym) |
Sets the current symbol. More... | |
void | tag (tag_t t) |
Sets the current tag. More... | |
void | label (label_id lbl) |
Sets the current label. More... | |
bool | tagged () const |
const feature_vector & | features () const |
void | features (feature_vector feats) |
Private Attributes | |
symbol_t | symbol_ |
The symbol for this observation. | |
util::optional< tag_t > | tag_ |
The tag for this observation, if it exists. | |
util::optional< label_id > | label_ |
The label_id for this observation's tag, if it exists. | |
feature_vector | features_ |
The features for this observation. | |
Represents an observation in a tagged sequence.
Contains a symbol and (optionally) a tag for that symbol.
meta::sequence::observation::observation | ( | symbol_t | sym, |
tag_t | t | ||
) |
Constructs an observation with a tag.
sym | The symbol for the observation |
t | The tag for the observation |
meta::sequence::observation::observation | ( | symbol_t | sym | ) |
Constructs an observation that does not yet have a tag.
sym | The symbol for the observation |
const symbol_t & meta::sequence::observation::symbol | ( | ) | const |
const tag_t & meta::sequence::observation::tag | ( | ) | const |
exception | if there is no tag |
const label_id & meta::sequence::observation::label | ( | ) | const |
exception | if there is no label |
void meta::sequence::observation::symbol | ( | symbol_t | sym | ) |
Sets the current symbol.
sym | The new symbol for this observation |
void meta::sequence::observation::tag | ( | tag_t | t | ) |
Sets the current tag.
t | The new tag for this observation |
void meta::sequence::observation::label | ( | label_id | lbl | ) |
Sets the current label.
t | The new label for this observation |
bool meta::sequence::observation::tagged | ( | ) | const |
auto meta::sequence::observation::features | ( | ) | const |
void meta::sequence::observation::features | ( | feature_vector | feats | ) |
feats | The new feature map for this observation |