2. largest average word length
this rule will return the chunks that own the largest average word length
342172
public static IChunk[] getLargestAverageWordLengthChunks(IChunk[] chunks) 
    {
        double largetAverage = chunks[0].getAverageWordsLength();
        int j;
        
        //find the largest average word length
        for ( j = 1; j < chunks.length; j++ ) {
            if ( chunks[j].getAverageWordsLength() > largetAverage ) {
                largetAverage = chunks[j].getAverageWordsLength();
            }
        }
        
        //get the items that the average word length equals to
        //the max's.
        ArrayList<IChunk> chunkArr = new ArrayList<IChunk>(chunks.length);
        for ( j = 0; j < chunks.length; j++ ) {
            if ( chunks[j].getAverageWordsLength() == largetAverage) {
                chunkArr.add(chunks[j]);
            }
        }
        
        IChunk[] lchunk = new IChunk[chunkArr.size()];
        chunkArr.toArray(lchunk);
        chunkArr.clear();
        
        return lchunk;
    }
63157
def chunk_fill(iterable, size, fillvalue=None):
    
    # TODO: not used
    args = [iter(iterable)] * size
    return itertools.zip_longest(*args, fillvalue=fillvalue)
780068
private static String wordShapeChris2Long(String s, boolean omitIfInBoundary, int len, Collection<String> knownLCWords) {
    final char[] beginChars = new char[BOUNDARY_SIZE];
    final char[] endChars = new char[BOUNDARY_SIZE];
    int beginUpto = 0;
    int endUpto = 0;
    final Set<Character> seenSet = new TreeSet<Character>();  // TreeSet guarantees stable ordering; has no size parameter

    boolean nonLetters = false;

    for (int i = 0; i < len; i++) {
      int iIncr = 0;
      char c = s.charAt(i);
      char m = c;
      if (Character.isDigit(c)) {
        m = 'd';
      } else if (Character.isLowerCase(c)) {
        m = 'x';
      } else if (Character.isUpperCase(c) || Character.isTitleCase(c)) {
        m = 'X';
      }
      for (String gr : greek) {
        if (s.startsWith(gr, i)) {
          m = 'g';
          //System.out.println(s + "  ::  " + s.substring(i+1));
          iIncr = gr.length() - 1;
          break;
        }
      }
      if (m != 'x' && m != 'X') {
        nonLetters = true;
      }

      if (i < BOUNDARY_SIZE) {
        beginChars[beginUpto++] = m;
      } else if (i < len - BOUNDARY_SIZE) {
        seenSet.add(Character.valueOf(m));
      } else {
        endChars[endUpto++] = m;
      }
      i += iIncr;
      // System.out.println("Position skips to " + i);
    }

    // Calculate size. This may be an upperbound, but is often correct
    int sbSize = beginUpto + endUpto + seenSet.size();
    if (knownLCWords != null) { sbSize++; }
    final StringBuilder sb = new StringBuilder(sbSize);
    // put in the beginning chars
    sb.append(beginChars, 0, beginUpto);
    // put in the stored ones sorted
    if (omitIfInBoundary) {
      for (Character chr : seenSet) {
        char ch = chr.charValue();
        boolean insert = true;
        for (int i = 0; i < beginUpto; i++) {
          if (beginChars[i] == ch) {
            insert = false;
            break;
          }
        }
        for (int i = 0; i < endUpto; i++) {
          if (endChars[i] == ch) {
            insert = false;
            break;
          }
        }
        if (insert) {
          sb.append(ch);
        }
      }
    } else {
      for (Character chr : seenSet) {
        sb.append(chr.charValue());
      }
    }
    // and add end ones
    sb.append(endChars, 0, endUpto);

    if (knownLCWords != null) {
      if (!nonLetters && knownLCWords.contains(s.toLowerCase())) {
        sb.append('k');
      }
    }
    // System.out.println(s + " became " + sb);
    return sb.toString();
  }
