Structure holding a board for all the types of score/matching having been performed. More...
#include <opentrep/bom/ScoreBoard.hpp>
Public Types | |
typedef std::map < ScoreType::EN_ScoreType, Score_T > | ScoreMap_T |
Public Member Functions | |
const TravelQuery_T & | getQueryString () const |
const ScoreMap_T & | getScoreMap () const |
Score_T | getScore (const ScoreType &) const |
Score_T | getCombinedWeight () const |
void | setQueryString (const TravelQuery_T &iQueryString) |
void | setScore (const ScoreType &, const Score_T &) |
void | setCombinedWeight (const Score_T &iScore) |
Percentage_T | calculateCombinedWeight () |
void | toStream (std::ostream &) const |
void | fromStream (std::istream &) |
std::string | describeKey () const |
std::string | describe () const |
ScoreBoard (const TravelQuery_T &, const ScoreType &, const Score_T &) | |
ScoreBoard (const TravelQuery_T &) | |
ScoreBoard (const ScoreBoard &) | |
~ScoreBoard () | |
Structure holding a board for all the types of score/matching having been performed.
Definition at line 22 of file ScoreBoard.hpp.
typedef std::map<ScoreType::EN_ScoreType, Score_T> OPENTREP::ScoreBoard::ScoreMap_T |
(STL) map of scores.
Definition at line 28 of file ScoreBoard.hpp.
OPENTREP::ScoreBoard::ScoreBoard | ( | const TravelQuery_T & | iQueryString, |
const ScoreType & | iType, | ||
const Score_T & | iScore | ||
) |
OPENTREP::ScoreBoard::ScoreBoard | ( | const TravelQuery_T & | iQueryString | ) |
Default constructor.
Definition at line 17 of file ScoreBoard.cpp.
OPENTREP::ScoreBoard::ScoreBoard | ( | const ScoreBoard & | iScoreBoard | ) |
Copy constructor.
Definition at line 22 of file ScoreBoard.cpp.
OPENTREP::ScoreBoard::~ScoreBoard | ( | ) |
Default destructor.
Definition at line 35 of file ScoreBoard.cpp.
|
inline |
Get the query string.
Definition at line 36 of file ScoreBoard.hpp.
|
inline |
Get the map of scores.
Definition at line 43 of file ScoreBoard.hpp.
Get the score for the given type. If no score value has already been stored for that type, return 0.
Definition at line 40 of file ScoreBoard.cpp.
References OPENTREP::ScoreType::getType().
Referenced by OPENTREP::Result::displayXapianPercentages(), and getCombinedWeight().
|
inline |
Get the combined weight, if existing (0 otherwise).
Definition at line 56 of file ScoreBoard.hpp.
References OPENTREP::ScoreType::COMBINATION, and getScore().
|
inline |
Set the query string.
Definition at line 66 of file ScoreBoard.hpp.
Set the score for the given type. If no score value has already been stored for that type, create it.
A trick is used to decrease the overall percentage of word combinations, when compared to the whole string. For instance, {"san francisco"} will have a percentage of 99.999%, compared to {"san", "francisco"} which will have a percentage of 99.998%.
A few rules are applied:
Definition at line 54 of file ScoreBoard.cpp.
References FloatingPoint< RawType >::AlmostEquals(), OPENTREP::ScoreType::CODE_FULL_MATCH, OPENTREP::ScoreType::describe(), OPENTREP::ScoreType::ENV_ID, OPENTREP::ScoreType::getType(), OPENTREP::K_DEFAULT_ENVELOPE_PCT, OPENTREP::K_DEFAULT_FULL_CODE_MATCH_PCT, OPENTREP::K_DEFAULT_MODIFIED_MATCHING_PCT, and OPENTREP_LOG_ERROR.
Referenced by OPENTREP::Result::calculateCodeMatches(), OPENTREP::Result::calculateEnvelopeWeights(), OPENTREP::Result::calculatePageRanks(), ScoreBoard(), setCombinedWeight(), and OPENTREP::Result::setScoreOnDocMap().
|
inline |
Set the combined weight.
Definition at line 103 of file ScoreBoard.hpp.
References OPENTREP::ScoreType::COMBINATION, and setScore().
Referenced by calculateCombinedWeight().
Percentage_T OPENTREP::ScoreBoard::calculateCombinedWeight | ( | ) |
Calculate the combination of the weights for all the score types, resulting from the full-text matching process, PageRank, user input, etc.
Definition at line 186 of file ScoreBoard.cpp.
References OPENTREP::ScoreType::isIndividualScore(), and setCombinedWeight().
Referenced by OPENTREP::Result::calculateCombinedWeights().
void OPENTREP::ScoreBoard::toStream | ( | std::ostream & | ioOut | ) | const |
Dump the structure into an output stream.
ostream& | the output stream. |
Definition at line 177 of file ScoreBoard.cpp.
References describe().
|
virtual |
Read a structure from an input stream.
istream& | the input stream. |
Reimplemented from OPENTREP::StructAbstract.
Definition at line 182 of file ScoreBoard.cpp.
std::string OPENTREP::ScoreBoard::describeKey | ( | ) | const |
Display the key of the structure.
Definition at line 150 of file ScoreBoard.cpp.
Referenced by describe().
|
virtual |
Display of the structure.
Implements OPENTREP::StructAbstract.
Definition at line 157 of file ScoreBoard.cpp.
References describeKey(), and OPENTREP::ScoreType::getTypeLabelAsString().
Referenced by OPENTREP::Result::calculateCombinedWeights(), toStream(), and OPENTREP::Result::toString().