Save This Page
Home » lucene-3.0.1-src » org.apache » lucene » analysis » [javadoc | source]
    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   
   24   /** A WhitespaceTokenizer is a tokenizer that divides text at whitespace.
   25    * Adjacent sequences of non-Whitespace characters form tokens. */
   26   
   27   public class WhitespaceTokenizer extends CharTokenizer {
   28     /** Construct a new WhitespaceTokenizer. */
   29     public WhitespaceTokenizer(Reader in) {
   30       super(in);
   31     }
   32   
   33     /** Construct a new WhitespaceTokenizer using a given {@link AttributeSource}. */
   34     public WhitespaceTokenizer(AttributeSource source, Reader in) {
   35       super(source, in);
   36     }
   37   
   38     /** Construct a new WhitespaceTokenizer using a given {@link org.apache.lucene.util.AttributeSource.AttributeFactory}. */
   39     public WhitespaceTokenizer(AttributeFactory factory, Reader in) {
   40       super(factory, in);
   41     }
   42     
   43     /** Collects only characters which do not satisfy
   44      * {@link Character#isWhitespace(char)}.*/
   45     @Override
   46     protected boolean isTokenChar(char c) {
   47       return !Character.isWhitespace(c);
   48     }
   49   }

Save This Page
Home » lucene-3.0.1-src » org.apache » lucene » analysis » [javadoc | source]