def generate_support_stats():
    client = zulip.Client()
    narrow = 'stream:support'
    count = 2000
    msgs = get_recent_messages(client, narrow, count)
    msgs_by_topic = collections.defaultdict(list) # type: Dict[str, List[Dict[str, Any]]]
    for msg in msgs:
        topic = msg['subject']
        msgs_by_topic[topic].append(msg)

    word_count = collections.defaultdict(int) # type: Dict[str, int]
    email_count = collections.defaultdict(int) # type: Dict[str, int]

    if False:
        for topic in msgs_by_topic:
            msgs = msgs_by_topic[topic]
    analyze_messages(msgs, word_count, email_count)

    if True:
        words = [w for w in word_count.keys() if word_count[w] >= 10 and len(w) >= 5]
        words = sorted(words, key=lambda w: word_count[w], reverse=True)
        for word in words:
            print(word, word_count[word])

    if False:
        emails = sorted(list(email_count.keys()),
                        key=lambda w: email_count[w], reverse=True)
        for email in emails:
            print(email, email_count[email])
dataset/ETHPy150Open zulip/zulip/bots/summarize_stream.py/generate_support_stats/original