mirror of
https://github.com/Monadical-SAS/reflector.git
synced 2025-12-21 12:49:06 +00:00
fix: punkt -> punkt_tab + pre-download nltk packages to prevent runtime not working (#489)
This commit is contained in:
@@ -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(
|
||||
|
||||
Reference in New Issue
Block a user