cross_genre_profiler.py 文件源码

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

项目:magic 作者: pan-webis-de 项目源码 文件源码
def __init__(self, lang=None, method=None, features=None):
        fs = []
        if 'unigram' in features:
            fs.append(word_unigrams())
        if 'bigram' in features:
            fs.append(word_bigrams())
        if 'spelling' in features:
            fs.append(avg_spelling_error(lang=lang))
        if 'punctuation' in features:
            fs.append(punctuation_features())
        if 'char' in features:
            fs.append(char_ngrams())

        fu = FeatureUnion(fs, n_jobs=1)
        self.pipeline = Pipeline([('features', fu),
                                  ('scale', Normalizer()),
                                  ('classifier', get_classifier(method=method))])
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号