Access the results of the local daily popcon scan. More...
#include <local.h>
Public Member Functions | |
Local (const std::string &file=std::string("/var/log/popularity-contest")) | |
time_t | timestamp () const |
Get the timestamp of the local popcon information. | |
bool | hasData () const |
Return true if this data source has data, false if it's empty. | |
float | score (const std::string &pkg) const |
Return the local score of the package. | |
float | tfidf (const Popcon &popcon, const std::string &pkg) const |
Return the TFIDF score of the package computed against the popcon information. | |
std::vector< std::pair < std::string, float > > | scores () const |
Read the local popcon vote and return the list of packages and their local scores, sorted by ascending score. | |
std::vector< std::pair < std::string, float > > | tfidf (const Popcon &popcon) const |
Read the local popcon vote and return the list of packages and their TFIDF scores computed against the popcon information. | |
Protected Attributes | |
std::map< std::string, float > | m_scores |
time_t | m_timestamp |
Access the results of the local daily popcon scan.
ept::popcon::Local::Local | ( | const std::string & | file = std::string("/var/log/popularity-contest") |
) |
References m_scores, m_timestamp, and timestamp().
bool ept::popcon::Local::hasData | ( | ) | const [inline] |
Return true if this data source has data, false if it's empty.
References m_timestamp.
float ept::popcon::Local::score | ( | const std::string & | pkg | ) | const |
std::vector< std::pair< std::string, float > > ept::popcon::Local::scores | ( | ) | const |
Read the local popcon vote and return the list of packages and their local scores, sorted by ascending score.
References m_scores.
float ept::popcon::Local::tfidf | ( | const Popcon & | popcon, | |
const std::string & | pkg | |||
) | const |
Return the TFIDF score of the package computed against the popcon information.
The TFIDF score is high when a package is representative of this system, that is, it is used in this system and not much used in other systems.
References score(), ept::popcon::Popcon::score(), and ept::popcon::Popcon::submissions().
std::vector< std::pair< std::string, float > > ept::popcon::Local::tfidf | ( | const Popcon & | popcon | ) | const |
Read the local popcon vote and return the list of packages and their TFIDF scores computed against the popcon information.
The packages will be sorted by ascending score.
References m_scores, ept::popcon::Popcon::score(), and ept::popcon::Popcon::submissions().
time_t ept::popcon::Local::timestamp | ( | ) | const [inline] |
std::map<std::string, float> ept::popcon::Local::m_scores [protected] |
time_t ept::popcon::Local::m_timestamp [protected] |
Referenced by hasData(), Local(), and timestamp().