~slub.team/goobi-indexserver/3.x

« back to all changes in this revision

Viewing changes to lucene/contrib/analyzers/common/src/java/org/apache/lucene/analysis/ru/RussianLetterTokenizer.java

  • Committer: Sebastian Meyer
  • Date: 2012-08-03 09:12:40 UTC
  • Revision ID: sebastian.meyer@slub-dresden.de-20120803091240-x6861b0vabq1xror
Remove Lucene and Solr source code and add patches instead
Fix Bug #985487: Auto-suggestion for the search interface

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
package org.apache.lucene.analysis.ru;
2
 
 
3
 
/**
4
 
 * Licensed to the Apache Software Foundation (ASF) under one or more
5
 
 * contributor license agreements.  See the NOTICE file distributed with
6
 
 * this work for additional information regarding copyright ownership.
7
 
 * The ASF licenses this file to You under the Apache License, Version 2.0
8
 
 * (the "License"); you may not use this file except in compliance with
9
 
 * the License.  You may obtain a copy of the License at
10
 
 *
11
 
 *     http://www.apache.org/licenses/LICENSE-2.0
12
 
 *
13
 
 * Unless required by applicable law or agreed to in writing, software
14
 
 * distributed under the License is distributed on an "AS IS" BASIS,
15
 
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16
 
 * See the License for the specific language governing permissions and
17
 
 * limitations under the License.
18
 
 */
19
 
 
20
 
import java.io.Reader;
21
 
import org.apache.lucene.analysis.CharTokenizer;
22
 
import org.apache.lucene.analysis.Tokenizer; // for javadocs
23
 
import org.apache.lucene.analysis.LetterTokenizer; // for javadocs
24
 
import org.apache.lucene.analysis.standard.StandardTokenizer; // for javadocs
25
 
import org.apache.lucene.util.AttributeSource;
26
 
import org.apache.lucene.util.Version;
27
 
 
28
 
/**
29
 
 * A RussianLetterTokenizer is a {@link Tokenizer} that extends {@link LetterTokenizer}
30
 
 * by also allowing the basic Latin digits 0-9.
31
 
 * <p>
32
 
 * <a name="version"/>
33
 
 * You must specify the required {@link Version} compatibility when creating
34
 
 * {@link RussianLetterTokenizer}:
35
 
 * <ul>
36
 
 * <li>As of 3.1, {@link CharTokenizer} uses an int based API to normalize and
37
 
 * detect token characters. See {@link CharTokenizer#isTokenChar(int)} and
38
 
 * {@link CharTokenizer#normalize(int)} for details.</li>
39
 
 * </ul>
40
 
 * @deprecated Use {@link StandardTokenizer} instead, which has the same functionality.
41
 
 * This filter will be removed in Lucene 5.0 
42
 
 */
43
 
@Deprecated
44
 
public class RussianLetterTokenizer extends CharTokenizer
45
 
{    
46
 
    private static final int DIGIT_0 = '0';
47
 
    private static final int DIGIT_9 = '9';
48
 
    
49
 
    /**
50
 
     * Construct a new RussianLetterTokenizer. * @param matchVersion Lucene version
51
 
     * to match See {@link <a href="#version">above</a>}
52
 
     * 
53
 
     * @param in
54
 
     *          the input to split up into tokens
55
 
     */
56
 
    public RussianLetterTokenizer(Version matchVersion, Reader in) {
57
 
      super(matchVersion, in);
58
 
    }
59
 
 
60
 
    /**
61
 
     * Construct a new RussianLetterTokenizer using a given {@link AttributeSource}.
62
 
     * 
63
 
     * @param matchVersion
64
 
     *          Lucene version to match See {@link <a href="#version">above</a>}
65
 
     * @param source
66
 
     *          the attribute source to use for this {@link Tokenizer}
67
 
     * @param in
68
 
     *          the input to split up into tokens
69
 
     */
70
 
    public RussianLetterTokenizer(Version matchVersion, AttributeSource source, Reader in) {
71
 
      super(matchVersion, source, in);
72
 
    }
73
 
 
74
 
    /**
75
 
     * Construct a new RussianLetterTokenizer using a given
76
 
     * {@link org.apache.lucene.util.AttributeSource.AttributeFactory}. * @param
77
 
     * matchVersion Lucene version to match See
78
 
     * {@link <a href="#version">above</a>}
79
 
     * 
80
 
     * @param factory
81
 
     *          the attribute factory to use for this {@link Tokenizer}
82
 
     * @param in
83
 
     *          the input to split up into tokens
84
 
     */
85
 
    public RussianLetterTokenizer(Version matchVersion, AttributeFactory factory, Reader in) {
86
 
      super(matchVersion, factory, in);
87
 
    }
88
 
    
89
 
    /**
90
 
     * Construct a new RussianLetterTokenizer.
91
 
     * 
92
 
     * @deprecated use {@link #RussianLetterTokenizer(Version, Reader)} instead. This will
93
 
     *             be removed in Lucene 4.0.
94
 
     */
95
 
    @Deprecated
96
 
    public RussianLetterTokenizer(Reader in) {
97
 
      super(in);
98
 
    }
99
 
 
100
 
    /**
101
 
     * Construct a new RussianLetterTokenizer using a given {@link AttributeSource}.
102
 
     * 
103
 
     * @deprecated use {@link #RussianLetterTokenizer(Version, AttributeSource, Reader)}
104
 
     *             instead. This will be removed in Lucene 4.0.
105
 
     */
106
 
    @Deprecated
107
 
    public RussianLetterTokenizer(AttributeSource source, Reader in) {
108
 
      super(source, in);
109
 
    }
110
 
 
111
 
    /**
112
 
     * Construct a new RussianLetterTokenizer using a given
113
 
     * {@link org.apache.lucene.util.AttributeSource.AttributeFactory}.
114
 
     * 
115
 
     * @deprecated use {@link #RussianLetterTokenizer(Version, AttributeSource.AttributeFactory, Reader)}
116
 
     *             instead. This will be removed in Lucene 4.0.
117
 
     */
118
 
    @Deprecated
119
 
    public RussianLetterTokenizer(AttributeFactory factory, Reader in) {
120
 
      super(factory, in);
121
 
    }
122
 
    
123
 
    
124
 
    /**
125
 
     * Collects only characters which satisfy
126
 
     * {@link Character#isLetter(int)}.
127
 
     */
128
 
    @Override
129
 
    protected boolean isTokenChar(int c) {
130
 
        return Character.isLetter(c) || (c >= DIGIT_0 && c <= DIGIT_9);
131
 
    }
132
 
}