Пример #1
0
def generate_docs_file(file_):
    from past.model.user import User
    uids = User.get_ids(start=0, limit=400)
    with open(file_, "aw") as f:
        for x in uids:
            print 'get user %s text' % x
            text = get_all_text_by_user(x)
            f.write(text.encode("utf8"))
Пример #2
0
def get_keywords(user_id=config.MY_USER_ID, count=30):
    text = get_all_text_by_user(user_id)
    file_ = "/tmp/tag_%s" % randbytes(8)
    with open(file_, 'w') as f:
        f.write(text.encode("utf8"))
    try:
        cmd = '%s -I -d %s -c utf8 -t500 -i "%s"|grep -E "^[0-9]+"' \
                % (config.SCWS, config.HOT_TERMS_DICT, file_)
        r = commands.getoutput(cmd)
    except Exception, e:
        print e
Пример #3
0
def get_keywords(user_id=config.MY_USER_ID, count=30):
    text = get_all_text_by_user(user_id)
    file_ = "/tmp/tag_%s" % randbytes(8)
    with open(file_, 'w') as f:
        f.write(text.encode("utf8"))
    try:
        cmd = '%s -I -d %s -c utf8 -t200 -i "%s"|grep -E "^[0-9]+"' \
                % (config.SCWS, config.HOT_TERMS_DICT, file_)
        r = commands.getoutput(cmd)
    except Exception, e:
        import traceback
        print traceback.format_exc()