@staticmethod
def ensure_proper_language_model(nlp):
    """Checks if the spacy language model is properly loaded. Raises an exception if the model is invalid."""
    if nlp is None:
        raise Exception(
            "Failed to load spacy language model. Loading the model returned 'None'."
            )
    if nlp.path is None:
        raise Exception(
            "Failed to load spacy language model for lang '{}'. ".format(
            nlp.lang) +
            'Make sure you have downloaded the correct model (https://spacy.io/docs/usage/).'
            )
