def filter_strings(strs, nglen=4):
    """
    Filter cluster of short strings.
    If a string two previous and next neighbors and itself have a
    small length less than mlen, discard that string.
    """
    from licensedcode.tokenize import ngrams
    strs = list(strs)
    if len(strs) < nglen:
        for s in strs:
            yield s
    else:
        for ngm in ngrams(strs, nglen):
            junk = all(len(s) <= 5 for s in ngm) or sum(len(s) for s in ngm
                ) <= nglen * 5 or len(set(ngm[0])) / float(len(ngm[0])) < 0.01
            if junk:
                continue
            yield ngm[0]
