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

def decode(self, doc):

    if (self.input == u'filename'):
        with open(doc, u'rb') as fh:
            doc = fh.read()
    elif (self.input == u'file'):
        doc = doc.read()
    if isinstance(doc, bytes):
        doc = doc.decode(self.encoding, self.decode_error)
    if (doc is np.nan):
        raise ValueError(u'np.nan    is    an    invalid    document,    expected    byte    or    unicode    string.')
    return doc
