/*
* Copyright 2011-2013 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
/* The following code was generated by JFlex 1.4.1 on 12. 1. 3 오전 3:51 */
package org.apache.lucene.analysis.kr;
import org.apache.lucene.analysis.tokenattributes.CharTermAttribute;
/**
* This class is a scanner generated by
* <a href="http://www.jflex.de/">JFlex</a> 1.4.1
* on 12. 1. 3 오전 3:51 from the specification file
* <tt>D:/eclipse-workspace/search/kr.analyzer.3x/src/org/apache/lucene/analysis/kr/KoreanTokenizerImpl.jflex</tt>
*/
class KoreanTokenizerImpl {
/** This character denotes the end of file */
public static final int YYEOF = -1;
/** initial size of the lookahead buffer */
private static final int ZZ_BUFFERSIZE = 16384;
/** lexical states */
public static final int YYINITIAL = 0;
/** Translates characters to character classes */
private static final String ZZ_CMAP_PACKED =
"\11\0\1\0\1\20\1\0\1\0\1\17\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\14\u0e00\10" +
"\u1040\0\u0150\16\140\0\20\16\u0100\0\200\16\200\0\u19c0\15\100\0\u5200\15" +
"\u0c00\0\u2bb0\13\u2150\0\u0200\15\u0465\0\73\16\75\10\43\0";
/** Translates characters to character classes */
private static final char[] ZZ_CMAP = zzUnpackCMap(ZZ_CMAP_PACKED);
/** Translates DFA states to action switch labels. */
private static final int[] ZZ_ACTION = zzUnpackAction();
private static final String ZZ_ACTION_PACKED_0 =
"\1\0\2\1\3\2\2\3\1\4\1\5\1\1\1\6" +
"\6\0\3\2\1\3\1\6\3\0\1\2\1\3\1\6" +
"\1\2\4\3\1\4\3\0\1\3\1\7\3\10\2\11" +
"\2\0\2\6\2\0\2\10\1\3\4\6\1\0\2\10" +
"\1\3\4\0\2\3\1\12\1\0\1\10\1\13\2\0" +
"\2\10\1\3\1\12\1\0\2\6\1\3\2\6\1\3" +
"\2\13\1\10\2\3\1\6\2\3\1\6\2\3\2\12" +
"\1\0\2\10\1\0\1\13\1\10\2\6\1\13\2\0" +
"\1\13\1\3\1\10\1\14\1\0\1\3\1\0\1\3" +
"\1\13\1\0\1\3\1\0\1\3\1\0\1\10\1\3" +
"\1\6\1\3\1\6\1\3\1\10\2\6\1\13\2\0" +
"\2\3\1\0\2\3\1\0\2\3\1\13\1\10\1\3" +
"\2\0\2\3\1\13\1\0\2\10\2\0\1\13\1\0" +
"\2\10\1\3\2\0\1\3\1\10\1\0\1\13\1\0" +
"\1\13\1\3\1\0\3\3";
private static int[] zzUnpackAction() {
int[] result = new int[174];
int offset = 0;
offset = zzUnpackAction(ZZ_ACTION_PACKED_0, offset, result);
return result;
}
private static int zzUnpackAction(String packed, int offset, int[] result) {
int i = 0; /* index in packed string */
int j = offset; /* index in unpacked array */
int l = packed.length();
while (i < l) {
int count = packed.charAt(i++);
int value = packed.charAt(i++);
do result[j++] = value; while (--count > 0);
}
return j;
}
/** Translates a state to a row index in the transition table */
private static final int[] ZZ_ROWMAP = zzUnpackRowMap();
private static final String ZZ_ROWMAP_PACKED_0 =
"\0\0\0\21\0\42\0\63\0\104\0\125\0\146\0\167" +
"\0\210\0\231\0\252\0\273\0\314\0\335\0\356\0\377" +
"\0\u0110\0\u0121\0\u0132\0\u0143\0\u0154\0\u0165\0\u0176\0\u0187" +
"\0\u0198\0\u01a9\0\u01ba\0\u01cb\0\u01dc\0\u01ed\0\u01fe\0\u020f" +
"\0\u0220\0\u0231\0\u0242\0\u0253\0\u0264\0\u0275\0\u0286\0\u0297" +
"\0\u02a8\0\u02b9\0\u02ca\0\356\0\u02db\0\u02ec\0\u02fd\0\u030e" +
"\0\u031f\0\u0330\0\u0176\0\u0341\0\u0352\0\u0363\0\u0374\0\u0385" +
"\0\u0396\0\u03a7\0\u03b8\0\u03c9\0\u03da\0\u03eb\0\273\0\u03fc" +
"\0\u040d\0\u041e\0\u042f\0\u0440\0\u0451\0\u0462\0\u0473\0\u0484" +
"\0\u0495\0\u04a6\0\u04b7\0\u04c8\0\u04d9\0\u04ea\0\u04fb\0\u050c" +
"\0\u051d\0\u052e\0\u053f\0\u0550\0\u0561\0\u0330\0\u0176\0\u0572" +
"\0\u0583\0\u0594\0\u05a5\0\u05b6\0\u05c7\0\u05d8\0\u05e9\0\u05fa" +
"\0\335\0\u01dc\0\u060b\0\u061c\0\u062d\0\u063e\0\u064f\0\u0660" +
"\0\u0671\0\u0682\0\u0693\0\u06a4\0\u06b5\0\u06c6\0\u06d7\0\u06e8" +
"\0\u06f9\0\u070a\0\u071b\0\u072c\0\u073d\0\u03b8\0\u074e\0\u075f" +
"\0\u0770\0\u0781\0\u0792\0\u07a3\0\u07b4\0\u07c5\0\u07d6\0\u07e7" +
"\0\u07f8\0\u0809\0\u081a\0\u082b\0\u083c\0\u084d\0\u085e\0\u086f" +
"\0\u0880\0\u0891\0\u08a2\0\u08b3\0\u08c4\0\u08d5\0\u08e6\0\u08f7" +
"\0\u0908\0\u0919\0\u092a\0\u093b\0\u094c\0\u095d\0\u096e\0\u097f" +
"\0\u0990\0\u09a1\0\u09b2\0\u09c3\0\u09d4\0\u09e5\0\u09f6\0\u0a07" +
"\0\u0a18\0\u0a29\0\u0a3a\0\u0a4b\0\u0a5c\0\u0a6d\0\u0a7e\0\u0a8f" +
"\0\u0aa0\0\u0ab1\0\u0ac2\0\u0ad3\0\u0ae4\0\u0af5";
private static int[] zzUnpackRowMap() {
int[] result = new int[174];
int offset = 0;
offset = zzUnpackRowMap(ZZ_ROWMAP_PACKED_0, offset, result);
return result;
}
private static int zzUnpackRowMap(String packed, int offset, int[] result) {
int i = 0; /* index in packed string */
int j = offset; /* index in unpacked array */
int l = packed.length();
while (i < l) {
int high = packed.charAt(i++) << 16;
result[j++] = high | packed.charAt(i++);
}
return j;
}
/** The transition table of the DFA */
private static final int[] ZZ_TRANS = zzUnpackTrans();
private static final String ZZ_TRANS_PACKED_0 =
"\2\2\1\3\5\2\1\4\1\5\1\6\1\7\1\10" +
"\1\11\1\12\1\13\1\2\32\0\2\14\7\0\1\15" +
"\1\16\1\17\1\20\2\21\1\22\1\23\1\24\1\25" +
"\1\7\1\26\6\0\1\27\1\0\1\30\2\31\1\32" +
"\1\33\2\24\1\7\1\34\5\0\1\15\1\35\1\17" +
"\1\20\2\31\1\32\1\36\1\24\1\25\1\7\1\37" +
"\14\0\3\40\2\7\5\0\1\15\1\16\1\17\1\20" +
"\2\21\1\22\1\26\1\41\1\42\1\7\1\26\14\0" +
"\3\43\1\0\1\43\1\11\21\0\1\12\22\0\1\2" +
"\2\0\1\44\5\0\1\45\2\46\1\7\1\47\14\0" +
"\1\50\1\0\1\50\1\0\1\50\14\0\1\51\1\52" +
"\1\53\1\0\1\51\14\0\1\54\1\0\1\54\1\0" +
"\1\54\14\0\1\55\1\56\1\55\1\0\1\55\14\0" +
"\1\57\2\60\1\0\1\57\14\0\1\22\2\61\1\0" +
"\1\22\5\0\1\15\1\62\1\17\1\20\2\21\1\22" +
"\1\23\1\24\1\25\1\7\1\26\6\0\1\63\1\0" +
"\1\30\2\31\1\32\1\33\2\24\1\7\1\34\5\0" +
"\1\15\1\63\1\17\1\20\2\31\1\32\1\36\1\24" +
"\1\25\1\7\1\37\5\0\1\15\1\62\1\17\1\20" +
"\2\21\1\22\1\26\1\41\1\42\1\7\1\26\6\0" +
"\1\44\5\0\1\64\2\65\1\7\1\66\14\0\3\56" +
"\1\0\1\56\14\0\1\67\2\70\1\0\1\67\14\0" +
"\1\71\2\72\1\0\1\71\6\0\1\73\1\0\1\30" +
"\2\31\1\32\1\33\2\24\1\7\1\34\6\0\1\73" +
"\1\0\1\30\2\31\1\32\1\34\2\41\1\7\1\34" +
"\6\0\1\44\5\0\1\74\1\65\1\75\1\7\1\76" +
"\5\0\1\15\1\73\1\17\1\20\2\31\1\32\1\36" +
"\1\24\1\25\1\7\1\37\5\0\1\15\1\73\1\17" +
"\1\20\2\31\1\32\1\37\1\41\1\42\1\7\1\37" +
"\14\0\3\40\1\0\1\40\6\0\1\63\1\0\1\30" +
"\2\31\1\32\1\34\2\41\1\7\1\34\5\0\1\15" +
"\1\63\1\17\1\20\2\31\1\32\1\37\1\41\1\42" +
"\1\7\1\37\14\0\3\43\1\0\1\43\15\0\2\77" +
"\10\0\1\100\2\0\3\100\1\45\2\46\1\7\1\47" +
"\6\0\1\77\2\0\3\101\1\102\2\46\1\7\1\103" +
"\6\0\1\100\2\0\3\100\1\47\2\104\1\7\1\47" +
"\5\0\1\15\6\0\1\50\1\0\1\50\1\0\1\50" +
"\6\0\1\105\1\0\1\30\2\106\1\0\1\107\2\52" +
"\1\0\1\107\6\0\1\110\1\0\1\30\2\111\1\112" +
"\1\113\2\114\1\7\1\115\6\0\1\116\1\0\1\30" +
"\2\111\1\112\1\113\2\114\1\7\1\115\6\0\1\117" +
"\2\0\1\117\2\0\1\55\1\56\1\55\1\0\1\55" +
"\6\0\1\117\2\0\1\117\2\0\3\56\1\0\1\56" +
"\6\0\1\106\1\0\1\30\2\106\1\0\1\57\2\60" +
"\1\0\1\57\6\0\1\111\1\0\1\30\2\111\1\112" +
"\1\120\2\121\1\7\1\122\6\0\1\112\2\0\3\112" +
"\1\123\2\124\1\7\1\125\14\0\1\107\2\52\1\0" +
"\1\107\6\0\1\126\1\0\1\30\2\21\1\22\1\64" +
"\2\65\1\7\1\66\6\0\1\127\1\0\1\30\2\31" +
"\1\32\1\130\2\65\1\7\1\131\6\0\1\126\1\0" +
"\1\30\2\21\1\22\1\66\2\132\1\7\1\66\6\0" +
"\1\21\1\0\1\30\2\21\1\22\1\67\2\133\1\7" +
"\1\134\6\0\1\31\1\0\1\30\2\31\1\32\1\70" +
"\2\133\1\7\1\135\6\0\1\22\2\0\3\22\1\71" +
"\2\136\1\7\1\137\6\0\1\32\2\0\3\32\1\72" +
"\2\136\1\7\1\140\14\0\1\64\2\130\1\0\1\64" +
"\6\0\1\141\1\0\1\30\2\21\1\22\1\64\2\65" +
"\1\7\1\66\6\0\1\142\1\0\1\30\2\31\1\32" +
"\1\130\2\65\1\7\1\131\6\0\1\141\1\0\1\30" +
"\2\21\1\22\1\66\2\132\1\7\1\66\14\0\1\100" +
"\2\143\1\0\1\100\14\0\1\45\2\102\1\0\1\45" +
"\6\0\1\101\2\0\3\101\1\102\2\46\1\7\1\103" +
"\6\0\1\101\2\0\3\101\1\103\2\104\1\7\1\103" +
"\6\0\1\77\2\0\3\101\1\103\2\104\1\7\1\103" +
"\14\0\1\144\1\145\1\144\1\0\1\144\14\0\3\146" +
"\1\0\1\146\6\0\1\147\1\0\1\30\2\106\1\0" +
"\1\107\2\52\1\0\1\107\14\0\3\150\1\0\1\150" +
"\14\0\3\151\1\0\1\151\14\0\3\152\1\0\1\152" +
"\6\0\1\153\1\0\1\30\2\154\1\155\1\113\2\114" +
"\1\7\1\115\6\0\1\156\1\0\1\30\2\154\1\155" +
"\1\113\2\114\1\7\1\115\6\0\1\153\1\0\1\30" +
"\2\154\1\155\1\115\2\157\1\7\1\115\14\0\1\160" +
"\1\150\1\160\1\0\1\160\14\0\3\161\1\0\1\161" +
"\6\0\1\154\1\0\1\30\2\154\1\155\1\120\2\121" +
"\1\7\1\122\6\0\1\162\1\0\1\30\2\154\1\155" +
"\1\120\2\121\1\7\1\122\6\0\1\154\1\0\1\30" +
"\2\154\1\155\1\122\2\163\1\7\1\122\6\0\1\155" +
"\2\0\3\155\1\123\2\124\1\7\1\125\6\0\1\164" +
"\2\0\3\155\1\123\2\124\1\7\1\125\6\0\1\155" +
"\2\0\3\155\1\125\2\165\1\7\1\125\6\0\1\166" +
"\1\0\1\30\2\31\1\32\1\130\2\65\1\7\1\131" +
"\6\0\1\166\1\0\1\30\2\31\1\32\1\131\2\132" +
"\1\7\1\131\6\0\1\127\1\0\1\30\2\31\1\32" +
"\1\131\2\132\1\7\1\131\6\0\1\167\1\0\1\30" +
"\2\31\1\32\1\70\2\133\1\7\1\135\6\0\1\21" +
"\1\0\1\30\2\21\1\22\1\134\2\170\1\7\1\134" +
"\6\0\1\31\1\0\1\30\2\31\1\32\1\135\2\170" +
"\1\7\1\135\6\0\1\171\2\0\3\32\1\72\2\136" +
"\1\7\1\140\6\0\1\22\2\0\3\22\1\137\2\172" +
"\1\7\1\137\6\0\1\32\2\0\3\32\1\140\2\172" +
"\1\7\1\140\6\0\1\173\2\0\3\173\1\102\2\46" +
"\1\7\1\103\6\0\1\105\1\0\1\30\2\106\1\0" +
"\3\145\1\0\1\145\6\0\1\147\1\0\1\30\2\106" +
"\1\0\3\145\1\0\1\145\6\0\1\106\1\0\1\30" +
"\2\106\1\0\3\146\1\0\1\146\14\0\3\145\1\0" +
"\1\145\6\0\1\126\1\0\1\30\2\21\1\22\1\150" +
"\2\174\1\7\1\175\6\0\1\21\1\0\1\30\2\21" +
"\1\22\1\151\2\176\1\7\1\177\6\0\1\22\2\0" +
"\3\22\1\152\2\200\1\7\1\201\14\0\1\150\2\202" +
"\1\0\1\150\14\0\1\151\2\203\1\0\1\151\14\0" +
"\1\152\2\204\1\0\1\152\6\0\1\44\5\0\1\150" +
"\2\174\1\7\1\175\6\0\1\156\1\0\1\30\2\154" +
"\1\155\1\115\2\157\1\7\1\115\6\0\1\141\1\0" +
"\1\30\2\21\1\22\1\150\2\174\1\7\1\175\6\0" +
"\1\117\2\0\1\117\2\0\3\161\1\0\1\161\6\0" +
"\1\44\5\0\1\151\2\176\1\7\1\177\6\0\1\162" +
"\1\0\1\30\2\154\1\155\1\122\2\163\1\7\1\122" +
"\6\0\1\44\5\0\1\152\2\200\1\7\1\201\6\0" +
"\1\164\2\0\3\155\1\125\2\165\1\7\1\125\6\0" +
"\1\44\5\0\1\67\2\133\1\7\1\134\6\0\1\167" +
"\1\0\1\30\2\31\1\32\1\135\2\170\1\7\1\135" +
"\6\0\1\44\5\0\1\71\2\136\1\7\1\137\6\0" +
"\1\171\2\0\3\32\1\140\2\172\1\7\1\140\14\0" +
"\3\45\1\0\1\45\6\0\1\205\1\0\1\30\2\206" +
"\1\207\1\202\2\174\1\7\1\210\6\0\1\126\1\0" +
"\1\30\2\21\1\22\1\175\2\211\1\7\1\175\6\0" +
"\1\212\1\0\1\30\2\206\1\207\1\203\2\176\1\7" +
"\1\213\6\0\1\21\1\0\1\30\2\21\1\22\1\177" +
"\2\214\1\7\1\177\6\0\1\215\2\0\3\207\1\204" +
"\2\200\1\7\1\216\6\0\1\22\2\0\3\22\1\201" +
"\2\217\1\7\1\201\6\0\1\220\1\0\1\30\2\206" +
"\1\207\1\202\2\174\1\7\1\210\6\0\1\206\1\0" +
"\1\30\2\206\1\207\1\203\2\176\1\7\1\213\6\0" +
"\1\207\2\0\3\207\1\204\2\200\1\7\1\216\6\0" +
"\1\44\5\0\1\221\2\114\1\7\1\222\14\0\1\223" +
"\2\120\1\0\1\223\14\0\1\224\2\123\1\0\1\224" +
"\6\0\1\220\1\0\1\30\2\206\1\207\1\210\2\211" +
"\1\7\1\210\6\0\1\205\1\0\1\30\2\206\1\207" +
"\1\210\2\211\1\7\1\210\6\0\1\44\5\0\1\223" +
"\2\121\1\7\1\225\6\0\1\206\1\0\1\30\2\206" +
"\1\207\1\213\2\214\1\7\1\213\6\0\1\212\1\0" +
"\1\30\2\206\1\207\1\213\2\214\1\7\1\213\6\0" +
"\1\44\5\0\1\224\2\124\1\7\1\226\6\0\1\207" +
"\2\0\3\207\1\216\2\217\1\7\1\216\6\0\1\215" +
"\2\0\3\207\1\216\2\217\1\7\1\216\14\0\1\221" +
"\2\113\1\0\1\221\6\0\1\227\1\0\1\30\2\230" +
"\1\100\1\221\2\114\1\7\1\222\6\0\1\227\1\0" +
"\1\30\2\230\1\100\1\222\2\157\1\7\1\222\6\0" +
"\1\230\1\0\1\30\2\230\1\100\1\223\2\121\1\7" +
"\1\225\6\0\1\100\2\0\3\100\1\224\2\124\1\7" +
"\1\226\6\0\1\230\1\0\1\30\2\230\1\100\1\225" +
"\2\163\1\7\1\225\6\0\1\100\2\0\3\100\1\226" +
"\2\165\1\7\1\226\14\0\1\231\2\232\1\0\1\231" +
"\14\0\1\233\2\234\1\0\1\233\6\0\1\147\1\0" +
"\1\30\2\106\1\0\1\231\2\232\1\0\1\231\6\0" +
"\1\235\1\0\1\30\2\236\1\173\1\237\2\240\1\7" +
"\1\241\6\0\1\106\1\0\1\30\2\106\1\0\1\233" +
"\2\234\1\0\1\233\6\0\1\236\1\0\1\30\2\236" +
"\1\173\1\242\2\243\1\7\1\244\14\0\3\245\1\0" +
"\1\245\14\0\3\246\1\0\1\246\6\0\1\247\1\0" +
"\1\30\2\250\1\101\1\237\2\240\1\7\1\241\6\0" +
"\1\251\1\0\1\30\2\250\1\101\1\237\2\240\1\7" +
"\1\241\6\0\1\247\1\0\1\30\2\250\1\101\1\241" +
"\2\252\1\7\1\241\6\0\1\250\1\0\1\30\2\250" +
"\1\101\1\242\2\243\1\7\1\244\6\0\1\253\1\0" +
"\1\30\2\250\1\101\1\242\2\243\1\7\1\244\6\0" +
"\1\250\1\0\1\30\2\250\1\101\1\244\2\254\1\7" +
"\1\244\6\0\1\227\1\0\1\30\2\230\1\100\1\245" +
"\2\240\1\7\1\255\6\0\1\230\1\0\1\30\2\230" +
"\1\100\1\246\2\243\1\7\1\256\14\0\1\245\2\237" +
"\1\0\1\245\14\0\1\246\2\242\1\0\1\246\6\0" +
"\1\44\5\0\1\245\2\240\1\7\1\255\6\0\1\251" +
"\1\0\1\30\2\250\1\101\1\241\2\252\1\7\1\241" +
"\6\0\1\44\5\0\1\246\2\243\1\7\1\256\6\0" +
"\1\253\1\0\1\30\2\250\1\101\1\244\2\254\1\7" +
"\1\244\6\0\1\227\1\0\1\30\2\230\1\100\1\255" +
"\2\252\1\7\1\255\6\0\1\230\1\0\1\30\2\230" +
"\1\100\1\256\2\254\1\7\1\256\4\0";
private static int[] zzUnpackTrans() {
int[] result = new int[2822];
int offset = 0;
offset = zzUnpackTrans(ZZ_TRANS_PACKED_0, offset, result);
return result;
}
private static int zzUnpackTrans(String packed, int offset, int[] result) {
int i = 0; /* index in packed string */
int j = offset; /* index in unpacked array */
int l = packed.length();
while (i < l) {
int count = packed.charAt(i++);
int value = packed.charAt(i++);
value--;
do result[j++] = value; while (--count > 0);
}
return j;
}
/* error codes */
private static final int ZZ_UNKNOWN_ERROR = 0;
private static final int ZZ_NO_MATCH = 1;
private static final int ZZ_PUSHBACK_2BIG = 2;
/* error messages for the codes above */
private static final String ZZ_ERROR_MSG[] = {
"Unkown internal scanner error",
"Error: could not match input",
"Error: pushback value was too large"
};
/** ZZ_ATTRIBUTE[aState] contains the attributes of state <code>aState</code> */
private static final int[] ZZ_ATTRIBUTE = zzUnpackAttribute();
private static final String ZZ_ATTRIBUTE_PACKED_0 =
"\1\0\1\11\12\1\6\0\5\1\3\0\11\1\3\0" +
"\7\1\2\0\2\1\2\0\7\1\1\0\3\1\4\0" +
"\3\1\1\0\2\1\2\0\4\1\1\0\23\1\1\0" +
"\2\1\1\0\5\1\2\0\4\1\1\0\1\1\1\0" +
"\2\1\1\0\1\1\1\0\1\1\1\0\12\1\2\0" +
"\2\1\1\0\2\1\1\0\5\1\2\0\3\1\1\0" +
"\2\1\2\0\1\1\1\0\3\1\2\0\2\1\1\0" +
"\1\1\1\0\2\1\1\0\3\1";
private static int[] zzUnpackAttribute() {
int[] result = new int[174];
int offset = 0;
offset = zzUnpackAttribute(ZZ_ATTRIBUTE_PACKED_0, offset, result);
return result;
}
private static int zzUnpackAttribute(String packed, int offset, int[] result) {
int i = 0; /* index in packed string */
int j = offset; /* index in unpacked array */
int l = packed.length();
while (i < l) {
int count = packed.charAt(i++);
int value = packed.charAt(i++);
do result[j++] = value; while (--count > 0);
}
return j;
}
/** the input device */
private java.io.Reader zzReader;
/** the current state of the DFA */
private int zzState;
/** the current lexical state */
private int zzLexicalState = YYINITIAL;
/**
* this buffer contains the current text to be matched and is
* the source of the yytext() string
*/
private char zzBuffer[] = new char[ZZ_BUFFERSIZE];
/** the textposition at the last accepting state */
private int zzMarkedPos;
/** the textposition at the last state to be included in yytext */
private int zzPushbackPos;
/** the current text position in the buffer */
private int zzCurrentPos;
/** startRead marks the beginning of the yytext() string in the buffer */
private int zzStartRead;
/**
* endRead marks the last character in the buffer, that has been read
* from input
*/
private int zzEndRead;
/** number of newlines encountered up to the start of the matched text */
private int yyline;
/** the number of characters up to the start of the matched text */
private int yychar;
/**
* the number of characters from the last newline up to the start of the
* matched text
*/
private int yycolumn;
/** zzAtBOL == true <=> the scanner is currently at the beginning of a line */
private boolean zzAtBOL = true;
/** zzAtEOF == true <=> the scanner is at the EOF */
private boolean zzAtEOF;
/* user code: */
public static final int ALPHANUM = 0;
public static final int APOSTROPHE = 1;
public static final int ACRONYM = 2;
public static final int COMPANY = 3;
public static final int EMAIL = 4;
public static final int HOST = 5;
public static final int NUM = 6;
public static final int CJ = 7;
/**
* @deprecated this solves a bug where HOSTs that end with '.' are identified
* as ACRONYMs. It is deprecated and will be removed in the next
* release.
*/
public static final int ACRONYM_DEP = 8;
public static final int KOREAN = 9;
public static final int CHINESE = 10;
public static final String[] TOKEN_TYPES = new String[] {
"<ALPHANUM>",
"<APOSTROPHE>",
"<ACRONYM>",
"<COMPANY>",
"<EMAIL>",
"<HOST>",
"<NUM>",
"<CJ>",
"<ACRONYM_DEP>",
"<KOREAN>",
"<CHINESE>"
};
public final int yychar() {
return yychar;
}
/** Fills Lucene token with the current token text. */
final void getText(CharTermAttribute t) {
t.copyBuffer(zzBuffer, zzStartRead, zzMarkedPos - zzStartRead);
}
/**
* Creates a new scanner
* There is also a java.io.InputStream version of this constructor.
*
* @param in the java.io.Reader to read input from.
*/
KoreanTokenizerImpl(java.io.Reader in) {
this.zzReader = in;
}
/**
* Creates a new scanner.
* There is also java.io.Reader version of this constructor.
*
* @param in the java.io.Inputstream to read input from.
*/
KoreanTokenizerImpl(java.io.InputStream in) {
this(new java.io.InputStreamReader(in));
}
/**
* Unpacks the compressed character translation table.
*
* @param packed the packed character translation table
* @return the unpacked character translation table
*/
private static char[] zzUnpackCMap(String packed) {
char[] map = new char[0x10000];
int i = 0; /* index in packed string */
int j = 0; /* index in unpacked array */
while (i < 156) {
int count = packed.charAt(i++);
char value = packed.charAt(i++);
do map[j++] = value; while (--count > 0);
}
return map;
}
/**
* Refills the input buffer.
*
* @return <code>false</code>, iff there was new input.
* @throws java.io.IOException if any I/O-Error occurs
*/
private boolean zzRefill() throws java.io.IOException {
/* first: make room (if you can) */
if (zzStartRead > 0) {
System.arraycopy(zzBuffer, zzStartRead,
zzBuffer, 0,
zzEndRead - zzStartRead);
/* translate stored positions */
zzEndRead -= zzStartRead;
zzCurrentPos -= zzStartRead;
zzMarkedPos -= zzStartRead;
zzPushbackPos -= zzStartRead;
zzStartRead = 0;
}
/* is the buffer big enough? */
if (zzCurrentPos >= zzBuffer.length) {
/* if not: blow it up */
char newBuffer[] = new char[zzCurrentPos * 2];
System.arraycopy(zzBuffer, 0, newBuffer, 0, zzBuffer.length);
zzBuffer = newBuffer;
}
/* finally: fill the buffer with new input */
int numRead = zzReader.read(zzBuffer, zzEndRead,
zzBuffer.length - zzEndRead);
if (numRead < 0) {
return true;
} else {
zzEndRead += numRead;
return false;
}
}
/** Closes the input stream. */
public final void yyclose() throws java.io.IOException {
zzAtEOF = true; /* indicate end of file */
zzEndRead = zzStartRead; /* invalidate buffer */
if (zzReader != null)
zzReader.close();
}
/**
* Resets the scanner to read from a new input stream.
* Does not close the old reader.
* <p/>
* All internal variables are reset, the old input stream
* <b>cannot</b> be reused (internal buffer is discarded and lost).
* Lexical state is set to <tt>ZZ_INITIAL</tt>.
*
* @param reader the new input stream
*/
public final void yyreset(java.io.Reader reader) {
zzReader = reader;
zzAtBOL = true;
zzAtEOF = false;
zzEndRead = zzStartRead = 0;
zzCurrentPos = zzMarkedPos = zzPushbackPos = 0;
yyline = yychar = yycolumn = 0;
zzLexicalState = YYINITIAL;
}
/** Returns the current lexical state. */
public final int yystate() {
return zzLexicalState;
}
/**
* Enters a new lexical state
*
* @param newState the new lexical state
*/
public final void yybegin(int newState) {
zzLexicalState = newState;
}
/** Returns the text matched by the current regular expression. */
public final String yytext() {
return new String(zzBuffer, zzStartRead, zzMarkedPos - zzStartRead);
}
/**
* Returns the character at position <tt>pos</tt> from the
* matched text.
* <p/>
* It is equivalent to yytext().charAt(pos), but faster
*
* @param pos the position of the character to fetch.
* A value from 0 to yylength()-1.
* @return the character at position pos
*/
public final char yycharat(int pos) {
return zzBuffer[zzStartRead + pos];
}
/** Returns the length of the matched text region. */
public final int yylength() {
return zzMarkedPos - zzStartRead;
}
/**
* Reports an error that occured while scanning.
* <p/>
* In a wellformed scanner (no or only correct usage of
* yypushback(int) and a match-all fallback rule) this method
* will only be called with things that "Can't Possibly Happen".
* If this method is called, something is seriously wrong
* (e.g. a JFlex bug producing a faulty scanner etc.).
* <p/>
* Usual syntax/scanner level error handling should be done
* in error fallback rules.
*
* @param errorCode the code of the errormessage to display
*/
private void zzScanError(int errorCode) {
String message;
try {
message = ZZ_ERROR_MSG[errorCode];
} catch (ArrayIndexOutOfBoundsException e) {
message = ZZ_ERROR_MSG[ZZ_UNKNOWN_ERROR];
}
throw new Error(message);
}
/**
* Pushes the specified amount of characters back into the input stream.
* <p/>
* They will be read again by then next call of the scanning method
*
* @param number the number of characters to be read again.
* This number must not be greater than yylength()!
*/
public void yypushback(int number) {
if (number > yylength())
zzScanError(ZZ_PUSHBACK_2BIG);
zzMarkedPos -= number;
}
/**
* Resumes scanning until the next regular expression is matched,
* the end of input is encountered or an I/O-Error occurs.
*
* @return the next token
* @throws java.io.IOException if any I/O-Error occurs
*/
public int getNextToken() throws java.io.IOException {
int zzInput;
int zzAction;
// cached fields:
int zzCurrentPosL;
int zzMarkedPosL;
int zzEndReadL = zzEndRead;
char[] zzBufferL = zzBuffer;
char[] zzCMapL = ZZ_CMAP;
int[] zzTransL = ZZ_TRANS;
int[] zzRowMapL = ZZ_ROWMAP;
int[] zzAttrL = ZZ_ATTRIBUTE;
while (true) {
zzMarkedPosL = zzMarkedPos;
yychar += zzMarkedPosL - zzStartRead;
zzAction = -1;
zzCurrentPosL = zzCurrentPos = zzStartRead = zzMarkedPosL;
zzState = zzLexicalState;
zzForAction:
{
while (true) {
if (zzCurrentPosL < zzEndReadL)
zzInput = zzBufferL[zzCurrentPosL++];
else if (zzAtEOF) {
zzInput = YYEOF;
break zzForAction;
} else {
// store back cached positions
zzCurrentPos = zzCurrentPosL;
zzMarkedPos = zzMarkedPosL;
boolean eof = zzRefill();
// get translated positions and possibly new buffer
zzCurrentPosL = zzCurrentPos;
zzMarkedPosL = zzMarkedPos;
zzBufferL = zzBuffer;
zzEndReadL = zzEndRead;
if (eof) {
zzInput = YYEOF;
break zzForAction;
} else {
zzInput = zzBufferL[zzCurrentPosL++];
}
}
int zzNext = zzTransL[zzRowMapL[zzState] + zzCMapL[zzInput]];
if (zzNext == -1) break zzForAction;
zzState = zzNext;
int zzAttributes = zzAttrL[zzState];
if ((zzAttributes & 1) == 1) {
zzAction = zzState;
zzMarkedPosL = zzCurrentPosL;
if ((zzAttributes & 8) == 8) break zzForAction;
}
}
}
// store back cached position
zzMarkedPos = zzMarkedPosL;
switch (zzAction < 0 ? zzAction : ZZ_ACTION[zzAction]) {
case 8: {
return HOST;
}
case 13:
break;
case 11: {
return ACRONYM_DEP;
}
case 14:
break;
case 10: {
return ACRONYM;
}
case 15:
break;
case 1: { /* ignore */
}
case 16:
break;
case 6: {
return NUM;
}
case 17:
break;
case 5: {
return CJ;
}
case 18:
break;
case 2: {
return ALPHANUM;
}
case 19:
break;
case 9: {
return COMPANY;
}
case 20:
break;
case 7: {
return APOSTROPHE;
}
case 21:
break;
case 4: {
return CHINESE;
}
case 22:
break;
case 3: {
return KOREAN;
}
case 23:
break;
case 12: {
return EMAIL;
}
case 24:
break;
default:
if (zzInput == YYEOF && zzStartRead == zzCurrentPos) {
zzAtEOF = true;
return YYEOF;
} else {
zzScanError(ZZ_NO_MATCH);
}
}
}
}
}