Skip to content

Commit

Permalink
override nltk path
Browse files Browse the repository at this point in the history
  • Loading branch information
AlisoSouza committed Mar 4, 2024
1 parent bc29ee8 commit 4747957
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions app/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
from app.handlers.content_bases import ContentBaseHandler
from app.indexer.content_bases import ContentBaseIndexer
from app.embedders.embedders import SagemakerEndpointEmbeddingsKeys
import nltk


class App:
Expand All @@ -27,7 +28,13 @@ class App:
products_handler: IDocumentHandler
products_indexer: IDocumentIndexer

def override_nltk_path(self) -> None:
nltk_path = nltk.data.path
nltk_new_path = [f"/tmp{path}" for path in nltk_path]
nltk.data.path = nltk_new_path

def __init__(self, config: AppConfig):
self.override_nltk_path()
self.config = config
if config.embedding_type == "huggingface":
self.embeddings = HuggingFaceHubEmbeddings(
Expand Down

0 comments on commit 4747957

Please sign in to comment.