本文整理汇总了Python中trainer.Trainer.cutoffFeats方法的典型用法代码示例。如果您正苦于以下问题:Python Trainer.cutoffFeats方法的具体用法?Python Trainer.cutoffFeats怎么用?Python Trainer.cutoffFeats使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类trainer.Trainer
的用法示例。
在下文中一共展示了Trainer.cutoffFeats方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: main_train
# 需要导入模块: from trainer import Trainer [as 别名]
# 或者: from trainer.Trainer import cutoffFeats [as 别名]
def main_train(featureSet, options, input=sys.stdin):
optionsDict = vars(options)
if options.usedFeats:
optionsDict['usedFeats'] = file(options.usedFeats)
trainer = Trainer(featureSet, optionsDict)
if options.inFeatFile:
trainer.getEventsFromFile(options.inFeatFile)
else:
trainer.getEvents(input, options.outFeatFile)
trainer.cutoffFeats()
trainer.train()
trainer.save()
示例2: mainTrain
# 需要导入模块: from trainer import Trainer [as 别名]
# 或者: from trainer.Trainer import cutoffFeats [as 别名]
def mainTrain(featureSet, options):
trainer = Trainer(featureSet, options)
if 'inFeatFile' in options and options['inFeatFile']:
# Use with featurized input
trainer.getEventsFromFile(options['inFeatFile'])
else: # Use with raw input
trainer.getEvents(options['inputStream'])
if options['task'] == 'most-informative-features':
trainer.cutoffFeats()
trainer.mostInformativeFeatures(options['outputStream'])
elif 'toCRFsuite' in options and options['toCRFsuite']:
trainer.cutoffFeats()
trainer.toCRFsuite(options['outputStream'])
trainer.save()
else:
trainer.cutoffFeats()
trainer.train()
trainer.save()