mirror of
https://github.com/infiniflow/ragflow.git
synced 2026-05-03 16:57:48 +08:00
Fixing WordNetCorpusReader object has no attribute _LazyCorpusLoader_… (#13600)
### What problem does this PR solve? Forces NLTK to load the corpus synchronously once, preventing concurrent tasks from triggering the lazy-loading race condition that cause Fixing WordNetCorpusReader object has no attribute _LazyCorpusLoader_… #13590 ### Type of change - [X] Bug Fix (non-breaking change which fixes an issue) Co-authored-by: shakeel <shakeel@lollylaw.com>
This commit is contained in:
@ -23,6 +23,13 @@ from nltk.corpus import wordnet
|
||||
from common.file_utils import get_project_base_directory
|
||||
|
||||
|
||||
# Forces NLTK to load the corpus synchronously once, preventing concurrent tasks
|
||||
# from triggering the lazy-loading race condition.
|
||||
try:
|
||||
wordnet.ensure_loaded()
|
||||
except Exception:
|
||||
logging.warning("Fail to load wordnet.ensure_loaded()")
|
||||
|
||||
class Dealer:
|
||||
def __init__(self, redis=None):
|
||||
|
||||
|
||||
Reference in New Issue
Block a user