def rectify_answer(generated_answer):
    """remove duplicate consecutive words
    e.g. My My Name Name -> My Name"""
    words = generated_answer.split()
    new_words = [words[0]]
    for w in words[1:]:
        if new_words[-1]!=w:
            new_words.append(w)

    return " ".join(new_words)