本文整理汇总了Python中Features.keyPOSNGrams方法的典型用法代码示例。如果您正苦于以下问题:Python Features.keyPOSNGrams方法的具体用法?Python Features.keyPOSNGrams怎么用?Python Features.keyPOSNGrams使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Features
的用法示例。
在下文中一共展示了Features.keyPOSNGrams方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: feat6_generic
# 需要导入模块: import Features [as 别名]
# 或者: from Features import keyPOSNGrams [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
示例2: feat7
# 需要导入模块: import Features [as 别名]
# 或者: from Features import keyPOSNGrams [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
示例3: feat6
# 需要导入模块: import Features [as 别名]
# 或者: from Features import keyPOSNGrams [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