def _download_nltk_data(self) -> None:
        """Download NLTK data packages in the background."""
        from nltk.data import find as nltk_find
        from nltk import download

        try:
            # Download stopwords
            try:
                nltk_find("corpora/stopwords", paths=[self._nltk_data_dir])
            except LookupError:
                download("stopwords", download_dir=self._nltk_data_dir, quiet=True)

            # Download punkt tokenizer
            try:
                nltk_find("tokenizers/punkt_tab", paths=[self._nltk_data_dir])
            except LookupError:
                download("punkt_tab", download_dir=self._nltk_data_dir, quiet=True)

        except Exception as e:
            print(f"NLTK download error: {e}")
Download NLTK data packages in the background.
llama-index-core/llama_index/core/utils.py