def get_english_words(dictionary_path):
    """Returns a set of trimmed, capitalized English words from a path to a dictionary.

    The dictionary is assumed to have one English word per line.

    If dictionary_path can not be read or is formatted incorrectly, a default English word
    set is returned containing some fruits.

    Note that we keep the file open for as little time as possible, which is
    generally a good practice. One downside of this implementation is that it
    buffers all of the words in memory (first as a string, and later as a collection
    of lines, but the word list is a known finite size (and that size isn't *too*
    big), so this approach will work fine. Iterating through the lines in the file
    with a for loop could mitigate this downside.

    We then use a set comprehension to build an uppercased collection of all of
    the words in the dictionary.

    Note that we choose to represent the English words as a set, because we want fast
    membership testing (using `in`) and also want to be able to iterate over all words.
    """
    try:
        with open(dictionary_path, 'r') as f:
            content = f.read()
        return {line.strip().upper() for line in content.split('\n') if line}
    except OSError:
        return {'APPLE', 'BANANA', 'PEAR', 'ORANGE'}