presage  0.9.2~beta
Public Member Functions | Private Attributes | Friends | List of all members
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 &, const Prediction &)
 

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.

◆ ~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(), DummyPredictor::predict(), DictionaryPredictor::predict(), DejavuPredictor::predict(), AbbreviationExpansionPredictor::predict(), SmoothedNgramPredictor::predict(), RecencyPredictor::predict(), and ARPAPredictor::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 suggestions.

◆ 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(), 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==(), RecencyPredictor::predict(), Presage::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.

Friends And Related Function Documentation

◆ operator<<

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

Definition at line 116 of file prediction.cpp.

Member Data Documentation

◆ suggestions

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

Definition at line 87 of file prediction.h.

Referenced by addSuggestion(), getSuggestion(), operator<<(), operator=(), size(), and toString().


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