Prediction Class Reference

`#include <prediction.h>`

Collaboration diagram for Prediction:

## Public Member Functions

| Prediction ()
| ~Prediction ()
const Prediction & | operator= (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< Suggestion > | suggestions

## 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 | ( |  | ) |

Definition at line 28 of file prediction.cpp.

Prediction::~Prediction | ( |  | ) |

Definition at line 31 of file prediction.cpp.

## Member Function Documentation

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:

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:

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

Returns suggestion with given token.

Definition at line 80 of file prediction.cpp.

References suggestions.

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

Definition at line 34 of file prediction.cpp.

References suggestions.

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_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:

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

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

friend

Definition at line 116 of file prediction.cpp.

## Member Data Documentation

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:

- /build/buildd/presage-0.8.8/src/lib/core/prediction.h
- /build/buildd/presage-0.8.8/src/lib/core/prediction.cpp