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

« back to all changes in this revision

Viewing changes to lucene/src/java/org/apache/lucene/analysis/LowerCaseTokenizer.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;
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
 
 
22
 
import org.apache.lucene.util.AttributeSource;
23
 
import org.apache.lucene.util.Version;
24
 
 
25
 
/**
26
 
 * LowerCaseTokenizer performs the function of LetterTokenizer
27
 
 * and LowerCaseFilter together.  It divides text at non-letters and converts
28
 
 * them to lower case.  While it is functionally equivalent to the combination
29
 
 * of LetterTokenizer and LowerCaseFilter, there is a performance advantage
30
 
 * to doing the two tasks at once, hence this (redundant) implementation.
31
 
 * <P>
32
 
 * Note: this does a decent job for most European languages, but does a terrible
33
 
 * job for some Asian languages, where words are not separated by spaces.
34
 
 * </p>
35
 
 * <p>
36
 
 * <a name="version"/>
37
 
 * You must specify the required {@link Version} compatibility when creating
38
 
 * {@link LowerCaseTokenizer}:
39
 
 * <ul>
40
 
 * <li>As of 3.1, {@link CharTokenizer} uses an int based API to normalize and
41
 
 * detect token characters. See {@link CharTokenizer#isTokenChar(int)} and
42
 
 * {@link CharTokenizer#normalize(int)} for details.</li>
43
 
 * </ul>
44
 
 * </p>
45
 
 */
46
 
public final class LowerCaseTokenizer extends LetterTokenizer {
47
 
  
48
 
  /**
49
 
   * Construct a new LowerCaseTokenizer.
50
 
   * 
51
 
   * @param matchVersion
52
 
   *          Lucene version to match See {@link <a href="#version">above</a>}
53
 
   * 
54
 
   * @param in
55
 
   *          the input to split up into tokens
56
 
   */
57
 
  public LowerCaseTokenizer(Version matchVersion, Reader in) {
58
 
    super(matchVersion, in);
59
 
  }
60
 
 
61
 
  /** 
62
 
   * Construct a new LowerCaseTokenizer using a given {@link AttributeSource}.
63
 
   *
64
 
   * @param matchVersion
65
 
   *          Lucene version to match See {@link <a href="#version">above</a>}
66
 
   * @param source
67
 
   *          the attribute source to use for this {@link Tokenizer}
68
 
   * @param in
69
 
   *          the input to split up into tokens
70
 
   */
71
 
  public LowerCaseTokenizer(Version matchVersion, AttributeSource source, Reader in) {
72
 
    super(matchVersion, source, in);
73
 
  }
74
 
 
75
 
  /**
76
 
   * Construct a new LowerCaseTokenizer using a given
77
 
   * {@link org.apache.lucene.util.AttributeSource.AttributeFactory}.
78
 
   *
79
 
   * @param matchVersion
80
 
   *          Lucene version to match See {@link <a href="#version">above</a>}
81
 
   * @param factory
82
 
   *          the attribute factory to use for this {@link Tokenizer}
83
 
   * @param in
84
 
   *          the input to split up into tokens
85
 
   */
86
 
  public LowerCaseTokenizer(Version matchVersion, AttributeFactory factory, Reader in) {
87
 
    super(matchVersion, factory, in);
88
 
  }
89
 
  
90
 
  /**
91
 
   * Construct a new LowerCaseTokenizer.
92
 
   * 
93
 
   * @deprecated use {@link #LowerCaseTokenizer(Version, Reader)} instead. This will be
94
 
   *             removed in Lucene 4.0.
95
 
   */
96
 
  @Deprecated
97
 
  public LowerCaseTokenizer(Reader in) {
98
 
    super(Version.LUCENE_30, in);
99
 
  }
100
 
 
101
 
  /**
102
 
   * Construct a new LowerCaseTokenizer using a given {@link AttributeSource}.
103
 
   * 
104
 
   * @deprecated use {@link #LowerCaseTokenizer(Version, AttributeSource, Reader)}
105
 
   *             instead. This will be removed in Lucene 4.0.
106
 
   */
107
 
  @Deprecated
108
 
  public LowerCaseTokenizer(AttributeSource source, Reader in) {
109
 
    super(Version.LUCENE_30, source, in);
110
 
  }
111
 
 
112
 
  /**
113
 
   * Construct a new LowerCaseTokenizer using a given
114
 
   * {@link org.apache.lucene.util.AttributeSource.AttributeFactory}.
115
 
   * 
116
 
   * @deprecated use {@link #LowerCaseTokenizer(Version, AttributeSource.AttributeFactory, Reader)}
117
 
   *             instead. This will be removed in Lucene 4.0.
118
 
   */
119
 
  @Deprecated
120
 
  public LowerCaseTokenizer(AttributeFactory factory, Reader in) {
121
 
    super(Version.LUCENE_30, factory, in);
122
 
  }
123
 
  
124
 
  /** Converts char to lower case
125
 
   * {@link Character#toLowerCase(int)}.*/
126
 
  @Override
127
 
  protected int normalize(int c) {
128
 
    return Character.toLowerCase(c);
129
 
  }
130
 
}