Exemple #1
0
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
Exemple #2
0
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
Exemple #3
0
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
Exemple #4
0
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
Exemple #5
0
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
Exemple #6
0
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