Suggestion Class Reference

`#include <suggestion.h>`

Collaboration diagram for Suggestion:

## Classes

class | SuggestionException

## Public Member Functions

| Suggestion (std::string="", double=0.0)
| ~Suggestion ()
bool | operator== (const Suggestion &) const
bool | operator!= (const Suggestion &) const
bool | operator< (const Suggestion &) const
std::string | getWord () const
double | getProbability () const
void | setWord (std::string)
void | setProbability (double)
std::string | toString () const

## Static Public Attributes

static const double | MIN_PROBABILITY = 0.0
static const double | MAX_PROBABILITY = 1.0

## Private Attributes

std::string | word
double | probability

## Friends

std::ostream & | operator<< (std::ostream &, const Suggestion &)

## Detailed Description

Suggestion

A suggestion is a prediction token, probability pair.

A prediction token is a string (word or single character). The probability describes how likely the predictor estimated that the associated predicted token is the desired token.

Probability might have to be computed as logarithmic probability to avoid buffer underflows.

Definition at line 50 of file suggestion.h.

## Constructor & Destructor Documentation

Suggestion::Suggestion | ( | std::string | s = `""`,
|  | double | p = `0.0`
| ) |  |

Definition at line 30 of file suggestion.cpp.

References setProbability(), and setWord().

Here is the call graph for this function:

Suggestion::~Suggestion | ( |  | ) |

Definition at line 36 of file suggestion.cpp.

## Member Function Documentation

double Suggestion::getProbability | ( |  | ) | const

Definition at line 69 of file suggestion.cpp.

References probability.

Referenced by Combiner::filter(), and Presage::predict().

Here is the caller graph for this function:

std::string Suggestion::getWord | ( |  | ) | const

Definition at line 64 of file suggestion.cpp.

References word.

Referenced by Combiner::filter(), and Selector::select().

Here is the caller graph for this function:

bool Suggestion::operator!= | ( | const Suggestion & | right | ) | const

Definition at line 47 of file suggestion.cpp.

bool Suggestion::operator< | ( | const Suggestion & | right | ) | const

Definition at line 52 of file suggestion.cpp.

References probability, and word.

bool Suggestion::operator== | ( | const Suggestion & | right | ) | const

Definition at line 39 of file suggestion.cpp.

References probability, and word.

void Suggestion::setProbability | ( | double | p | ) |

Definition at line 79 of file suggestion.cpp.

References MIN_PROBABILITY, PRESAGE_INVALID_SUGGESTION_ERROR, probability, and word.

Referenced by Combiner::filter(), RecencyPredictor::predict(), and Suggestion().

Here is the caller graph for this function:

void Suggestion::setWord | ( | std::string | s | ) |

Definition at line 74 of file suggestion.cpp.

References word.

Referenced by RecencyPredictor::predict(), and Suggestion().

Here is the caller graph for this function:

std::string Suggestion::toString | ( |  | ) | const

Returns a string representation of this suggestion.

Definition at line 95 of file suggestion.cpp.

References endl(), probability, and word.

Here is the call graph for this function:

## Friends And Related Function Documentation

std::ostream& operator<< | ( | std::ostream & | output,
|  | const Suggestion & | s
| ) |  |

friend

Definition at line 103 of file suggestion.cpp.

## Member Data Documentation

const double Suggestion::MAX_PROBABILITY = 1.0

static

Definition at line 69 of file suggestion.h.

Referenced by Combiner::filter().

const double Suggestion::MIN_PROBABILITY = 0.0

static

Definition at line 68 of file suggestion.h.

Referenced by setProbability().

double Suggestion::probability

private

Definition at line 83 of file suggestion.h.

Referenced by getProbability(), operator<(), operator<<(), operator==(), setProbability(), and toString().

std::string Suggestion::word

private

Definition at line 82 of file suggestion.h.

Referenced by getWord(), operator<(), operator<<(), operator==(), setProbability(), setWord(), and toString().

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

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