open-source-search-engine/Pops.h

38 lines
833 B
C
Raw Normal View History

2013-08-03 00:12:24 +04:00
// Matt Wells, copyright Aug 2005
#ifndef _POPS_H_
#define _POPS_H_
#define POPS_BUF_SIZE (10*1024)
// the max popularity score a word can have
//#define MAX_POP 10000
#define MAX_POP 0x7fff
// the popularity vector for the Words class, 1-1 with those words
class Pops {
public:
Pops();
~Pops();
// . set m_pops to the popularity of each word in "words"
// . m_pops[] is 1-1 with the words in "words"
// . must have computed the word ids (words->m_wordIds must be valid)
2014-11-11 01:45:11 +03:00
bool set ( class Words *words, int32_t a, int32_t b );
2013-08-03 00:12:24 +04:00
// from 1 (min) to 1000 (max popularity)
2014-11-11 01:45:11 +03:00
int32_t *getPops ( ) { return m_pops; };
2013-08-03 00:12:24 +04:00
// from 0.0 to 1.0
2014-11-11 01:45:11 +03:00
float getNormalizedPop ( int32_t i ) {
2013-08-03 00:12:24 +04:00
return (float)m_pops[i]/(float)MAX_POP; };
2014-11-11 01:45:11 +03:00
int32_t *m_pops;
int32_t m_popsSize; // in bytes
2013-08-03 00:12:24 +04:00
char m_localBuf [ POPS_BUF_SIZE ];
};
#endif