|
1
2
|
#-*- coding:utf-8 -*-
|
|
3
|
import datetime
|
|
4
5
6
7
|
from collections import Counter
from django.core.management.base import BaseCommand
|
|
8
9
|
from dictionary.models import get_checked_statuses, get_ready_statuses
from dictionary.ajax_vocabulary_management import get_stats, write_stats
|
|
10
11
|
class Command(BaseCommand):
|
|
12
|
help = 'Get Walenty statistics.'
|
|
13
14
|
def handle(self, **options):
|
|
15
16
17
|
now = datetime.datetime.now().strftime('%Y%m%d')
all_statuses = get_ready_statuses()
verified_statuses = get_checked_statuses()
|
|
18
|
|
|
19
20
21
22
|
nouns_stats_dict_all = Counter(get_stats(all_statuses, 'noun'))
write_stats('data/stats_%s_nouns_all.txt' % now, nouns_stats_dict_all)
nouns_stats_dict_verified = Counter(get_stats(verified_statuses, 'noun'))
write_stats('data/stats_%s_nouns_verified.txt' % now, nouns_stats_dict_verified)
|
|
23
|
|
|
24
25
26
27
|
adjs_stats_dict_all = Counter(get_stats(all_statuses, 'adj'))
write_stats('data/stats_%s_adjs_all.txt' % now, adjs_stats_dict_all)
adjs_stats_dict_verified = Counter(get_stats(verified_statuses, 'adj'))
write_stats('data/stats_%s_adjs_verified.txt' % now, adjs_stats_dict_verified)
|
|
28
|
|
|
29
30
31
32
|
verbs_stats_dict_all = Counter(get_stats(all_statuses, 'verb'))
write_stats('data/stats_%s_verbs_all.txt' % now, verbs_stats_dict_all)
verbs_stats_dict_verified = Counter(get_stats(verified_statuses, 'verb'))
write_stats('data/stats_%s_verbs_verified.txt' % now, verbs_stats_dict_verified)
|
|
33
|
|
|
34
35
36
37
|
advs_stats_dict_all = Counter(get_stats(all_statuses, 'adv'))
write_stats('data/stats_%s_advs_all.txt' % now, advs_stats_dict_all)
advs_stats_dict_verified = Counter(get_stats(verified_statuses, 'adv'))
write_stats('data/stats_%s_advs_verified.txt' % now, advs_stats_dict_verified)
|
|
38
|
|
|
39
40
|
all_stats_dict_all = nouns_stats_dict_all + adjs_stats_dict_all + verbs_stats_dict_all + advs_stats_dict_all
all_stats_dict_verified = nouns_stats_dict_verified + adjs_stats_dict_verified + verbs_stats_dict_verified + advs_stats_dict_verified
|
|
41
|
|
|
42
43
|
write_stats('data/stats_%s_all.txt' % now, all_stats_dict_all)
write_stats('data/stats_%s_verified.txt' % now, all_stats_dict_verified)
|