def readme_concept_list_meta(): """Writes statistics on metadata to readme.""" txt = ['# Basic Statistics on Metadata\n'] cnc = len(read_all(data_path('concepticon.tsv'))) res = Counter([(cl.stem, len(read_all(cl))) for cl in concept_set_meta()]) for name, n in res.most_common(): txt.append('* {0} covers {1} concept sets ({2:.2f} %)'.format(name, n, n / cnc)) readme(data_path('concept_set_meta'), txt)
def stats(args): """\ write statistics to README concepticon stats """ cls = [(cl, read_all(cl)) for cl in conceptlists()] readme_conceptlists(cls) readme_concept_list_meta() readme_concepticondata(cls)
def nattr(p, attr): return len(nfilter([getattr(i, attr, None) for i in read_all(str(p))]))
def nattr(p, attr): return len(nfilter([getattr(i, attr, None) for i in read_all(p)]))