'Return a function to preprocess the text before tokenization'

def build_preprocessor(self):

    noop = (lambda x: x)
    if (not self.strip_accents):
        strip_accents = noop
    elif hasattr(self.strip_accents, '__call__'):
        strip_accents = self.strip_accents
    elif (self.strip_accents == 'ascii'):
        strip_accents = strip_accents_ascii
    elif (self.strip_accents == 'unicode'):
        strip_accents = strip_accents_unicode
    else:
        raise ValueError(('Invalid    value    for    "strip_accents":    %s' % self.strip_accents))
    only_prose = (lambda s: re.sub('<[^>]*>', '', s).replace('\n', '    '))
    return (lambda x: strip_accents(only_prose(x)))
