public static IChunk [ ] getMaximumMatchChunks ( IChunk [ ] chunks ) { int maxLength = chunks [ 0 ] . getLength ( ) ; int j ; //find the maximum word length for ( j = 1 ; j < chunks . length ; j ++ ) { if ( chunks [ j ] . getLength ( ) > maxLength ) maxLength = chunks [ j ] . getLength ( ) ; } //get the items that the word length equals to //the max's length. ArrayList < IChunk > chunkArr = new ArrayList < IChunk > ( chunks . length ) ; for ( j = 0 ; j < chunks . length ; j ++ ) { if ( chunks [ j ] . getLength ( ) == maxLength ) { chunkArr . add ( chunks [ j ] ) ; } } IChunk [ ] lchunk = new IChunk [ chunkArr . size ( ) ] ; chunkArr . toArray ( lchunk ) ; chunkArr . clear ( ) ; return lchunk ; }
1 . the maximum match rule this rule will return the chunks that own the largest word length