habulaj commited on
Commit
903eeb7
verified
1 Parent(s): 0ccdbc6

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +7 -2
app.py CHANGED
@@ -1,16 +1,21 @@
1
  import spacy
2
  from fastapi import FastAPI, HTTPException
3
  from pydantic import BaseModel
4
- import nltk
5
  from nltk.tokenize import word_tokenize
6
  from nltk.corpus import stopwords
7
  from collections import Counter
8
  import re
 
 
9
 
10
- # Baixar as stopwords do NLTK (se ainda n茫o tiver feito)
 
 
 
11
  nltk.download('punkt')
12
  nltk.download('stopwords')
13
 
 
14
  # Carregar o modelo spaCy para reconhecimento de entidades nomeadas
15
  nlp = spacy.load("en_core_web_sm")
16
 
 
1
  import spacy
2
  from fastapi import FastAPI, HTTPException
3
  from pydantic import BaseModel
 
4
  from nltk.tokenize import word_tokenize
5
  from nltk.corpus import stopwords
6
  from collections import Counter
7
  import re
8
+ import os
9
+ import nltk
10
 
11
+ # Definir um diret贸rio local para armazenar dados do NLTK
12
+ os.environ['NLTK_DATA'] = './nltk_data' # Dentro do diret贸rio do projeto, por exemplo
13
+
14
+ # Baixar os pacotes necess谩rios
15
  nltk.download('punkt')
16
  nltk.download('stopwords')
17
 
18
+
19
  # Carregar o modelo spaCy para reconhecimento de entidades nomeadas
20
  nlp = spacy.load("en_core_web_sm")
21