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 ==================== #
评论列表
文章目录