NepomukDaemons
clucenetokenizer.h
Go to the documentation of this file.00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024 #ifndef _NEPOMUK_CLUCENE_TOKENIZER_H_
00025 #define _NEPOMUK_CLUCENE_TOKENIZER_H_
00026
00027 #include <CLucene/clucene-config.h>
00028 #include <CLucene/analysis/AnalysisHeader.h>
00029 #include <CLucene/analysis/Analyzers.h>
00030 #include <CLucene/util/StringBuffer.h>
00031 #include <CLucene/util/FastCharStream.h>
00032 #include <CLucene/util/Reader.h>
00033
00034 #include "clucenetokenizerconstants.h"
00035
00036 namespace Nepomuk {
00037
00054 class CLuceneTokenizer: public CL_NS(analysis)::Tokenizer
00055 {
00056 public:
00057 CL_NS(util)::FastCharStream* rd;
00058
00059
00060 CLuceneTokenizer(CL_NS(util)::Reader* reader);
00061
00062 ~CLuceneTokenizer();
00063
00067 bool next(CL_NS(analysis)::Token* token);
00068
00069
00070 bool ReadNumber(const TCHAR* previousNumber, const TCHAR prev, CL_NS(analysis)::Token* t);
00071
00072 bool ReadAlphaNum(const TCHAR prev, CL_NS(analysis)::Token* t);
00073
00074
00075 bool ReadApostrophe(CL_NS(util)::StringBuffer* str, CL_NS(analysis)::Token* t);
00076
00077
00078 bool ReadAt(CL_NS(util)::StringBuffer* str, CL_NS(analysis)::Token* t);
00079
00080
00081 bool ReadCompany(CL_NS(util)::StringBuffer* str, CL_NS(analysis)::Token* t);
00082
00083
00084 bool ReadCJK(const TCHAR prev, CL_NS(analysis)::Token* t);
00085
00086 private:
00087 int32_t rdPos;
00088 int32_t tokenStart;
00089
00090
00091 int readChar();
00092
00093 void unReadChar();
00094
00095
00096
00097 inline bool setToken(CL_NS(analysis)::Token* t, CL_NS(util)::StringBuffer* sb, TokenTypes tokenCode);
00098
00099 bool ReadDotted(CL_NS(util)::StringBuffer* str, TokenTypes forcedType, CL_NS(analysis)::Token* t);
00100 };
00101 }
00102
00103 #endif