OpenTREP Logo  0.07.18
C++ Open Travel Request Parsing Library
Loading...
Searching...
No Matches
OPENTREP::ScoreBoard Struct Reference

Structure holding a board for all the types of score/matching having been performed. More...

#include <opentrep/bom/ScoreBoard.hpp>

+ Inheritance diagram for OPENTREP::ScoreBoard:

Public Types

typedef std::map< ScoreType::EN_ScoreType, Score_TScoreMap_T
 

Public Member Functions

const TravelQuery_TgetQueryString () const
 
const ScoreMap_TgetScoreMap () 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 ()
 

Detailed Description

Structure holding a board for all the types of score/matching having been performed.

Definition at line 22 of file ScoreBoard.hpp.

Member Typedef Documentation

◆ ScoreMap_T

(STL) map of scores.

Definition at line 28 of file ScoreBoard.hpp.

Constructor & Destructor Documentation

◆ ScoreBoard() [1/3]

OPENTREP::ScoreBoard::ScoreBoard ( const TravelQuery_T & iQueryString,
const ScoreType & iType,
const Score_T & iScore )

Main constructor.

Definition at line 28 of file ScoreBoard.cpp.

References setScore().

Referenced by ScoreBoard().

◆ ScoreBoard() [2/3]

OPENTREP::ScoreBoard::ScoreBoard ( const TravelQuery_T & iQueryString)

Default constructor.

Definition at line 17 of file ScoreBoard.cpp.

◆ ScoreBoard() [3/3]

OPENTREP::ScoreBoard::ScoreBoard ( const ScoreBoard & iScoreBoard)

Copy constructor.

Definition at line 22 of file ScoreBoard.cpp.

References ScoreBoard().

◆ ~ScoreBoard()

OPENTREP::ScoreBoard::~ScoreBoard ( )

Default destructor.

Definition at line 35 of file ScoreBoard.cpp.

Member Function Documentation

◆ getQueryString()

const TravelQuery_T & OPENTREP::ScoreBoard::getQueryString ( ) const
inline

Get the query string.

Definition at line 36 of file ScoreBoard.hpp.

◆ getScoreMap()

const ScoreMap_T & OPENTREP::ScoreBoard::getScoreMap ( ) const
inline

Get the map of scores.

Definition at line 43 of file ScoreBoard.hpp.

◆ getScore()

Score_T OPENTREP::ScoreBoard::getScore ( const ScoreType & iScoreType) const

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

◆ getCombinedWeight()

Score_T OPENTREP::ScoreBoard::getCombinedWeight ( ) const
inline

Get the combined weight, if existing (0 otherwise).

Definition at line 56 of file ScoreBoard.hpp.

References OPENTREP::ScoreType::COMBINATION, and getScore().

◆ setQueryString()

void OPENTREP::ScoreBoard::setQueryString ( const TravelQuery_T & iQueryString)
inline

Set the query string.

Definition at line 66 of file ScoreBoard.hpp.

◆ setScore()

void OPENTREP::ScoreBoard::setScore ( const ScoreType & iScoreType,
const Score_T & iScore )

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:

  • For matching with IATA/ICAO codes:
    • When the query string fully matches with a IATA/ICAO code, the matching percentage is set to 100% (1.00).
    • Otherwise, it is set to 99.999% (0.99999).
  • The Xapian matching weight is registered as is.
  • For envelope ID:
    • When null, the score is taken as the full matching, i.e., 100% (1.00). There is no need to take 99.999%, as the Xapian matching value above already plays that role.
    • When not null, the score is taken as the minimal default, i.e., 0.10% (0.001).

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

◆ setCombinedWeight()

void OPENTREP::ScoreBoard::setCombinedWeight ( const Score_T & iScore)
inline

Set the combined weight.

Definition at line 103 of file ScoreBoard.hpp.

References OPENTREP::ScoreType::COMBINATION, and setScore().

Referenced by calculateCombinedWeight().

◆ 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().

◆ toStream()

void OPENTREP::ScoreBoard::toStream ( std::ostream & ioOut) const

Dump the structure into an output stream.

Parameters
ostream&the output stream.

Definition at line 177 of file ScoreBoard.cpp.

References describe().

◆ fromStream()

void OPENTREP::ScoreBoard::fromStream ( std::istream & ioIn)
virtual

Read a structure from an input stream.

Parameters
istream&the input stream.

Reimplemented from OPENTREP::StructAbstract.

Definition at line 182 of file ScoreBoard.cpp.

◆ describeKey()

std::string OPENTREP::ScoreBoard::describeKey ( ) const

Display the key of the structure.

Returns
std::string Dump of the structure.

Definition at line 150 of file ScoreBoard.cpp.

Referenced by describe().

◆ describe()

std::string OPENTREP::ScoreBoard::describe ( ) const
virtual

Display of the structure.

Returns
std::string Dump 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().


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