text.py 文件源码

python
阅读 27 收藏 0 点赞 0 评论 0

项目:odin 作者: imito 项目源码 文件源码
def _validate_texts(self, texts):
    """ Valiate the input to `fit` and `transform` """
    if not isinstance(texts, Iterable) and \
    not isinstance(texts, Iterator) and \
    not is_string(texts):
      raise ValueError('texts must be an iterator, generator or a string.')
    if is_string(texts):
      texts = (texts,)
    # convert to unicode
    texts = (t.decode('utf-8') for t in texts)
    return texts

  # ==================== properties ==================== #
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号