ModErn Text Analysis
META Enumerates Textual Applications
Classes | Public Types | Public Member Functions | Private Attributes | List of all members
meta::sequence::observation Class Reference

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_vectorfeatures () 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.
 

Detailed Description

Represents an observation in a tagged sequence.

Contains a symbol and (optionally) a tag for that symbol.

Constructor & Destructor Documentation

meta::sequence::observation::observation ( symbol_t  sym,
tag_t  t 
)

Constructs an observation with a tag.

Parameters
symThe symbol for the observation
tThe tag for the observation
meta::sequence::observation::observation ( symbol_t  sym)

Constructs an observation that does not yet have a tag.

Parameters
symThe symbol for the observation

Member Function Documentation

const symbol_t & meta::sequence::observation::symbol ( ) const
Returns
the symbol for this observation
const tag_t & meta::sequence::observation::tag ( ) const
Exceptions
exceptionif there is no tag
Returns
the tag for this observation
const label_id & meta::sequence::observation::label ( ) const
Exceptions
exceptionif there is no label
Returns
the label for this observation
void meta::sequence::observation::symbol ( symbol_t  sym)

Sets the current symbol.

Parameters
symThe new symbol for this observation
void meta::sequence::observation::tag ( tag_t  t)

Sets the current tag.

Parameters
tThe new tag for this observation
void meta::sequence::observation::label ( label_id  lbl)

Sets the current label.

Parameters
tThe new label for this observation
bool meta::sequence::observation::tagged ( ) const
Returns
whether or not this observation is tagged
auto meta::sequence::observation::features ( ) const
Returns
the feature map for this observation
void meta::sequence::observation::features ( feature_vector  feats)
Parameters
featsThe new feature map for this observation

The documentation for this class was generated from the following files: