tasks/DREAM/cleaning.py
def replace_word(word_array, dict_of_words_to_replace):
    """
    Given an array of words, replace any words matching a key in dict_of_words_to_replace with its corresponding
    value.
    :param word_array: The array of words to check.
    :param dict_of_words_to_replace: The dictionary of words to replace paired with their replacements.
    :return: The new array of words.
    """
    new_word_array = []
    for word in word_array:
        if word in dict_of_words_to_replace:
            new_word_array.extend(dict_of_words_to_replace[word])
        else:
            new_word_array.append(word)
    return new_word_array

    Given an array of words, replace any words matching a key in dict_of_words_to_replace with its corresponding
    value.
    :param word_array: The array of words to check.
    :param dict_of_words_to_replace: The dictionary of words to replace paired with their replacements.
    :return: The new array of words.
    
Given an array of words, replace any words matching a key in dict_of_words_to_replace with its corresponding
value.
Given an array of words replace any words matching a key in dict_of_words_to_replace with its corresponding value .
def replace_word(word_array, dict_of_words_to_replace):
    new_word_array = []
    for word in word_array:
        if word in dict_of_words_to_replace:
            new_word_array.extend(dict_of_words_to_replace[word])
        else:
            new_word_array.append(word)
    return new_word_array
def replace_word ( word_array , dict_of_words_to_replace ) : new_word_array = [ ] for word in word_array : if word in dict_of_words_to_replace : new_word_array . extend ( dict_of_words_to_replace [ word ] ) else : new_word_array . append ( word ) return new_word_array
Given an array of words, replace any words matching a key in dict_of_words_to_replace with its corresponding
value.
Given an array of words replace any words matching a key in dict_of_words_to_replace with its corresponding value .
"""
    Given an array of words, replace any words matching a key in dict_of_words_to_replace with its corresponding
    value.
    :param word_array: The array of words to check.
    :param dict_of_words_to_replace: The dictionary of words to replace paired with their replacements.
    :return: The new array of words.
    """
The new array of words.
The new array of words .
word_array
The array of words to check.
The array of words to check .
dict_of_words_to_replace
The dictionary of words to replace paired with their replacements.
The dictionary of words to replace paired with their replacements .