import spacy import subprocess import logging import sys logging.basicConfig(level=logging.INFO) logger = logging.getLogger(__name__) try: nlp = spacy.load("en_core_web_sm") except OSError: logger.info("Model not found. Downloading...") subprocess.run([sys.executable, "-m", "spacy", "download", "en_core_web_sm"], check=True) nlp = spacy.load("en_core_web_sm") __all__ = ["nlp"]