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)
Ejemplo n.º 2
0
 def __init__(self, board):
     Stats.__init__(self, board)
    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)
Ejemplo n.º 4
0
 def __init__(self, profile, stats, star=False):
     Stats.__init__(self, stats)
     Player.__init__(self, profile)
     self.isStarPlayer = star