Class Utility
- java.lang.Object
-
- org.apache.lucene.analysis.cn.smart.Utility
-
public class Utility extends Object
SmartChineseAnalyzer utility constants and methods- WARNING: This API is experimental and might change in incompatible ways in the next release.
-
-
Field Summary
Fields Modifier and Type Field Description static char[]COMMON_DELIMITERDelimiters will be filtered to this character bySegTokenFilterstatic char[]END_CHAR_ARRAYstatic intMAX_FREQUENCEMaximum bigram frequency (used in the smoothing function).static char[]NUMBER_CHAR_ARRAYstatic StringSPACESSpace-like characters that need to be skipped: such as space, tab, newline, carriage return.static char[]START_CHAR_ARRAYstatic char[]STRING_CHAR_ARRAY
-
Constructor Summary
Constructors Constructor Description Utility()
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static intcompareArray(char[] larray, int lstartIndex, char[] rarray, int rstartIndex)compare two arrays starting at the specified offsets.static intcompareArrayByPrefix(char[] shortArray, int shortIndex, char[] longArray, int longIndex)Compare two arrays, starting at the specified offsets, but treating shortArray as a prefix to longArray.static intgetCharType(char ch)Return the internalCharTypeconstant of a given character.
-
-
-
Field Detail
-
STRING_CHAR_ARRAY
public static final char[] STRING_CHAR_ARRAY
-
NUMBER_CHAR_ARRAY
public static final char[] NUMBER_CHAR_ARRAY
-
START_CHAR_ARRAY
public static final char[] START_CHAR_ARRAY
-
END_CHAR_ARRAY
public static final char[] END_CHAR_ARRAY
-
COMMON_DELIMITER
public static final char[] COMMON_DELIMITER
Delimiters will be filtered to this character bySegTokenFilter
-
SPACES
public static final String SPACES
Space-like characters that need to be skipped: such as space, tab, newline, carriage return.- See Also:
- Constant Field Values
-
MAX_FREQUENCE
public static final int MAX_FREQUENCE
Maximum bigram frequency (used in the smoothing function).- See Also:
- Constant Field Values
-
-
Method Detail
-
compareArray
public static int compareArray(char[] larray, int lstartIndex, char[] rarray, int rstartIndex)compare two arrays starting at the specified offsets.- Parameters:
larray- left arraylstartIndex- start offset into larrayrarray- right arrayrstartIndex- start offset into rarray- Returns:
- 0 if the arrays are equal,1 if larray > rarray, -1 if larray < rarray
-
compareArrayByPrefix
public static int compareArrayByPrefix(char[] shortArray, int shortIndex, char[] longArray, int longIndex)Compare two arrays, starting at the specified offsets, but treating shortArray as a prefix to longArray. As long as shortArray is a prefix of longArray, return 0. Otherwise, behave ascompareArray(char[], int, char[], int)- Parameters:
shortArray- prefix arrayshortIndex- offset into shortArraylongArray- long array (word)longIndex- offset into longArray- Returns:
- 0 if shortArray is a prefix of longArray, otherwise act as
compareArray(char[], int, char[], int)
-
-