mirror of
https://github.com/gigablast/open-source-search-engine.git
synced 2024-10-04 20:27:43 +03:00
52 lines
1.2 KiB
C
52 lines
1.2 KiB
C
|
// Gigablast, copyright Aug 2005
|
||
|
// Author: Javier Olivares <jolivares@gigablast.com>
|
||
|
//
|
||
|
// . stores lists of common words for various languages
|
||
|
// . used to determine what language a word/page belongs to
|
||
|
//
|
||
|
|
||
|
#ifndef _LANGLIST_H_
|
||
|
#define _LANGLIST_H_
|
||
|
|
||
|
//#include "TermTable.h"
|
||
|
#include "Words.h"
|
||
|
#include "Lang.h"
|
||
|
#include "HashTableX.h"
|
||
|
|
||
|
class LangList {
|
||
|
public:
|
||
|
LangList ( );
|
||
|
~LangList ( );
|
||
|
|
||
|
void reset ( );
|
||
|
// . returns false and sets errno on error
|
||
|
// . loads language lists into memory
|
||
|
// . looks under the langlist/ directory for langlist.# files
|
||
|
// each number corrisponds to a language
|
||
|
bool loadLists ( );
|
||
|
|
||
|
// . lookup word in language lists
|
||
|
// . returns false if unknown true if found and lang set
|
||
|
bool lookup ( long long termId,
|
||
|
unsigned char *lang );
|
||
|
|
||
|
char* getCountryFromTld(char* tld, long tldLen);
|
||
|
bool isLangValidForTld(char* tld, long tldLen, unsigned char lang);
|
||
|
bool tldInit();
|
||
|
|
||
|
inline uint8_t catIdToLang(uint32_t catid);
|
||
|
inline uint32_t langToCatId(uint8_t lang);
|
||
|
uint8_t isLangCat(int catid);
|
||
|
|
||
|
|
||
|
private:
|
||
|
//TermTable langTable;
|
||
|
//HashTableT<long, short> m_tldToCountry;
|
||
|
HashTableX m_langTable;
|
||
|
HashTableX m_tldToCountry;
|
||
|
};
|
||
|
|
||
|
extern class LangList g_langList;
|
||
|
|
||
|
#endif
|