protected IWord [ ] getNextMatch ( char [ ] chars , int index ) { ArrayList < IWord > mList = new ArrayList < IWord > ( 8 ) ; //StringBuilder isb = new StringBuilder(); isb . clear ( ) ; char c = chars [ index ] ; isb . append ( c ) ; String temp = isb . toString ( ) ; if ( dic . match ( ILexicon . CJK_WORD , temp ) ) { mList . add ( dic . get ( ILexicon . CJK_WORD , temp ) ) ; } String _key = null ; for ( int j = 1 ; j < config . MAX_LENGTH && ( ( j + index ) < chars . length ) ; j ++ ) { isb . append ( chars [ j + index ] ) ; _key = isb . toString ( ) ; if ( dic . match ( ILexicon . CJK_WORD , _key ) ) { mList . add ( dic . get ( ILexicon . CJK_WORD , _key ) ) ; } } /* * if match no words from the current position * to idx+Config.MAX_LENGTH, just return the Word with * a value of temp as a unrecognited word. */ if ( mList . isEmpty ( ) ) { mList . add ( new Word ( temp , ILexicon . UNMATCH_CJK_WORD ) ) ; } /* for ( int j = 0; j < mList.size(); j++ ) { System.out.println(mList.get(j)); }*/ IWord [ ] words = new IWord [ mList . size ( ) ] ; mList . toArray ( words ) ; mList . clear ( ) ; return words ; }
match the next CJK word in the dictionary