~ubuntu-branches/ubuntu/raring/clucene-core/raring-proposed

« back to all changes in this revision

Viewing changes to src/contribs-lib/CLucene/analysis/cjk/CJKAnalyzer.h

  • Committer: Package Import Robot
  • Author(s): Fathi Boudra
  • Date: 2012-08-11 09:33:38 UTC
  • mfrom: (1.1.5)
  • Revision ID: package-import@ubuntu.com-20120811093338-fgrx41ftqew3qt6a
Tags: 2.3.3.4-1
* New upstream release (Closes: #661703).
* Convert package to multiarch.
* Drop obsolete patches:
  - 01_add_missing_include_bug505667.diff
  - 02_posixness_fix_bug530308.diff
* Add patches:
  - Fixing_ZLIB_configuration_in_shared_CMakeLists.patch
  - Fix-pkgconfig-file-by-adding-clucene-shared-library.patch
  - Install-contribs-lib.patch
  - multiarch.patch
* Update debian/compat: bump to 8.
* Update debian/control:
  - update build dependencies (add cmake, libboost-dev and libz-dev).
  - bump Standards-Version to 3.9.3.
  - rename packages due to ABI bump: libclucene0ldbl -> libclucene-core1.
  - add libclucene-contribs1 package.
* Update debian/rules:
  - rewrite to use CMake.
  - add multiarch support.

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
/*------------------------------------------------------------------------------
 
2
* Copyright (C) 2003-2006 Ben van Klinken and the CLucene Team
 
3
*
 
4
* Distributable under the terms of either the Apache License (Version 2.0) or
 
5
* the GNU Lesser General Public License, as specified in the COPYING file.
 
6
------------------------------------------------------------------------------*/
 
7
#ifndef _lucene_analysis_cjk_cjkanalyzer_
 
8
#define _lucene_analysis_cjk_cjkanalyzer_
 
9
 
 
10
#include "CLucene/analysis/AnalysisHeader.h"
 
11
 
 
12
CL_NS_DEF2(analysis,cjk)
 
13
 
 
14
/**
 
15
 * CJKTokenizer was modified from StopTokenizer which does a decent job for
 
16
 * most European languages. It performs other token methods for double-byte
 
17
 * Characters: the token will return at each two charactors with overlap match.<br>
 
18
 * Example: "java C1C2C3C4" will be segment to: "java" "C1C2" "C2C3" "C3C4" it
 
19
 * also need filter filter zero length token ""<br>
 
20
 * for Digit: digit, '+', '#' will token as letter<br>
 
21
 * for more info on Asia language(Chinese Japanese Korean) text segmentation:
 
22
 * please search  <a
 
23
 * href="http://www.google.com/search?q=word+chinese+segment">google</a>
 
24
 *
 
25
 * @author Che, Dong
 
26
 */
 
27
class CLUCENE_CONTRIBS_EXPORT CJKTokenizer: public CL_NS(analysis)::Tokenizer {
 
28
private:
 
29
        /** word offset, used to imply which character(in ) is parsed */
 
30
    int32_t offset;
 
31
 
 
32
    /** the index used only for ioBuffer */
 
33
    int32_t bufferIndex;
 
34
 
 
35
    /** data length */
 
36
    int32_t dataLen;
 
37
 
 
38
    /**
 
39
     * character buffer, store the characters which are used to compose <br>
 
40
     * the returned Token
 
41
     */
 
42
    TCHAR buffer[LUCENE_MAX_WORD_LEN];
 
43
 
 
44
    /**
 
45
     * I/O buffer, used to store the content of the input(one of the <br>
 
46
     * members of Tokenizer)
 
47
     */
 
48
    const TCHAR* ioBuffer;
 
49
 
 
50
    /** word type: single=>ASCII  double=>non-ASCII word=>default */
 
51
    const TCHAR* tokenType;
 
52
 
 
53
        static const TCHAR* tokenTypeSingle;
 
54
        static const TCHAR* tokenTypeDouble;
 
55
 
 
56
    /**
 
57
     * tag: previous character is a cached double-byte character  "C1C2C3C4"
 
58
     * ----(set the C1 isTokened) C1C2 "C2C3C4" ----(set the C2 isTokened)
 
59
     * C1C2 C2C3 "C3C4" ----(set the C3 isTokened) "C1C2 C2C3 C3C4"
 
60
     */
 
61
    bool preIsTokened;
 
62
 
 
63
 
 
64
        bool ignoreSurrogates;
 
65
 
 
66
public:
 
67
    /**
 
68
     * Construct a token stream processing the given input.
 
69
     *
 
70
     * @param in I/O reader
 
71
     */
 
72
        CJKTokenizer(CL_NS(util)::Reader* in);
 
73
 
 
74
        /**
 
75
     * Returns the next token in the stream, or null at EOS.
 
76
     * See http://java.sun.com/j2se/1.3/docs/api/java/lang/Character.UnicodeBlock.html
 
77
     * for detail.
 
78
     *
 
79
     * @return Token
 
80
     *
 
81
     * @throws java.io.IOException - throw IOException when read error <br>
 
82
     *         hanppened in the InputStream
 
83
     *
 
84
     */
 
85
        CL_NS(analysis)::Token* next(CL_NS(analysis)::Token* token);
 
86
 
 
87
        bool getIgnoreSurrogates(){ return ignoreSurrogates; };
 
88
        void setIgnoreSurrogates(bool ignoreSurrogates){ this->ignoreSurrogates = ignoreSurrogates; };
 
89
};
 
90
 
 
91
 
 
92
 
 
93
CL_NS_END2
 
94
#endif