public final class AnalyzerUtils extends Object
Taken and modified from Lucene in Action.
Modifier and Type | Method and Description |
---|---|
static void |
displayTokens(Analyzer analyzer,
String field,
String text) |
static void |
displayTokensWithFullDetails(Analyzer analyzer,
String field,
String text) |
static void |
displayTokensWithPositions(Analyzer analyzer,
String field,
String text,
PrintStream printTo)
Utility to print out the tokens generated by a specific Analyzer on an example text.
|
static String |
getTermText(Token token) |
static List<String> |
tokenizedTermValues(Analyzer analyzer,
String field,
String text) |
static Token[] |
tokensFromAnalysis(Analyzer analyzer,
String field,
String text) |
public static final Log log
public static List<String> tokenizedTermValues(Analyzer analyzer, String field, String text) throws IOException
IOException
public static Token[] tokensFromAnalysis(Analyzer analyzer, String field, String text) throws IOException
IOException
public static void displayTokens(Analyzer analyzer, String field, String text) throws IOException
IOException
public static void displayTokensWithPositions(Analyzer analyzer, String field, String text, PrintStream printTo) throws IOException
analyzer
- the Analyzer to usefield
- the name of the field: might affect the Analyzer behaviourtext
- some sample inputprintTo
- Human readable text will be printed to this output. Passing System.out
might be a good idea.IOException
- if an I/O error occurspublic static void displayTokensWithFullDetails(Analyzer analyzer, String field, String text) throws IOException
IOException
Copyright © 2006-2017 Red Hat, Inc. All Rights Reserved