예제 #1
0
def write_dict(infile, outfile):
    chat = whatstat.load_chat(sys.argv[1])
    res = {}
    for author in chat.authors:
        res[author.name] = []

    with open(outfile, "w") as f:
        f.write("authors = %r" % res)
예제 #2
0
def write_dict(infile, outfile):
    chat = whatstat.load_chat(sys.argv[1])
    res = {}
    for author in chat.authors:
        res[author.name] = []
    
    with open(outfile, "w") as f:
        f.write("authors = %r" % res)
예제 #3
0
    code = template.substitute(messages=aux1, characters=aux2, words=aux3,
                                author_columns=author_columns,
                                messages_per_day=messages_per_day,
                                trending_topics=tt,
                                chatname=chat.get_subject(),
                                date=chat.events[-1].datetime.strftime("el %A, %d de %B de %Y a las %H:%M"))
    
    # Save the result.
    if not os.path.exists(destpath):
        os.makedirs(destpath)
    
    # Create the positives graph.
    g = stats.positives(chat)
    destdot = os.path.join(destpath, "positives.dot")
    destpng = os.path.join(destpath, "positives.png")
    nx.write_dot(g, destdot)
    os.system("dot {0} -Tpng > {1}".format(destdot, destpng))
    
    # Create the html.
    desthtml = os.path.join(destpath, "index.html")
    
    # Write the html file.
    f = open(desthtml, "w")
    f.write(code.encode("utf-8"))
    f.close()

if __name__ == '__main__':
    chat = stats.load_chat(sys.argv[1], sys.argv[2])
    common_words = parser.parse_words(sys.argv[3])
    write_stats(sys.argv[4], chat, common_words)
예제 #4
0
                               messages_per_day=messages_per_day,
                               trending_topics=tt,
                               chatname=chat.get_subject(),
                               date=chat.events[-1].datetime.strftime(
                                   "el %A, %d de %B de %Y a las %H:%M"))

    # Save the result.
    if not os.path.exists(destpath):
        os.makedirs(destpath)

    # Create the positives graph.
    g = stats.positives(chat)
    destdot = os.path.join(destpath, "positives.dot")
    destpng = os.path.join(destpath, "positives.png")
    nx.write_dot(g, destdot)
    os.system("dot {0} -Tpng > {1}".format(destdot, destpng))

    # Create the html.
    desthtml = os.path.join(destpath, "index.html")

    # Write the html file.
    f = open(desthtml, "w")
    f.write(code.encode("utf-8"))
    f.close()


if __name__ == '__main__':
    chat = stats.load_chat(sys.argv[1], sys.argv[2])
    common_words = parser.parse_words(sys.argv[3])
    write_stats(sys.argv[4], chat, common_words)