コード例 #1
0
ファイル: edrelatedcom.py プロジェクト: abiraja2004/ohsn
def ed_user(dbname, colname):
    '''Get ED users'''
    user_lit = []
    db = dbt.db_connect_no_auth(dbname)
    com = db[colname]
    count = 0
    i = 0
    for user in com.find({}, ['id', 'description']):
        if profiles_check.check_ed_related_profile(user['description']):
            print user['id'], ' '.join(user['description'].split()).encode('utf-8')
            user_lit.append(user['id'])
            count += 1
        i += 1
    print count
    return user_lit
コード例 #2
0
ファイル: edrelatedcom.py プロジェクト: wtgme/ohsn
def ed_user(dbname, colname):
    '''Get ED users'''
    user_lit = []
    db = dbt.db_connect_no_auth(dbname)
    com = db[colname]
    count = 0
    i = 0
    for user in com.find({}, ['id', 'description']):
        if profiles_check.check_ed_related_profile(user['description']):
            # print user['id'], ' '.join(user['description'].split()).encode('utf-8')
            user_lit.append(user['id'])
            count += 1
        i += 1
    print count
    return user_lit
コード例 #3
0
ファイル: edrelatedcom.py プロジェクト: abiraja2004/ohsn
def rec_user(dbname, colname):
    """Get recovery users"""
    user_lit = []
    db = dbt.db_connect_no_auth(dbname)
    com = db[colname]
    count = 0
    for user in com.find({}, ['id', 'id_str', 'screen_name', 'description']):
        if profiles_check.check_ed_related_profile(user['description']):
            text = user['description'].strip().lower().replace("-", "").replace('_', '')
            sentences = re.split( r"\s*[;:`\"()?!{}]\s*|--+|\s*-\s+|''|\.\s|\.$|\.\.+|¡°|¡±", text )
            FLAG = False
            for sentence in sentences:
                if 'recover' in sentence:
                    if 'not' not in sentence and 'don\'t' not in sentence \
                            and 'anti' not in sentence and 'non' not in sentence\
                            and 'relapse' not in sentence:
                        FLAG = True
                # if 'struggl' in sentence:
                #     if 'thin' not in sentence and 'weight' not in sentence \
                #             and 'mirror' not in sentence and 'figure' not in sentence \
                #             and 'food' not in sentence and 'body' not in sentence\
                #             and 'proed' not in sentence and 'proana' not in sentence and 'promia' not in sentence:
                #         FLAG = True
                # if 'fight' in sentence:
                #     if 'thin' not in sentence and 'weight' not in sentence \
                #             and 'mirror' not in sentence and 'figure' not in sentence \
                #             and 'food' not in sentence and 'body' not in sentence:
                #         FLAG = True
            # for sentence in sentences:
            #     if 'proed' in sentence or 'proana' in sentence or 'promia' in sentence:
            #         if 'not' not in sentence and \
            #                         'don\'t' not in sentence and \
            #                         'anti' not in sentence:
            #             FLAG = False
            if FLAG:
                print user['id_str'], user['screen_name'], ' '.join(user['description'].split()).encode('utf-8')
                user_lit.append(str(user['id']))
                count += 1
    print count
    return user_lit
コード例 #4
0
ファイル: edrelatedcom.py プロジェクト: wtgme/ohsn
def rec_user(dbname, colname):
    """Get recovery users"""
    user_lit = []
    db = dbt.db_connect_no_auth(dbname)
    com = db[colname]
    count = 0
    for user in com.find({}, ['id', 'id_str', 'screen_name', 'description']):
        if profiles_check.check_ed_related_profile(user['description']):
            text = user['description'].strip().lower().replace("-", "").replace('_', '')
            sentences = re.split( r"\s*[,;:`\"()?!{}]\s*|--+|\s*-\s+|''|\.\s|\.$|\.\.+|¡°|¡±", text )
            FLAG = False
            for sentence in sentences:
                if 'recover' in sentence:
                    if 'not' not in sentence and 'don\'t' not in sentence and 'anti' not in sentence:
                        FLAG = True
                # if 'struggl' in sentence:
                #     if 'thin' not in sentence and 'weight' not in sentence \
                #             and 'mirror' not in sentence and 'figure' not in sentence \
                #             and 'food' not in sentence and 'body' not in sentence\
                #             and 'proed' not in sentence and 'proana' not in sentence and 'promia' not in sentence:
                #         FLAG = True
                # if 'fight' in sentence:
                #     if 'thin' not in sentence and 'weight' not in sentence \
                #             and 'mirror' not in sentence and 'figure' not in sentence \
                #             and 'food' not in sentence and 'body' not in sentence:
                #         FLAG = True
            # for sentence in sentences:
            #     if 'proed' in sentence or 'proana' in sentence or 'promia' in sentence:
            #         if 'not' not in sentence and \
            #                         'don\'t' not in sentence and \
            #                         'anti' not in sentence:
            #             FLAG = False
            if FLAG:
                print user['id_str'], user['screen_name'], ' '.join(user['description'].split()).encode('utf-8')
                user_lit.append(user['id'])
                count += 1
    print count
    return user_lit
コード例 #5
0
ファイル: edrelatedcom.py プロジェクト: wtgme/ohsn
def proed_users(dbname, colname):
    '''Get pro-ED users'''
    user_list = []
    db = dbt.db_connect_no_auth(dbname)
    com = db[colname]
    count = 0
    for user in com.find({}, ['id', 'id_str', 'screen_name', 'description']):
        if profiles_check.check_ed_related_profile(user['description']):
            text = user['description'].strip().lower().replace("-", "").replace('_', '')
            sentences = re.split( r"\s*[,;:`\"()?!{}]\s*|--+|\s*-\s+|''|\.\s|\.$|\.\.+|¡°|¡±", text )
            FLAG = False
            for sentence in sentences:
                if 'proed' in sentence or 'proana' in sentence \
                        or 'prothin' in sentence or 'thinspo' in sentence \
                        or 'bonespo' in sentence or 'thinspiration' in sentence:
                    if 'not' not in sentence and 'don\'t' not in sentence and 'anti' not in sentence:
                        FLAG = True
            if FLAG:
                print user['id_str'], user['screen_name'], ' '.join(user['description'].split()).encode('utf-8')
                user_list.append(user['id'])
                count += 1
    print count
    return user_list
コード例 #6
0
ファイル: edrelatedcom.py プロジェクト: abiraja2004/ohsn
def proed_users(dbname, colname):
    '''Get pro-ED users'''
    user_list = []
    db = dbt.db_connect_no_auth(dbname)
    com = db[colname]
    count = 0
    for user in com.find({}, ['id', 'id_str', 'screen_name', 'description']):
        if profiles_check.check_ed_related_profile(user['description']):
            text = user['description'].strip().lower().replace("-", "").replace('_', '')
            sentences = re.split( r"\s*[;:`\"()?!{}]\s*|--+|\s*-\s+|''|\.\s|\.$|\.\.+|¡°|¡±", text )
            FLAG = False
            for sentence in sentences:
                if 'proed' in sentence or 'proana' in sentence \
                        or 'prothin' in sentence or 'thinspo' in sentence \
                        or 'bonespo' in sentence or 'thinspiration' in sentence\
                        or 'proanamia' in sentence or 'promia' in sentence:
                    if 'not' not in sentence and 'don\'t' not in sentence and 'anti' not in sentence and 'non' not in sentence:
                        FLAG = True
            if FLAG:
                print user['id_str'], user['screen_name'], ' '.join(user['description'].split()).encode('utf-8')
                user_list.append(str(user['id']))
                count += 1
    print count
    return user_list