|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| StandardFilter | Line # 23 | 16 | 9 | 100% |
1.0
|
|||||||||||||||||||||||||||||||||||||||||||||||||||||||
| (29) | |||
| Result | |||
|
1.0
|
org.apache.lucene.analysis.TestStandardAnalyzer.testStandard
org.apache.lucene.analysis.TestStandardAnalyzer.testStandard
|
1 PASS | |
|
0.53571427
|
org.apache.lucene.search.TestMultiSearcherRanking.testOneTermQuery
org.apache.lucene.search.TestMultiSearcherRanking.testOneTermQuery
|
1 PASS | |
|
0.53571427
|
org.apache.lucene.search.TestMultiSearcher.testEmptyIndex
org.apache.lucene.search.TestMultiSearcher.testEmptyIndex
|
1 PASS | |
|
0.53571427
|
org.apache.lucene.queryParser.TestMultiFieldQueryParser.testStaticMethod2Old
org.apache.lucene.queryParser.TestMultiFieldQueryParser.testStaticMethod2Old
|
1 PASS | |
|
0.53571427
|
org.apache.lucene.queryParser.TestMultiFieldQueryParser.testStaticMethod2
org.apache.lucene.queryParser.TestMultiFieldQueryParser.testStaticMethod2
|
1 PASS | |
|
0.53571427
|
org.apache.lucene.queryParser.TestMultiFieldQueryParser.testStopWordSearching
org.apache.lucene.queryParser.TestMultiFieldQueryParser.testStopWordSearching
|
1 PASS | |
|
0.53571427
|
org.apache.lucene.queryParser.TestMultiFieldQueryParser.testAnalyzerReturningNull
org.apache.lucene.queryParser.TestMultiFieldQueryParser.testAnalyzerReturningNull
|
1 PASS | |
|
0.53571427
|
org.apache.lucene.queryParser.TestMultiFieldQueryParser.testBoostsSimple
org.apache.lucene.queryParser.TestMultiFieldQueryParser.testBoostsSimple
|
1 PASS | |
|
0.53571427
|
org.apache.lucene.search.TestMultiSearcherRanking.testTwoTermQuery
org.apache.lucene.search.TestMultiSearcherRanking.testTwoTermQuery
|
1 PASS | |
|
0.53571427
|
org.apache.lucene.queryParser.TestMultiFieldQueryParser.testSimple
org.apache.lucene.queryParser.TestMultiFieldQueryParser.testSimple
|
1 PASS | |
|
0.53571427
|
org.apache.lucene.index.TestParallelReader.testIncompatibleIndexes
org.apache.lucene.index.TestParallelReader.testIncompatibleIndexes
|
1 PASS | |
|
0.53571427
|
org.apache.lucene.queryParser.TestMultiFieldQueryParser.testStaticMethod3
org.apache.lucene.queryParser.TestMultiFieldQueryParser.testStaticMethod3
|
1 PASS | |
|
0.53571427
|
org.apache.lucene.index.TestIndexReader.testIsCurrent
org.apache.lucene.index.TestIndexReader.testIsCurrent
|
1 PASS | |
|
0.53571427
|
org.apache.lucene.index.TestIndexModifier.testIndexWithThreads
org.apache.lucene.index.TestIndexModifier.testIndexWithThreads
|
1 PASS | |
|
0.53571427
|
org.apache.lucene.search.TestMatchAllDocsQuery.testQuery
org.apache.lucene.search.TestMatchAllDocsQuery.testQuery
|
1 PASS | |
|
0.53571427
|
org.apache.lucene.queryParser.TestQueryParser.testNumber
org.apache.lucene.queryParser.TestQueryParser.testNumber
|
1 PASS | |
|
0.53571427
|
org.apache.lucene.search.TestMultiPhraseQuery.testPhrasePrefixWithBooleanQuery
org.apache.lucene.search.TestMultiPhraseQuery.testPhrasePrefixWithBooleanQuery
|
1 PASS | |
|
0.53571427
|
org.apache.lucene.queryParser.TestMultiFieldQueryParser.testStaticMethod1
org.apache.lucene.queryParser.TestMultiFieldQueryParser.testStaticMethod1
|
1 PASS | |
|
0.53571427
|
org.apache.lucene.queryParser.TestMultiFieldQueryParser.testStaticMethod3Old
org.apache.lucene.queryParser.TestMultiFieldQueryParser.testStaticMethod3Old
|
1 PASS | |
|
0.53571427
|
org.apache.lucene.index.TestIndexReader.testGetFieldNames
org.apache.lucene.index.TestIndexReader.testGetFieldNames
|
1 PASS | |
|
0.53571427
|
org.apache.lucene.TestDemo.testDemo
org.apache.lucene.TestDemo.testDemo
|
1 PASS | |
|
0.53571427
|
org.apache.lucene.index.TestParallelReader.testFieldNames
org.apache.lucene.index.TestParallelReader.testFieldNames
|
1 PASS | |
|
0.53571427
|
org.apache.lucene.search.TestMultiSearcher.testEmptyIndex
org.apache.lucene.search.TestMultiSearcher.testEmptyIndex
|
1 PASS | |
|
0.53571427
|
org.apache.lucene.search.TestMultiSearcherRanking.testMultiPhraseQuery
org.apache.lucene.search.TestMultiSearcherRanking.testMultiPhraseQuery
|
1 PASS | |
|
0.53571427
|
org.apache.lucene.queryParser.TestQueryParser.testBoost
org.apache.lucene.queryParser.TestQueryParser.testBoost
|
1 PASS | |
|
0.53571427
|
org.apache.lucene.index.TestParallelReader.testDocument
org.apache.lucene.index.TestParallelReader.testDocument
|
1 PASS | |
|
0.53571427
|
org.apache.lucene.document.TestDocument.testGetValuesForIndexedDocument
org.apache.lucene.document.TestDocument.testGetValuesForIndexedDocument
|
1 PASS | |
|
0.53571427
|
org.apache.lucene.search.TestMultiSearcherRanking.testNoMatchQuery
org.apache.lucene.search.TestMultiSearcherRanking.testNoMatchQuery
|
1 PASS | |
|
0.25
|
org.apache.lucene.index.TestTermVectorsWriter.testBadSegment
org.apache.lucene.index.TestTermVectorsWriter.testBadSegment
|
1 PASS | |
| 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 | /** Normalizes tokens extracted with {@link StandardTokenizer}. */ | |
| 22 | ||
| 23 | public final class StandardFilter extends TokenFilter | |
| 24 | implements StandardTokenizerConstants { | |
| 25 | ||
| 26 | ||
| 27 | /** Construct filtering <i>in</i>. */ | |
| 28 | 6517 |
public StandardFilter(TokenStream in) { |
| 29 | 6517 | super(in); |
| 30 | } | |
| 31 | ||
| 32 | private static final String APOSTROPHE_TYPE = tokenImage[APOSTROPHE]; | |
| 33 | private static final String ACRONYM_TYPE = tokenImage[ACRONYM]; | |
| 34 | ||
| 35 | /** Returns the next token in the stream, or null at EOS. | |
| 36 | * <p>Removes <tt>'s</tt> from the end of words. | |
| 37 | * <p>Removes dots from acronyms. | |
| 38 | */ | |
| 39 | 13674 |
public final org.apache.lucene.analysis.Token next() throws java.io.IOException { |
| 40 | 13674 | org.apache.lucene.analysis.Token t = input.next(); |
| 41 | ||
| 42 | 13674 | if (t == null) |
| 43 | 6517 | return null; |
| 44 | ||
| 45 | 7157 | String text = t.termText(); |
| 46 | 7157 | String type = t.type(); |
| 47 | ||
| 48 | 7157 | if (type == APOSTROPHE_TYPE && // remove 's |
| 49 | (text.endsWith("'s") || text.endsWith("'S"))) { | |
| 50 | 3 | return new org.apache.lucene.analysis.Token |
| 51 | (text.substring(0,text.length()-2), | |
| 52 | t.startOffset(), t.endOffset(), type); | |
| 53 | ||
| 54 | 7154 | } else if (type == ACRONYM_TYPE) { // remove dots |
| 55 | 1 | StringBuffer trimmed = new StringBuffer(); |
| 56 | 7 | for (int i = 0; i < text.length(); i++) { |
| 57 | 6 | char c = text.charAt(i); |
| 58 | 6 | if (c != '.') |
| 59 | 3 | trimmed.append(c); |
| 60 | } | |
| 61 | 1 | return new org.apache.lucene.analysis.Token |
| 62 | (trimmed.toString(), t.startOffset(), t.endOffset(), type); | |
| 63 | ||
| 64 | } else { | |
| 65 | 7153 | return t; |
| 66 | } | |
| 67 | } | |
| 68 | } | |
|
||||||||||