本文整理汇总了Python中feature_extractor.FeatureExtractor.ne方法的典型用法代码示例。如果您正苦于以下问题:Python FeatureExtractor.ne方法的具体用法?Python FeatureExtractor.ne怎么用?Python FeatureExtractor.ne使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类feature_extractor.FeatureExtractor
的用法示例。
在下文中一共展示了FeatureExtractor.ne方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: test_single
# 需要导入模块: from feature_extractor import FeatureExtractor [as 别名]
# 或者: from feature_extractor.FeatureExtractor import ne [as 别名]
def test_single(self):
for t in self.testdata:
fe = FeatureExtractor(t, "report")
fe.ngrams(n=5)
fe.chunk()
fe.dependency()
fe.ne()
fe.bcv()
fe.srl()
logging.debug(pformat(zip(fe.SUF, fe.POS)))
logging.debug(pformat(fe.features))
vec = DictVectorizer(sparse=True)
array_f = vec.fit_transform(fe.features).toarray()
# logging.debug(pformat(array_f))
raise Exception
示例2: _get_features
# 需要导入模块: from feature_extractor import FeatureExtractor [as 别名]
# 或者: from feature_extractor.FeatureExtractor import ne [as 别名]
def _get_features(self, v="", v_corpus=None, cls2id=None, domain="src"):
_flist = []
_labellist_int = []
_labellist_str = []
_labelid = cls2id[v]
if v_corpus:
for sid, s in enumerate(v_corpus):
try:
fe = FeatureExtractor(s, verb=v)
if "chunk" in self.featuretypes:
fe.chunk()
if "3gram" in self.featuretypes:
fe.ngrams(n=3)
if "5gram" in self.featuretypes:
fe.ngrams(n=5)
if "7gram" in self.featuretypes:
fe.ngrams(n=7)
if "dep" in self.featuretypes:
fe.dependency()
if "srl" in self.featuretypes:
fe.srl()
if "ne" in self.featuretypes:
fe.ne()
if "errorprob" in self.featuretypes:
pass
if "topic" in self.featuretypes:
pass
augf = proc_easyadapt(fe.features, domain=domain)
_flist.append(augf)
_labellist_int.append(_labelid)
_labellist_str.append(v)
except ValueError:
logging.debug(pformat("CaseMaker feature extraction: couldn't find the verb"))
except:
print v
raise
else:
_flist.append(self.nullfeature)
_labellist_int.append(_labelid)
_labellist_str.append(v)
return _flist, _labellist_str, _labellist_int