1 #ifndef ALGO_TEXT___VECTOR__HPP
2 #define ALGO_TEXT___VECTOR__HPP
39 template <
class Key,
class Score>
42 template <
class Key,
class Score>
52 template <
class Key,
class Score>
101 Score
Get(Key idx)
const;
103 void Add(Key idx, Score
weight = Score(1));
145 template <
class Key,
class Score>
182 template <
typename OtherIterator>
183 void insert(OtherIterator it_begin, OtherIterator it_end)
196 Score
Get(Key idx)
const;
198 void Add(Key idx, Score
weight = Score(1));
236 template <
class ScoreVectorA,
class ScoreVectorB>
240 template <
class ScoreVectorA,
class ScoreVectorB>
244 template <
class ScoreVectorA,
class ScoreVectorB>
246 float ScoreDice(
const ScoreVectorA&
query,
const ScoreVectorB& vec);
248 template <
class ScoreVectorA,
class ScoreVectorB>
252 template <
class ScoreVectorA,
class ScoreVectorB>
254 float ScoreDot(
const ScoreVectorA&
query,
const ScoreVectorB& vec);
256 template <
class ScoreVectorA,
class ScoreVectorB>
260 template <
class ScoreVectorA,
class ScoreVectorB>
class CRawScoreVector stores its data in a (sorted) STL vector this gives a better memory profile and...
void TrimThresh(Score min_score)
vector< TIdxScore > TVector
CRawScoreVector< Key, Score > & operator+=(const CRawScoreVector< Key, Score > &other)
void TrimLength(float trim_pct)
virtual void Swap(CRawScoreVector< Key, Score > &other)
void SortByIndex()
re-sort the vector by index.
TVector::const_iterator const_iterator
key_type GetId() const
setup functions
void TrimCount(size_t max_words)
pair< Key, Score > TIdxScore
const TVector & Get() const
void insert(const value_type &val)
void SortByScore()
force the vector to be sorted in order of descending score
virtual ~CRawScoreVector()
iterator find(const Key &key)
key_type m_Uid
UID for this set.
void reserve(size_t size)
CRawScoreVector & operator=(const CScoreVector< Key, Score > &)
float Length2() const
math functions
TVector m_Data
the data for this document
CRawScoreVector< Key, Score > & operator/=(Score val)
void Add(Key idx, Score weight=Score(1))
TVector::iterator iterator
CRawScoreVector< Key, Score > & operator*=(Score val)
CRawScoreVector< Key, Score > & operator-=(const CRawScoreVector< Key, Score > &other)
void insert(OtherIterator it_begin, OtherIterator it_end)
void TrimThresh(Score min_score)
CScoreVector< Key, Score > & operator-=(const CScoreVector< Key, Score > &other)
TVector::const_iterator const_iterator
const TVector & Get() const
iterator find(const Key &key)
CScoreVector< Key, Score > & operator/=(Score val)
map< Key, Score > TVector
void TrimLength(float trim_pct)
CScoreVector & operator=(const CScoreVector< Key, Score > &other)
void SubtractMissing(const CScoreVector< Key, Score > &other)
pair< iterator, bool > insert(const value_type &val)
CScoreVector< Key, Score > & operator*=(Score val)
CScoreVector< Key, Score > & operator+=(const CScoreVector< Key, Score > &other)
TVector m_Data
the data for this document
float Length2() const
math functions
key_type m_Uid
UID for this set.
void Add(Key idx, Score weight=Score(1))
TVector::value_type value_type
TVector::iterator iterator
key_type GetId() const
setup functions
virtual void Swap(CScoreVector< Key, Score > &other)
void TrimCount(size_t max_words)
void AddScores(const CScoreVector< Key, Score > &other)
container_type::const_iterator const_iterator
container_type::iterator iterator
iterator_bool insert(const value_type &val)
container_type::value_type value_type
#define END_NCBI_SCOPE
End previously defined NCBI scope.
#define BEGIN_NCBI_SCOPE
Define ncbi namespace.
const struct ncbi::grid::netcache::search::fields::KEY key
Portable reference counted smart and weak pointers using CWeakRef, CRef, CObject and CObjectEx.
float ScoreDistance(const ScoreVectorA &query, const ScoreVectorB &vec)
float ScoreJaccard(const ScoreVectorA &query, const ScoreVectorB &vec)
The Jaccard coefficient is defined as.
float ScoreCombined(const ScoreVectorA &query, const ScoreVectorB &vec)
float ScoreCosine(const ScoreVectorA &query, const ScoreVectorB &vec)
float ScoreOverlap(const ScoreVectorA &query, const ScoreVectorB &vec)
The overlap function is a dot product weighted by the *shortest* of each term.
float ScoreDot(const ScoreVectorA &query, const ScoreVectorB &vec)
float ScoreDice(const ScoreVectorA &query, const ScoreVectorB &vec)
The dice coefficient is defined as.