import re


def filter_data(text_array):
    """Filters text data."""
    filtered_texts = []
    spec_char_re = re.compile('[^\x00-\x7F]+')
    punc_char_re = re.compile('[^a-z0-9 ]+')

    for text in text_array:
        # Make lowercase
        text = text.lower()
        # Replace special chars (unicode) with spaces
        text = spec_char_re.sub(' ', text)
        # Remove duplicate spaces (and \r\t\n)
        text = ' '.join(text.split())
        # Remove punctuation
        text = punc_char_re.sub('', text)

        filtered_texts.append(text)

    return filtered_texts