fix: punkt -> punkt_tab + pre-download nltk packages to prevent runtime not working (#489)

This commit is contained in:
2025-07-16 18:58:57 -06:00
committed by GitHub
parent 86ce68651f
commit 0e2ae5fca8
2 changed files with 7 additions and 5 deletions

View File

@@ -45,7 +45,7 @@ class LLM:
downloads only if needed.
"""
if not cls._nltk_downloaded:
nltk.download("punkt")
nltk.download("punkt_tab")
# For POS tagging
nltk.download("averaged_perceptron_tagger")
cls._nltk_downloaded = True
@@ -222,7 +222,7 @@ class LLM:
title = modified_title[0].upper() + modified_title[1:]
except Exception as e:
reflector_logger.info(
f"Failed to ensure casing on {title=} " f"with exception : {str(e)}"
f"Failed to ensure casing on {title=} with exception : {str(e)}"
)
return title
@@ -245,9 +245,7 @@ class LLM:
)
title = re.sub(pattern, "", title, flags=re.IGNORECASE)
except Exception as e:
reflector_logger.info(
f"Failed to trim {title=} " f"with exception : {str(e)}"
)
reflector_logger.info(f"Failed to trim {title=} with exception : {str(e)}")
return title
async def _generate(