当前位置: 首页>>代码示例>>Python>>正文


Python Features.append_features方法代码示例

本文整理汇总了Python中Features.append_features方法的典型用法代码示例。如果您正苦于以下问题:Python Features.append_features方法的具体用法?Python Features.append_features怎么用?Python Features.append_features使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Features的用法示例。


在下文中一共展示了Features.append_features方法的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: feat5

# 需要导入模块: import Features [as 别名]
# 或者: from Features import append_features [as 别名]
def feat5(train, test):
    train_valence, test_valence = feat1(train, test)
    puncter, train_punct = Features.punctuation(train)
    _, test_punct = Features.punctuation(test, vectorizer = puncter)
    train_matrix = Features.append_features([train_valence, train_punct])
    test_matrix = Features.append_features([test_valence, test_punct])
    return train_matrix, test_matrix
开发者ID:josepablocam,项目名称:snlp_project,代码行数:9,代码来源:maxent_experiments.py

示例2: feat6_generic

# 需要导入模块: import Features [as 别名]
# 或者: from Features import append_features [as 别名]
def feat6_generic(train, test, train_pos, test_pos):
    train_f5, test_f5 = feat5(train, test)
    cter, train_cts = Features.keyPOSNGrams(train_pos, ["jj.*", "vb.*"], tf_idf = True)
    _, test_cts = Features.keyPOSNGrams(test_pos, ["jj.*", "vb.*"], vectorizer = cter, tf_idf= True)
    train_matrix = Features.append_features([train_f5, train_cts])
    test_matrix = Features.append_features([test_f5, test_cts])
    return train_matrix, test_matrix
开发者ID:josepablocam,项目名称:snlp_project,代码行数:9,代码来源:svm_sigK.py

示例3: feat4

# 需要导入模块: import Features [as 别名]
# 或者: from Features import append_features [as 别名]
def feat4(train, test):
    # feature set 3
    train_f3, test_f3 = feat3(train, test)
    # punctuation
    puncter, train_punct = Features.punctuation(train)
    _, test_punct = Features.punctuation(test, vectorizer = puncter)
    train_matrix = Features.append_features([train_f3, train_punct])
    test_matrix = Features.append_features([test_f3, test_punct])
    return train_matrix, test_matrix
开发者ID:josepablocam,项目名称:snlp_project,代码行数:11,代码来源:maxent_experiments.py

示例4: feat3

# 需要导入模块: import Features [as 别名]
# 或者: from Features import append_features [as 别名]
def feat3(train, test):
    # valence info
    train_valence, test_valence = feat1(train, test)
    # tf idf info
    train_cts, test_cts = feat2(train, test)
    # combined info
    train_matrix = Features.append_features([train_valence, train_cts])
    test_matrix = Features.append_features([test_valence, test_cts])
    return train_matrix, test_matrix
开发者ID:josepablocam,项目名称:snlp_project,代码行数:11,代码来源:maxent_experiments.py

示例5: feat7

# 需要导入模块: import Features [as 别名]
# 或者: from Features import append_features [as 别名]
def feat7(train, test):
    normal_train, train_pos = map(list, zip(*train))
    normal_test, test_pos = map(list, zip(*test))
    train_f5, test_f5 = feat5(normal_train, normal_test)
    cter, train_cts = Features.keyPOSNGrams(train_pos, ["jj.*", "vb.*"], tf_idf = True, ngram_range = (1, 2), stop_words = 'english')
    _, test_cts = Features.keyPOSNGrams(test_pos, ["jj.*", "vb.*"], vectorizer = cter, tf_idf= True, ngram_range = (1, 2), stop_words = 'english')
    train_matrix = Features.append_features([train_f5, train_cts])
    test_matrix = Features.append_features([test_f5, test_cts])
    return train_matrix, test_matrix
开发者ID:josepablocam,项目名称:snlp_project,代码行数:11,代码来源:maxent_experiments.py

示例6: feat7

# 需要导入模块: import Features [as 别名]
# 或者: from Features import append_features [as 别名]
def feat7(train, test):
    # feature set 3
    train_f5, test_f5 = feat5(train, test)
    # punctuation
    puncter, train_punct = Features.bagOfWordsSkLearn(train)
    _, test_punct = Features.bagOfWordsSkLearn(test, vectorizer = puncter)
    train_matrix = Features.append_features([train_f5, train_punct])
    test_matrix = Features.append_features([test_f5, test_punct])
    return train_matrix, test_matrix
开发者ID:josepablocam,项目名称:snlp_project,代码行数:11,代码来源:maxent_experiments_indomain.py

示例7: feat6

# 需要导入模块: import Features [as 别名]
# 或者: from Features import append_features [as 别名]
def feat6(train, test):
    normal_train, train_pos = map(list, zip(*train))
    normal_test, test_pos = map(list, zip(*test))
    train_f5, test_f5 = feat5(normal_train, normal_test)
    cter, train_cts = Features.keyPOSNGrams(train_pos, ["jj.*", "vb.*"], tf_idf = True)
    _, test_cts = Features.keyPOSNGrams(test_pos, ["jj.*", "vb.*"], vectorizer = cter, tf_idf= True)
    train_matrix = Features.append_features([train_f5, train_cts])
    test_matrix = Features.append_features([test_f5, test_cts])
    return train_matrix, test_matrix
开发者ID:josepablocam,项目名称:snlp_project,代码行数:11,代码来源:New_SVM_experiments.py

示例8: extra_features

# 需要导入模块: import Features [as 别名]
# 或者: from Features import append_features [as 别名]
def extra_features(train, test):
    # uni and bigrams
    state_info, train_ngrams = Features.wordCountsSkLearn(train, ngram_range = (1, 2), stop_words = 'english')
    _, test_ngrams = Features.wordCountsSkLearn(test, vectorizer = state_info, ngram_range = (1, 2), stop_words = 'english')
    # valence and punctuation
    train_valence_punct, test_valence_punct = feat5(train, test)
    # train matrix
    train_matrix = Features.append_features([train_ngrams, train_valence_punct])
    test_matrix = Features.append_features([test_ngrams, test_valence_punct])
    return train_matrix, test_matrix
开发者ID:josepablocam,项目名称:snlp_project,代码行数:12,代码来源:maxent_experiments.py


注:本文中的Features.append_features方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。