本文整理汇总了Python中stats.Stats.__init__方法的典型用法代码示例。如果您正苦于以下问题:Python Stats.__init__方法的具体用法?Python Stats.__init__怎么用?Python Stats.__init__使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类stats.Stats
的用法示例。
在下文中一共展示了Stats.__init__方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: get_stats
# 需要导入模块: from stats import Stats [as 别名]
# 或者: from stats.Stats import __init__ [as 别名]
def get_stats(self,verbose=False):
'''
return most important stats into dict
@type verbose: bool
@param verbose: [optional]. if set to True, general stats
are send to stdout.
'''
Stats.__init__(self)
num_rels,none_targets = self.stats_rels()
tops = self.tops()
with open( os.path.join(self.cwd,'resources','tops.bin'),'wb') as outfile:
pickle.dump(tops,outfile)
empty_synsets = self.stats_empty_synsets()
average_polysemy, polysemy_dict = self.polysemy_dict()
self.stats_large_synsets()
self.stats = {'num_synsets' : self.stats_num_synsets(),
'num_lexical_entries' : self.stats_num_les(),
'num_empty_pwn_synsets' : empty_synsets['num_empty_pwn_synsets'],
'num_empty_odwn_synsets' : empty_synsets['num_empty_odwn_synsets'],
'empty_leave_odwn_synsets' : empty_synsets['leave_empty_odwn_synsets'],
'num_relations' : num_rels,
'impossible_rels' : none_targets,
'empty_lemmas' : self.empty_lemmas(),
'tops' : tops,
'sy_no_gloss,empty_glosses,one_word' : self.no_gloss(),
'pos_counts' : self.count_pos(),
'provenance' : self.resources_check(),
'polysemy_dict' : polysemy_dict,
'average_polysemy' : average_polysemy,
'bidirectional_relations' : self.missing_bidirectional_relations("has_hyponym","has_hyperonym"),
'no_rels' : self.sy_no_rels(),
'contradicting' : self.contradicting_rels()
}
if verbose:
print('general stats for input file:')
print(os.path.basename(self.path_wn_grid_lmf))
for key,value in sorted(self.stats.items()):
if key in ["bidirectional_relations","polysemy_dict",'empty_leave_odwn_synsets',
"impossible_rels","tops","no_rels","contradicting"]:
print(key,len(value))
else:
print(key,value)
示例2: __init__
# 需要导入模块: from stats import Stats [as 别名]
# 或者: from stats.Stats import __init__ [as 别名]
def __init__(self, board):
Stats.__init__(self, board)