def change_to_similar_character_if_needed(predicted_letter: str,
                                          first_character_of_word: bool,
                                          is_word_letters: bool) -> str:
    """
    Alter the predicted character to a character that looks similar, from
    numbers to letters. In case the character is a number positioned in
    the middle of a word, replace it with a letter that is visually
    similar (the model is inaccurate at times).
    """
    if not first_character_of_word and is_word_letters:
        # the word is made of letters
        if predicted_letter == '0':
            predicted_letter = 'o'
        elif predicted_letter == '1':
            predicted_letter = 'i'
        elif predicted_letter == '2':
            predicted_letter = 'z'
        elif predicted_letter == '5':
            predicted_letter = 's'

    return predicted_letter