Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Updates to spike exploring how to write the analyzer, and then update…
…s to the analyzer that are the result of the spike explorations.
- Loading branch information
Showing
2 changed files
with
41 additions
and
3 deletions.
There are no files selected for viewing
26 changes: 26 additions & 0 deletions
26
src/main/groovy/org/fdl/lucene/analyzer/CongressionalBillAnalyzer.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
package org.fdl.lucene.analyzer; | ||
|
||
import java.io.Reader; | ||
|
||
import org.apache.lucene.analysis.Analyzer; | ||
import org.apache.lucene.analysis.CharStream; | ||
import org.apache.lucene.analysis.LowerCaseFilter; | ||
import org.apache.lucene.analysis.MappingCharFilter; | ||
import org.apache.lucene.analysis.NormalizeCharMap; | ||
import org.apache.lucene.analysis.TokenStream; | ||
import org.apache.lucene.analysis.standard.StandardFilter; | ||
import org.apache.lucene.analysis.standard.StandardTokenizer; | ||
import org.apache.lucene.util.Version; | ||
|
||
public class CongressionalBillAnalyzer extends Analyzer | ||
{ | ||
@Override | ||
public TokenStream tokenStream(String fieldName, Reader reader) | ||
{ | ||
NormalizeCharMap charMap = new NormalizeCharMap(); | ||
charMap.add("/", " "); | ||
CharStream cstream = new MappingCharFilter(charMap, reader); | ||
TokenStream tokenStream = new StandardFilter(Version.LUCENE_30, new StandardTokenizer(Version.LUCENE_30, cstream)); | ||
return new CongressionalBillFilter(new LowerCaseFilter(Version.LUCENE_30, tokenStream)); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters