mirror of https://github.com/apache/lucene.git
LUCENE-1126: modify JFlex grammar to fallback to the JRE's Character.isDigit() (using :digit:) and Character.isLetter() (using :letter:) to define inclusion of unicode characters
git-svn-id: https://svn.apache.org/repos/asf/lucene/java/trunk@692211 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
parent
f262830a7f
commit
9e88734177
|
@ -1,4 +1,4 @@
|
|||
/* The following code was generated by JFlex 1.4.1 on 4/15/08 4:31 AM */
|
||||
/* The following code was generated by JFlex 1.4.1 on 9/4/08 6:49 PM */
|
||||
|
||||
package org.apache.lucene.analysis.standard;
|
||||
|
||||
|
@ -19,14 +19,24 @@ package org.apache.lucene.analysis.standard;
|
|||
* limitations under the License.
|
||||
*/
|
||||
|
||||
/*
|
||||
|
||||
NOTE: if you change this file and need to regenerate the tokenizer,
|
||||
remember to use JRE 1.4 when running jflex (before Lucene 3.0).
|
||||
This grammar now uses constructs (eg :digit:) whose meaning can
|
||||
vary according to the JRE used to run jflex. See
|
||||
https://issues.apache.org/jira/browse/LUCENE-1126 for details
|
||||
|
||||
*/
|
||||
|
||||
import org.apache.lucene.analysis.Token;
|
||||
|
||||
|
||||
/**
|
||||
* This class is a scanner generated by
|
||||
* <a href="http://www.jflex.de/">JFlex</a> 1.4.1
|
||||
* on 4/15/08 4:31 AM from the specification file
|
||||
* <tt>/mnt2/mike/src/lucene.clean/src/java/org/apache/lucene/analysis/standard/StandardTokenizerImpl.jflex</tt>
|
||||
* on 9/4/08 6:49 PM from the specification file
|
||||
* <tt>/tango/mike/src/lucene.standarddigit/src/java/org/apache/lucene/analysis/standard/StandardTokenizerImpl.jflex</tt>
|
||||
*/
|
||||
class StandardTokenizerImpl {
|
||||
|
||||
|
@ -43,14 +53,64 @@ class StandardTokenizerImpl {
|
|||
* Translates characters to character classes
|
||||
*/
|
||||
private static final String ZZ_CMAP_PACKED =
|
||||
"\11\0\1\0\1\16\1\0\1\0\1\15\22\0\1\0\5\0\1\3"+
|
||||
"\1\1\4\0\1\7\1\5\1\2\1\7\12\11\6\0\1\4\32\10"+
|
||||
"\4\0\1\6\1\0\32\10\105\0\27\10\1\0\37\10\1\0\u0568\10"+
|
||||
"\12\12\206\10\12\12\u026c\10\12\12\166\10\12\12\166\10\12\12\166\10"+
|
||||
"\12\12\166\10\12\12\167\10\11\12\166\10\12\12\166\10\12\12\166\10"+
|
||||
"\12\12\340\10\12\12\166\10\12\12\u0166\10\12\12\266\10\u0100\10\u0e00\10"+
|
||||
"\u1040\0\u0150\14\140\0\20\14\u0100\0\200\14\200\0\u19c0\14\100\0\u5200\14"+
|
||||
"\u0c00\0\u2bb0\13\u2150\0\u0200\14\u0465\0\73\14\75\10\43\0";
|
||||
"\11\0\1\0\1\15\1\0\1\0\1\14\22\0\1\0\5\0\1\5"+
|
||||
"\1\3\4\0\1\11\1\7\1\4\1\11\12\2\6\0\1\6\32\12"+
|
||||
"\4\0\1\10\1\0\32\12\57\0\1\12\12\0\1\12\4\0\1\12"+
|
||||
"\5\0\27\12\1\0\37\12\1\0\u0128\12\2\0\22\12\34\0\136\12"+
|
||||
"\2\0\11\12\2\0\7\12\16\0\2\12\16\0\5\12\11\0\1\12"+
|
||||
"\213\0\1\12\13\0\1\12\1\0\3\12\1\0\1\12\1\0\24\12"+
|
||||
"\1\0\54\12\1\0\10\12\2\0\32\12\14\0\202\12\12\0\71\12"+
|
||||
"\2\0\2\12\2\0\2\12\3\0\46\12\2\0\2\12\67\0\46\12"+
|
||||
"\2\0\1\12\7\0\47\12\110\0\33\12\5\0\3\12\56\0\32\12"+
|
||||
"\5\0\13\12\25\0\12\2\7\0\143\12\1\0\1\12\17\0\2\12"+
|
||||
"\11\0\12\2\3\12\23\0\1\12\1\0\33\12\123\0\46\12\u015f\0"+
|
||||
"\65\12\3\0\1\12\22\0\1\12\7\0\12\12\4\0\12\2\25\0"+
|
||||
"\10\12\2\0\2\12\2\0\26\12\1\0\7\12\1\0\1\12\3\0"+
|
||||
"\4\12\42\0\2\12\1\0\3\12\4\0\12\2\2\12\23\0\6\12"+
|
||||
"\4\0\2\12\2\0\26\12\1\0\7\12\1\0\2\12\1\0\2\12"+
|
||||
"\1\0\2\12\37\0\4\12\1\0\1\12\7\0\12\2\2\0\3\12"+
|
||||
"\20\0\7\12\1\0\1\12\1\0\3\12\1\0\26\12\1\0\7\12"+
|
||||
"\1\0\2\12\1\0\5\12\3\0\1\12\22\0\1\12\17\0\1\12"+
|
||||
"\5\0\12\2\25\0\10\12\2\0\2\12\2\0\26\12\1\0\7\12"+
|
||||
"\1\0\2\12\2\0\4\12\3\0\1\12\36\0\2\12\1\0\3\12"+
|
||||
"\4\0\12\2\25\0\6\12\3\0\3\12\1\0\4\12\3\0\2\12"+
|
||||
"\1\0\1\12\1\0\2\12\3\0\2\12\3\0\3\12\3\0\10\12"+
|
||||
"\1\0\3\12\55\0\11\2\25\0\10\12\1\0\3\12\1\0\27\12"+
|
||||
"\1\0\12\12\1\0\5\12\46\0\2\12\4\0\12\2\25\0\10\12"+
|
||||
"\1\0\3\12\1\0\27\12\1\0\12\12\1\0\5\12\44\0\1\12"+
|
||||
"\1\0\2\12\4\0\12\2\25\0\10\12\1\0\3\12\1\0\27\12"+
|
||||
"\1\0\20\12\46\0\2\12\4\0\12\2\25\0\22\12\3\0\30\12"+
|
||||
"\1\0\11\12\1\0\1\12\2\0\7\12\71\0\1\1\60\12\1\1"+
|
||||
"\2\12\14\1\7\12\11\1\12\2\47\0\2\12\1\0\1\12\2\0"+
|
||||
"\2\12\1\0\1\12\2\0\1\12\6\0\4\12\1\0\7\12\1\0"+
|
||||
"\3\12\1\0\1\12\1\0\1\12\2\0\2\12\1\0\4\12\1\0"+
|
||||
"\2\12\11\0\1\12\2\0\5\12\1\0\1\12\11\0\12\2\2\0"+
|
||||
"\2\12\42\0\1\12\37\0\12\2\26\0\10\12\1\0\42\12\35\0"+
|
||||
"\4\12\164\0\42\12\1\0\5\12\1\0\2\12\25\0\12\2\6\0"+
|
||||
"\6\12\112\0\46\12\12\0\47\12\11\0\132\12\5\0\104\12\5\0"+
|
||||
"\122\12\6\0\7\12\1\0\77\12\1\0\1\12\1\0\4\12\2\0"+
|
||||
"\7\12\1\0\1\12\1\0\4\12\2\0\47\12\1\0\1\12\1\0"+
|
||||
"\4\12\2\0\37\12\1\0\1\12\1\0\4\12\2\0\7\12\1\0"+
|
||||
"\1\12\1\0\4\12\2\0\7\12\1\0\7\12\1\0\27\12\1\0"+
|
||||
"\37\12\1\0\1\12\1\0\4\12\2\0\7\12\1\0\47\12\1\0"+
|
||||
"\23\12\16\0\11\2\56\0\125\12\14\0\u026c\12\2\0\10\12\12\0"+
|
||||
"\32\12\5\0\113\12\225\0\64\12\54\0\12\2\46\0\12\2\6\0"+
|
||||
"\130\12\10\0\51\12\u0557\0\234\12\4\0\132\12\6\0\26\12\2\0"+
|
||||
"\6\12\2\0\46\12\2\0\6\12\2\0\10\12\1\0\1\12\1\0"+
|
||||
"\1\12\1\0\1\12\1\0\37\12\2\0\65\12\1\0\7\12\1\0"+
|
||||
"\1\12\3\0\3\12\1\0\7\12\3\0\4\12\2\0\6\12\4\0"+
|
||||
"\15\12\5\0\3\12\1\0\7\12\202\0\1\12\202\0\1\12\4\0"+
|
||||
"\1\12\2\0\12\12\1\0\1\12\3\0\5\12\6\0\1\12\1\0"+
|
||||
"\1\12\1\0\1\12\1\0\4\12\1\0\3\12\1\0\7\12\u0ecb\0"+
|
||||
"\2\12\52\0\5\12\12\0\1\13\124\13\10\13\2\13\2\13\132\13"+
|
||||
"\1\13\3\13\6\13\50\13\3\13\1\0\136\12\21\0\30\12\70\0"+
|
||||
"\20\13\u0100\0\200\13\200\0\u19b6\13\12\13\100\0\u51a6\13\132\13\u048d\12"+
|
||||
"\u0773\0\u2ba4\12\u215c\0\u012e\13\322\13\7\12\14\0\5\12\5\0\1\12"+
|
||||
"\1\0\12\12\1\0\15\12\1\0\5\12\1\0\1\12\1\0\2\12"+
|
||||
"\1\0\2\12\1\0\154\12\41\0\u016b\12\22\0\100\12\2\0\66\12"+
|
||||
"\50\0\14\12\164\0\3\12\1\0\1\12\1\0\207\12\23\0\12\2"+
|
||||
"\7\0\32\12\6\0\32\12\12\0\1\13\72\13\37\12\3\0\6\12"+
|
||||
"\2\0\6\12\2\0\6\12\2\0\3\12\43\0";
|
||||
|
||||
/**
|
||||
* Translates characters to character classes
|
||||
|
@ -63,13 +123,13 @@ class StandardTokenizerImpl {
|
|||
private static final int [] ZZ_ACTION = zzUnpackAction();
|
||||
|
||||
private static final String ZZ_ACTION_PACKED_0 =
|
||||
"\1\0\1\1\4\2\1\3\1\1\6\0\2\2\6\0"+
|
||||
"\1\4\4\5\2\6\2\0\1\7\1\0\1\7\3\5"+
|
||||
"\6\7\3\5\1\10\1\0\1\11\2\0\1\10\1\11"+
|
||||
"\1\0\2\11\2\10\2\5\1\12";
|
||||
"\1\0\1\1\3\2\1\3\1\1\13\0\1\2\3\4"+
|
||||
"\2\0\1\5\1\0\1\5\3\4\6\5\1\6\1\4"+
|
||||
"\2\7\1\10\1\0\1\10\3\0\2\10\1\11\1\12"+
|
||||
"\1\4";
|
||||
|
||||
private static int [] zzUnpackAction() {
|
||||
int [] result = new int[61];
|
||||
int [] result = new int[51];
|
||||
int offset = 0;
|
||||
offset = zzUnpackAction(ZZ_ACTION_PACKED_0, offset, result);
|
||||
return result;
|
||||
|
@ -94,17 +154,16 @@ class StandardTokenizerImpl {
|
|||
private static final int [] ZZ_ROWMAP = zzUnpackRowMap();
|
||||
|
||||
private static final String ZZ_ROWMAP_PACKED_0 =
|
||||
"\0\0\0\17\0\36\0\55\0\74\0\113\0\17\0\132"+
|
||||
"\0\151\0\170\0\207\0\226\0\245\0\264\0\303\0\322"+
|
||||
"\0\341\0\360\0\377\0\u010e\0\u011d\0\u012c\0\u013b\0\u014a"+
|
||||
"\0\u0159\0\u0168\0\u0177\0\207\0\u0186\0\u0195\0\u01a4\0\u01b3"+
|
||||
"\0\u01c2\0\u01d1\0\u01e0\0\u01ef\0\u01fe\0\u020d\0\u021c\0\u022b"+
|
||||
"\0\u023a\0\u0249\0\u0258\0\u0267\0\u0276\0\u0285\0\u0294\0\u02a3"+
|
||||
"\0\u02b2\0\u02c1\0\u02d0\0\u02df\0\u02ee\0\u02fd\0\u012c\0\341"+
|
||||
"\0\170\0\u011d\0\u030c\0\u031b\0\u032a";
|
||||
"\0\0\0\16\0\34\0\52\0\70\0\16\0\106\0\124"+
|
||||
"\0\142\0\160\0\176\0\214\0\232\0\250\0\266\0\304"+
|
||||
"\0\322\0\340\0\356\0\374\0\u010a\0\u0118\0\u0126\0\u0134"+
|
||||
"\0\u0142\0\u0150\0\u015e\0\u016c\0\u017a\0\u0188\0\u0196\0\u01a4"+
|
||||
"\0\u01b2\0\u01c0\0\u01ce\0\u01dc\0\u01ea\0\u01f8\0\322\0\u0206"+
|
||||
"\0\u0214\0\u0222\0\u0230\0\u023e\0\u024c\0\u025a\0\124\0\214"+
|
||||
"\0\u0268\0\u0276\0\u0284";
|
||||
|
||||
private static int [] zzUnpackRowMap() {
|
||||
int [] result = new int[61];
|
||||
int [] result = new int[51];
|
||||
int offset = 0;
|
||||
offset = zzUnpackRowMap(ZZ_ROWMAP_PACKED_0, offset, result);
|
||||
return result;
|
||||
|
@ -127,51 +186,49 @@ class StandardTokenizerImpl {
|
|||
private static final int [] ZZ_TRANS = zzUnpackTrans();
|
||||
|
||||
private static final String ZZ_TRANS_PACKED_0 =
|
||||
"\10\2\1\3\1\4\1\5\1\6\1\7\1\10\1\2"+
|
||||
"\20\0\1\11\1\12\1\13\1\14\2\15\1\16\1\17"+
|
||||
"\1\4\1\20\1\6\5\0\1\21\1\0\1\22\2\23"+
|
||||
"\1\24\3\4\1\6\4\0\1\11\1\25\1\13\1\14"+
|
||||
"\2\23\1\24\1\20\1\4\1\20\1\6\5\0\1\26"+
|
||||
"\1\0\1\22\2\15\1\16\4\6\21\0\1\2\10\0"+
|
||||
"\1\27\1\0\1\27\14\0\1\30\1\31\1\32\1\33"+
|
||||
"\13\0\1\34\1\0\1\34\14\0\1\35\1\36\1\35"+
|
||||
"\1\36\13\0\1\37\2\40\1\41\13\0\1\16\2\42"+
|
||||
"\5\0\1\11\1\26\1\13\1\14\2\15\1\16\1\17"+
|
||||
"\1\4\1\20\1\6\4\0\1\11\1\21\1\13\1\14"+
|
||||
"\2\23\1\24\1\20\1\4\1\20\1\6\13\0\1\43"+
|
||||
"\2\44\1\45\13\0\4\36\13\0\1\46\2\47\1\50"+
|
||||
"\13\0\1\51\2\52\1\53\13\0\1\54\1\44\1\55"+
|
||||
"\1\45\13\0\1\56\2\31\1\33\4\0\1\11\6\0"+
|
||||
"\1\27\1\0\1\27\6\0\1\57\1\0\1\22\2\60"+
|
||||
"\1\0\1\56\2\31\1\33\5\0\1\61\1\0\1\22"+
|
||||
"\2\62\1\63\3\31\1\33\5\0\1\64\1\0\1\22"+
|
||||
"\2\62\1\63\3\31\1\33\5\0\1\65\1\0\1\22"+
|
||||
"\2\60\1\0\4\33\5\0\1\66\2\0\1\66\2\0"+
|
||||
"\1\35\1\36\1\35\1\36\5\0\1\66\2\0\1\66"+
|
||||
"\2\0\4\36\5\0\1\60\1\0\1\22\2\60\1\0"+
|
||||
"\1\37\2\40\1\41\5\0\1\62\1\0\1\22\2\62"+
|
||||
"\1\63\3\40\1\41\5\0\1\60\1\0\1\22\2\60"+
|
||||
"\1\0\4\41\5\0\1\63\2\0\3\63\3\42\6\0"+
|
||||
"\1\67\1\0\1\22\2\15\1\16\1\43\2\44\1\45"+
|
||||
"\5\0\1\70\1\0\1\22\2\23\1\24\3\44\1\45"+
|
||||
"\5\0\1\67\1\0\1\22\2\15\1\16\4\45\5\0"+
|
||||
"\1\15\1\0\1\22\2\15\1\16\1\46\2\47\1\50"+
|
||||
"\5\0\1\23\1\0\1\22\2\23\1\24\3\47\1\50"+
|
||||
"\5\0\1\15\1\0\1\22\2\15\1\16\4\50\5\0"+
|
||||
"\1\16\2\0\3\16\1\51\2\52\1\53\5\0\1\24"+
|
||||
"\2\0\3\24\3\52\1\53\5\0\1\16\2\0\3\16"+
|
||||
"\4\53\5\0\1\71\1\0\1\22\2\15\1\16\1\43"+
|
||||
"\2\44\1\45\5\0\1\72\1\0\1\22\2\23\1\24"+
|
||||
"\3\44\1\45\5\0\1\65\1\0\1\22\2\60\1\0"+
|
||||
"\1\56\2\31\1\33\13\0\1\73\1\33\1\73\1\33"+
|
||||
"\13\0\4\41\13\0\4\45\13\0\4\50\13\0\4\53"+
|
||||
"\13\0\1\74\1\45\1\74\1\45\13\0\4\33\13\0"+
|
||||
"\4\75\5\0\1\57\1\0\1\22\2\60\1\0\4\33"+
|
||||
"\5\0\1\71\1\0\1\22\2\15\1\16\4\45\5\0"+
|
||||
"\1\66\2\0\1\66\2\0\4\75\3\0";
|
||||
"\1\2\1\3\1\4\7\2\1\5\1\6\1\7\1\2"+
|
||||
"\17\0\2\3\1\0\1\10\1\0\1\11\2\12\1\13"+
|
||||
"\1\3\4\0\1\3\1\4\1\0\1\14\1\0\1\11"+
|
||||
"\2\15\1\16\1\4\4\0\1\3\1\4\1\17\1\20"+
|
||||
"\1\21\1\22\2\12\1\13\1\23\20\0\1\2\1\0"+
|
||||
"\1\24\1\25\7\0\1\26\4\0\2\27\7\0\1\27"+
|
||||
"\4\0\1\30\1\31\7\0\1\32\5\0\1\33\7\0"+
|
||||
"\1\13\4\0\1\34\1\35\7\0\1\36\4\0\1\37"+
|
||||
"\1\40\7\0\1\41\4\0\1\42\1\43\7\0\1\44"+
|
||||
"\15\0\1\45\4\0\1\24\1\25\7\0\1\46\15\0"+
|
||||
"\1\47\4\0\2\27\7\0\1\50\4\0\1\3\1\4"+
|
||||
"\1\17\1\10\1\21\1\22\2\12\1\13\1\23\4\0"+
|
||||
"\2\24\1\0\1\51\1\0\1\11\2\52\1\0\1\24"+
|
||||
"\4\0\1\24\1\25\1\0\1\53\1\0\1\11\2\54"+
|
||||
"\1\55\1\25\4\0\1\24\1\25\1\0\1\51\1\0"+
|
||||
"\1\11\2\52\1\0\1\26\4\0\2\27\1\0\1\56"+
|
||||
"\2\0\1\56\2\0\1\27\4\0\2\30\1\0\1\52"+
|
||||
"\1\0\1\11\2\52\1\0\1\30\4\0\1\30\1\31"+
|
||||
"\1\0\1\54\1\0\1\11\2\54\1\55\1\31\4\0"+
|
||||
"\1\30\1\31\1\0\1\52\1\0\1\11\2\52\1\0"+
|
||||
"\1\32\5\0\1\33\1\0\1\55\2\0\3\55\1\33"+
|
||||
"\4\0\2\34\1\0\1\57\1\0\1\11\2\12\1\13"+
|
||||
"\1\34\4\0\1\34\1\35\1\0\1\60\1\0\1\11"+
|
||||
"\2\15\1\16\1\35\4\0\1\34\1\35\1\0\1\57"+
|
||||
"\1\0\1\11\2\12\1\13\1\36\4\0\2\37\1\0"+
|
||||
"\1\12\1\0\1\11\2\12\1\13\1\37\4\0\1\37"+
|
||||
"\1\40\1\0\1\15\1\0\1\11\2\15\1\16\1\40"+
|
||||
"\4\0\1\37\1\40\1\0\1\12\1\0\1\11\2\12"+
|
||||
"\1\13\1\41\4\0\2\42\1\0\1\13\2\0\3\13"+
|
||||
"\1\42\4\0\1\42\1\43\1\0\1\16\2\0\3\16"+
|
||||
"\1\43\4\0\1\42\1\43\1\0\1\13\2\0\3\13"+
|
||||
"\1\44\6\0\1\17\6\0\1\45\4\0\1\24\1\25"+
|
||||
"\1\0\1\61\1\0\1\11\2\52\1\0\1\26\4\0"+
|
||||
"\2\27\1\0\1\56\2\0\1\56\2\0\1\50\4\0"+
|
||||
"\2\24\7\0\1\24\4\0\2\30\7\0\1\30\4\0"+
|
||||
"\2\34\7\0\1\34\4\0\2\37\7\0\1\37\4\0"+
|
||||
"\2\42\7\0\1\42\4\0\2\62\7\0\1\62\4\0"+
|
||||
"\2\24\7\0\1\63\4\0\2\62\1\0\1\56\2\0"+
|
||||
"\1\56\2\0\1\62\4\0\2\24\1\0\1\61\1\0"+
|
||||
"\1\11\2\52\1\0\1\24\3\0";
|
||||
|
||||
private static int [] zzUnpackTrans() {
|
||||
int [] result = new int[825];
|
||||
int [] result = new int[658];
|
||||
int offset = 0;
|
||||
offset = zzUnpackTrans(ZZ_TRANS_PACKED_0, offset, result);
|
||||
return result;
|
||||
|
@ -209,12 +266,11 @@ class StandardTokenizerImpl {
|
|||
private static final int [] ZZ_ATTRIBUTE = zzUnpackAttribute();
|
||||
|
||||
private static final String ZZ_ATTRIBUTE_PACKED_0 =
|
||||
"\1\0\1\11\4\1\1\11\1\1\6\0\2\1\6\0"+
|
||||
"\7\1\2\0\1\1\1\0\16\1\1\0\1\1\2\0"+
|
||||
"\2\1\1\0\7\1";
|
||||
"\1\0\1\11\3\1\1\11\1\1\13\0\4\1\2\0"+
|
||||
"\1\1\1\0\17\1\1\0\1\1\3\0\5\1";
|
||||
|
||||
private static int [] zzUnpackAttribute() {
|
||||
int [] result = new int[61];
|
||||
int [] result = new int[51];
|
||||
int offset = 0;
|
||||
offset = zzUnpackAttribute(ZZ_ATTRIBUTE_PACKED_0, offset, result);
|
||||
return result;
|
||||
|
@ -343,7 +399,7 @@ final void getText(Token t) {
|
|||
char [] map = new char[0x10000];
|
||||
int i = 0; /* index in packed string */
|
||||
int j = 0; /* index in unpacked array */
|
||||
while (i < 156) {
|
||||
while (i < 1154) {
|
||||
int count = packed.charAt(i++);
|
||||
char value = packed.charAt(i++);
|
||||
do map[j++] = value; while (--count > 0);
|
||||
|
@ -602,23 +658,23 @@ final void getText(Token t) {
|
|||
zzMarkedPos = zzMarkedPosL;
|
||||
|
||||
switch (zzAction < 0 ? zzAction : ZZ_ACTION[zzAction]) {
|
||||
case 5:
|
||||
case 4:
|
||||
{ return HOST;
|
||||
}
|
||||
case 11: break;
|
||||
case 9:
|
||||
{ return ACRONYM_DEP;
|
||||
{ return ACRONYM;
|
||||
}
|
||||
case 12: break;
|
||||
case 8:
|
||||
{ return ACRONYM;
|
||||
{ return ACRONYM_DEP;
|
||||
}
|
||||
case 13: break;
|
||||
case 1:
|
||||
{ /* ignore */
|
||||
}
|
||||
case 14: break;
|
||||
case 7:
|
||||
case 5:
|
||||
{ return NUM;
|
||||
}
|
||||
case 15: break;
|
||||
|
@ -630,11 +686,11 @@ final void getText(Token t) {
|
|||
{ return ALPHANUM;
|
||||
}
|
||||
case 17: break;
|
||||
case 6:
|
||||
case 7:
|
||||
{ return COMPANY;
|
||||
}
|
||||
case 18: break;
|
||||
case 4:
|
||||
case 6:
|
||||
{ return APOSTROPHE;
|
||||
}
|
||||
case 19: break;
|
||||
|
|
|
@ -17,6 +17,17 @@ package org.apache.lucene.analysis.standard;
|
|||
* limitations under the License.
|
||||
*/
|
||||
|
||||
/*
|
||||
|
||||
NOTE: if you change StandardTokenizerImpl.jflex and need to regenerate
|
||||
the tokenizer, remember to use JRE 1.4 to run jflex (before
|
||||
Lucene 3.0). This grammar now uses constructs (eg :digit:,
|
||||
:letter:) whose meaning can vary according to the JRE used to
|
||||
run jflex. See
|
||||
https://issues.apache.org/jira/browse/LUCENE-1126 for details.
|
||||
|
||||
*/
|
||||
|
||||
import org.apache.lucene.analysis.Token;
|
||||
|
||||
%%
|
||||
|
@ -60,8 +71,10 @@ final void getText(Token t) {
|
|||
}
|
||||
%}
|
||||
|
||||
// basic word: a sequence of digits & letters
|
||||
ALPHANUM = ({LETTER}|{DIGIT}|{KOREAN})+
|
||||
THAI = [\u0E00-\u0E59]
|
||||
|
||||
// basic word: a sequence of digits & letters (includes Thai to enable ThaiAnalyzer to function)
|
||||
ALPHANUM = ({LETTER}|{THAI}|[:digit:])+
|
||||
|
||||
// internal apostrophes: O'Reilly, you're, O'Reilly's
|
||||
// use a post-filter to remove possesives
|
||||
|
@ -95,22 +108,15 @@ NUM = ({ALPHANUM} {P} {HAS_DIGIT}
|
|||
P = ("_"|"-"|"/"|"."|",")
|
||||
|
||||
// at least one digit
|
||||
HAS_DIGIT =
|
||||
({LETTER}|{DIGIT})*
|
||||
{DIGIT}
|
||||
({LETTER}|{DIGIT})*
|
||||
HAS_DIGIT = ({LETTER}|[:digit:])* [:digit:] ({LETTER}|[:digit:])*
|
||||
|
||||
ALPHA = ({LETTER})+
|
||||
|
||||
// From the JFlex manual: "the expression that matches everything of <a> not matched by <b> is !(!<a>|<b>)"
|
||||
LETTER = !(![:letter:]|{CJ})
|
||||
|
||||
LETTER = [\u0041-\u005a\u0061-\u007a\u00c0-\u00d6\u00d8-\u00f6\u00f8-\u00ff\u0100-\u1fff\uffa0-\uffdc]
|
||||
|
||||
DIGIT = [\u0030-\u0039\u0660-\u0669\u06f0-\u06f9\u0966-\u096f\u09e6-\u09ef\u0a66-\u0a6f\u0ae6-\u0aef\u0b66-\u0b6f\u0be7-\u0bef\u0c66-\u0c6f\u0ce6-\u0cef\u0d66-\u0d6f\u0e50-\u0e59\u0ed0-\u0ed9\u1040-\u1049]
|
||||
|
||||
KOREAN = [\uac00-\ud7af\u1100-\u11ff]
|
||||
|
||||
// Chinese, Japanese
|
||||
CJ = [\u3040-\u318f\u3100-\u312f\u3040-\u309F\u30A0-\u30FF\u31F0-\u31FF\u3300-\u337f\u3400-\u4dbf\u4e00-\u9fff\uf900-\ufaff\uff65-\uff9f]
|
||||
// Chinese and Japanese (but NOT Korean, which is included in [:letter:])
|
||||
CJ = [\u3100-\u312f\u3040-\u309F\u30A0-\u30FF\u31F0-\u31FF\u3300-\u337f\u3400-\u4dbf\u4e00-\u9fff\uf900-\ufaff\uff65-\uff9f]
|
||||
|
||||
WHITESPACE = \r\n | [ \r\n\t\f]
|
||||
|
||||
|
|
Loading…
Reference in New Issue