本文整理汇总了Python中common.Logger.finalize方法的典型用法代码示例。如果您正苦于以下问题:Python Logger.finalize方法的具体用法?Python Logger.finalize怎么用?Python Logger.finalize使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类common.Logger
的用法示例。
在下文中一共展示了Logger.finalize方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: update
# 需要导入模块: from common import Logger [as 别名]
# 或者: from common.Logger import finalize [as 别名]
def update(weights, predicts, sentence, edge_feats):
for i, word in enumerate(sentence):
h_predict = predicts[i]
h_gold = word.head
if h_predict != h_gold:
for fidx in edge_feats.get((h_predict, i), []):
weights[fidx] = weights[fidx] - 1
for fidx in edge_feats.get((h_gold, i), []):
weights[fidx] = weights[fidx] + 1
return weights
def main(args):
if len(args) < 2:
Log.w("Arguments Error")
return
path = args[0]
iteration = int(args[1])
Log.i("Training file: %s" % path)
Log.i("----------------")
sentences = c.readconllfile(path)
featdict, weights = train(sentences, iteration)
c.save(featdict, weights)
if __name__ == "__main__":
Log.setConfig(loglevel=Log.DEBUG, verbose=True)
main(c.readargs())
Log.finalize()