presage 0.9.1
Prediction Class Reference

#include <prediction.h>

Collaboration diagram for Prediction:
Collaboration graph

Public Member Functions

 Prediction ()
 ~Prediction ()
const Predictionoperator= (const Prediction &)
bool operator== (const Prediction &) const
size_t size () const
Suggestion getSuggestion (int=0) const
Suggestion getSuggestion (std::string token) const
void addSuggestion (Suggestion)
std::string toString () const

Private Attributes

std::vector< Suggestionsuggestions

Friends

std::ostream & operator<< (std::ostream &output, const Prediction &p)

Detailed Description

Prediction

A prediction contains a set of Suggestion objects. More precisely, a Prediction is a list of Suggestion object, ordered by decreasing probability.

A Prediction object is returned by the predictors and by a combiner object.

Definition at line 47 of file prediction.h.

Constructor & Destructor Documentation

◆ Prediction()

Prediction::Prediction ( )

Definition at line 28 of file prediction.cpp.

Referenced by operator<<, operator=(), and operator==().

Here is the caller graph for this function:

◆ ~Prediction()

Prediction::~Prediction ( )

Definition at line 31 of file prediction.cpp.

Member Function Documentation

◆ addSuggestion()

void Prediction::addSuggestion ( Suggestion s)

Inserts a new suggestion, preserves the ordering.

The suggestion object to be inserted is compared against the suggestions already contained in the prediction and inserted in an ordered fashion.

Comparison between suggestion objects uses the overloaded operator<

Definition at line 90 of file prediction.cpp.

References suggestions.

Referenced by MeritocracyCombiner::combine(), Combiner::filter(), PredictorActivator::parse_internal_commands(), AbbreviationExpansionPredictor::predict(), ARPAPredictor::predict(), DejavuPredictor::predict(), DictionaryPredictor::predict(), DummyPredictor::predict(), RecencyPredictor::predict(), and SmoothedNgramPredictor::predict().

Here is the caller graph for this function:

◆ getSuggestion() [1/2]

Suggestion Prediction::getSuggestion ( int i = 0) const

Returns nth most probable suggestion.

Definition at line 73 of file prediction.cpp.

References suggestions.

Referenced by Combiner::filter(), operator==(), Presage::predict(), and Selector::select().

Here is the caller graph for this function:

◆ getSuggestion() [2/2]

Suggestion Prediction::getSuggestion ( std::string token) const

Returns suggestion with given token.

Definition at line 80 of file prediction.cpp.

References suggestions.

◆ operator=()

const Prediction & Prediction::operator= ( const Prediction & right)

Definition at line 34 of file prediction.cpp.

References Prediction(), and suggestions.

Here is the call graph for this function:

◆ operator==()

bool Prediction::operator== ( const Prediction & right) const

Predictions are equal iff suggestions are equal and in same order.

Definition at line 45 of file prediction.cpp.

References getSuggestion(), Prediction(), and size().

Here is the call graph for this function:

◆ size()

size_t Prediction::size ( ) const

Returns number of suggestions in prediction.

Definition at line 68 of file prediction.cpp.

References suggestions.

Referenced by Combiner::filter(), operator==(), Presage::predict(), Presage::predict(), RecencyPredictor::predict(), and Selector::select().

Here is the caller graph for this function:

◆ toString()

std::string Prediction::toString ( ) const

Returns a string representation of the prediction.

Definition at line 106 of file prediction.cpp.

References suggestions.

◆ operator<<

std::ostream & operator<< ( std::ostream & output,
const Prediction & p )
friend

Definition at line 116 of file prediction.cpp.

References Prediction(), and suggestions.

Member Data Documentation

◆ suggestions

std::vector<Suggestion> Prediction::suggestions
private

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