classifier.py 文件源码

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

项目:pygameweb 作者: pygame 项目源码 文件源码
def classify_comment(comment):
    """Classify the comment.

    :param comment: should have a message attribute.
    """
    global _comment_pipeline
    from sklearn.externals import joblib

    model_is_not_loaded = _comment_pipeline is None
    if model_is_not_loaded:
        import pygameweb.comment.classifier_train
        import pygameweb.config
        model_fname = pygameweb.config.Config.COMMENT_MODEL
        _comment_pipeline = joblib.load(model_fname)

    return _comment_pipeline.predict([comment.message])[0]
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号