Clover Coverage Report
Coverage timestamp: Fri May 9 2008 10:54:27 EST
../../../../../img/srcFileCovDistChart7.png 63% of files have more coverage
10   77   6   1.67
0   32   0.6   6
6     1  
1    
 
  StandardAnalyzer       Line # 32 10 6 62.5% 0.625
 
  (38)
 
1    package org.apache.lucene.analysis.standard;
2   
3    /**
4    * Copyright 2004 The Apache Software Foundation
5    *
6    * Licensed under the Apache License, Version 2.0 (the "License");
7    * you may not use this file except in compliance with the License.
8    * You may obtain a copy of the License at
9    *
10    * http://www.apache.org/licenses/LICENSE-2.0
11    *
12    * Unless required by applicable law or agreed to in writing, software
13    * distributed under the License is distributed on an "AS IS" BASIS,
14    * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15    * See the License for the specific language governing permissions and
16    * limitations under the License.
17    */
18   
19    import org.apache.lucene.analysis.*;
20   
21    import java.io.File;
22    import java.io.IOException;
23    import java.io.Reader;
24    import java.util.Set;
25   
26    /**
27    * Filters {@link StandardTokenizer} with {@link StandardFilter}, {@link
28    * LowerCaseFilter} and {@link StopFilter}, using a list of English stop words.
29    *
30    * @version $Id: StandardAnalyzer.java 219090 2005-07-14 20:36:28Z dnaber $
31    */
 
32    public class StandardAnalyzer extends Analyzer {
33    private Set stopSet;
34   
35    /** An array containing some common English words that are usually not
36    useful for searching. */
37    public static final String[] STOP_WORDS = StopAnalyzer.ENGLISH_STOP_WORDS;
38   
39    /** Builds an analyzer with the default stop words ({@link #STOP_WORDS}). */
 
40  116 toggle public StandardAnalyzer() {
41  116 this(STOP_WORDS);
42    }
43   
44    /** Builds an analyzer with the given stop words. */
 
45  0 toggle public StandardAnalyzer(Set stopWords) {
46  0 stopSet = stopWords;
47    }
48   
49    /** Builds an analyzer with the given stop words. */
 
50  118 toggle public StandardAnalyzer(String[] stopWords) {
51  118 stopSet = StopFilter.makeStopSet(stopWords);
52    }
53   
54    /** Builds an analyzer with the stop words from the given file.
55    * @see WordlistLoader#getWordSet(File)
56    */
 
57  0 toggle public StandardAnalyzer(File stopwords) throws IOException {
58  0 stopSet = WordlistLoader.getWordSet(stopwords);
59    }
60   
61    /** Builds an analyzer with the stop words from the given reader.
62    * @see WordlistLoader#getWordSet(Reader)
63    */
 
64  0 toggle public StandardAnalyzer(Reader stopwords) throws IOException {
65  0 stopSet = WordlistLoader.getWordSet(stopwords);
66    }
67   
68    /** Constructs a {@link StandardTokenizer} filtered by a {@link
69    StandardFilter}, a {@link LowerCaseFilter} and a {@link StopFilter}. */
 
70  6517 toggle public TokenStream tokenStream(String fieldName, Reader reader) {
71  6517 TokenStream result = new StandardTokenizer(reader);
72  6517 result = new StandardFilter(result);
73  6517 result = new LowerCaseFilter(result);
74  6517 result = new StopFilter(result, stopSet);
75  6517 return result;
76    }
77    }