本文整理汇总了Python中common.Logger.i方法的典型用法代码示例。如果您正苦于以下问题:Python Logger.i方法的具体用法?Python Logger.i怎么用?Python Logger.i使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类common.Logger
的用法示例。
在下文中一共展示了Logger.i方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: main
# 需要导入模块: from common import Logger [as 别名]
# 或者: from common.Logger import i [as 别名]
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)
示例2: train
# 需要导入模块: from common import Logger [as 别名]
# 或者: from common.Logger import i [as 别名]
def train(sentences, iteration=10):
edge_feats_list, featdict = c.extract(sentences)
weights = np.zeros(len(featdict))
size = len(sentences)
for i in range(1, iteration + 1):
Log.i("Training iteration: %d of %d" % (i, iteration))
count = 0
for sentence, edge_feats in zip(sentences, edge_feats_list):
count = count + 1
Log.i("\tTraining sentence: %d of %d" % (count, size))
predicts = eisner.parse(sentence, weights, edge_feats)
weights = update(weights, predicts, sentence, edge_feats)
"""
print(predicts)
for feat, index in featdict.items():
print(index, feat, weights[index])
"""
return featdict, weights