<commit_before>import re
import tweepy
from random import choice
from itertools import cycle
from google_language import get_entities
from models.corpus import update_corpus

def tweet_maker(the_tweet):
    foods = cycle((
        'spaghetti',
        'meatballs',
        'marinara sauce',
        'steak pizzaiola',
        'baked ziti',
        'pecorino romano',
        'oregano',
        'basil',
        'mozzarella',
        'bolognese',
        'parmesean'
    ))
    the_new_tweet = the_tweet.text
    entities = get_entities(the_tweet.text)
    for word, entity_type in entities.items():
        update_corpus(word, entity_type)
        the_new_tweet = the_new_tweet.replace(
            word,
            choice(
                feed_me(next(foods), entity_type)
        ))
    return replace_url(the_new_tweet)

def replace_url(in_string):
    url = re.compile("http.+(\s|$)")
    return url.sub(
        "https://www.youtube.com/watch?v=zWHu95io9B4 ",
        in_string
    )

def feed_me(subject, entity):
    return {
        'UNKNOWN':[
            f'{subject}',
            f'some kind of {subject}',
        ],
        'PERSON':[
            f'{subject} man',
        ],
        'LOCATION':[
            f'{subject} land',
            f'{subject} city',
        ],
        'ORGANIZATION':[
            f'{subject.title()} Conservancy',
            f'Department of {subject.title()}',
            f'{subject.title()} Association',
        ],
        'EVENT':[
            f'{subject.title()} Day',
            f'war of {subject.title()}',
        ],
        'WORK_OF_ART':[
            f'Mona {subject.title()}',
            f'Thinking {subject.title()}',
            f'{subject.title()} Descending a Staircase',
        ],
        'CONSUMER_GOOD':[
            f'{subject}',
        ],
        'OTHER':[
            f'{subject}',
        ],
    }.get(entity, f'{subject}')

if __name__ == '__main__':
    print(tweet_maker(input('Enter some text:')))
<commit_msg>makes replacement slightly less aggressive<commit_after>import re
import tweepy
from random import choice
from google_language import get_entities
from models.corpus import update_corpus

def tweet_maker(the_tweet):
    foods = (
        'spaghetti',
        'meatballs',
        'marinara sauce',
        'steak pizzaiola',
        'baked ziti',
        'pecorino romano',
        'oregano',
        'basil',
        'mozzarella',
        'bolognese',
        'parmesean'
    )
    the_new_tweet = the_tweet.text
    entities = get_entities(the_tweet.text)
    for word, entity_type in entities.items():
        update_corpus(word, entity_type)
        the_new_tweet = the_new_tweet.replace(
            word, choice(feed_me(choice(foods), word, entity_type))
        )
    return replace_url(the_new_tweet)

def replace_url(in_string):
    url = re.compile("http.+(\s|$)")
    return url.sub(
        "https://www.youtube.com/watch?v=zWHu95io9B4 ",
        in_string
    )

def feed_me(food, origin, entity):
    return {
        'UNKNOWN':[
            origin,
        ],
        'PERSON':[
            f'{food} man',
        ],
        'LOCATION':[
            f'{food} land',
            f'{food} city',
        ],
        'ORGANIZATION':[
            f'{food.title()} Conservancy',
            f'Department of {food.title()}',
            f'{food.title()} Association',
        ],
        'EVENT':[
            f'{food.title()} Day',
            f'war of {food.title()}',
        ],
        'WORK_OF_ART':[
            origin,
        ],
        'CONSUMER_GOOD':[
            f'{food}',
        ],
        'OTHER':[
            origin,
        ],
    }.get(entity, f'{food}')

if __name__ == '__main__':
    print(tweet_maker(input('Enter some text:')))

{'fraction_non_alphanumeric': 0.13842864778193478, 'fraction_numerical': 0.002137894174238375, 'mean_word_length': 1.8748079877112136, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 2, 'lorem ipsum': 0, 'www.': 2, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '5643511', 'n_tokens_mistral': 1230, 'n_tokens_neox': 1227, 'n_words': 227}