'Decode the input into a string of unicode symbols
The decoding strategy depends on the vectorizer parameters.'

def decode(self, doc):

    if (self.input == 'filename'):
        doc = open(doc, 'rb').read()
    elif (self.input == 'file'):
        doc = doc.read()
    if isinstance(doc, bytes):
        doc = doc.decode(self.charset, self.charset_error)
    return doc