1370818
def _get_example_length(example):
  """"""
  length = tf.maximum(tf.shape(example[0])[0], tf.shape(example[1])[0])
  return length
1196958
def _filter_max_length(example, max_length=256):
  """"""
  return tf.logical_and(tf.size(example[0]) <= max_length,
                        tf.size(example[1]) <= max_length)
952041
def htmlParseChunk(self, chunk, size, terminate):
        
        ret = libxml2mod.htmlParseChunk(self._o, chunk, size, terminate)
        return ret
559532
def best_match(given_word)
      words = (@word_list.is_a? Array) ? @word_list : @word_list.keys

      word_bigrams = bigramate(given_word)
      word_hash = words.map do |key|
        [key, bigram_compare(word_bigrams, bigramate(key))]
      end
      word_hash = Hash[word_hash]

      # Weight by word usage, if logical
      word_hash = apply_usage_weights(word_hash) if @word_list.is_a? Hash

      word_hash.max_by { |_key, value| value }.first
    end
606007
def split_into(max_num_chunks, list_to_chunk):
    
    max_chunk_size = math.ceil(len(list_to_chunk) / max_num_chunks)
    return chunks_of(max_chunk_size, list_to_chunk)
1025853
def get_chunk(self, size=None):
        
        if size is None:
            size = self._chunksize
        return self.read(nrows=size)
1223618
def chunks_of(max_chunk_size, list_to_chunk):
    
    for i in range(0, len(list_to_chunk), max_chunk_size):
        yield list_to_chunk[i:i + max_chunk_size]
46594
function splitLongWords(str, max, truncationChar) {
  str = str.trim()
  var result = []
  var words = str.split(' ')
  var remainder = ''

  var truncationWidth = wcwidth(truncationChar)

  while (remainder || words.length) {
    if (remainder) {
      var word = remainder
      remainder = ''
    } else {
      var word = words.shift()
    }

    if (wcwidth(word) > max) {
      // slice is based on length no wcwidth
      var i = 0
      var wwidth = 0
      var limit = max - truncationWidth
      while (i < word.length) {
        var w = wcwidth(word.charAt(i))
        if (w + wwidth > limit) {
          break
        }
        wwidth += w
        ++i
      }

      remainder = word.slice(i) // get remainder
      // save remainder for next loop

      word = word.slice(0, i) // grab truncated word
      word += truncationChar // add trailing … or whatever
    }
    result.push(word)
  }

  return result.join(' ')
}
761706
def multiple_chunks(self, chunk_size=None):
        
        if not chunk_size:
            chunk_size = self.DEFAULT_CHUNK_SIZE
        return self.size > chunk_size
1156517
def request_length(self):
        
        remainder = self.stop_at - self.offset
        return self.chunk_size if remainder > self.chunk_size else remainder
1154448
@Nonnull
    public Word<I> longestCommonSuffix(Word<?> other) {
        int len = length(), otherLen = other.length();
        int minLen = (len < otherLen) ? len : otherLen;

        int idx1 = len, idx2 = otherLen;
        int i = 0;
        while (i < minLen) {
            I sym1 = getSymbol(--idx1);
            Object sym2 = other.getSymbol(--idx2);

            if (!Objects.equals(sym1, sym2)) {
                break;
            }

            i++;
        }

        return suffix(i);
    }
1185741
def chunks(self, size=32, alignment=1):
        

        if (size % alignment) != 0:
            raise Error(
                'size {} is not a multiple of alignment {}'.format(
                    size,
                    alignment))

        for segment in self:
            for chunk in segment.chunks(size, alignment):
                yield chunk
1234383
def most_frequent(self, k):
    
    word_count = {w:self.word_count[w] for w in self.words[:k]}
    return CountedVocabulary(word_count=word_count)
504514
private static int getMaxStringLength(String[] names) {
		int size = 0;
		for(String s : names) {
			if(s.length()>size) {
				size = s.length();
			}
		}
		return size;
	}