Skip to content

Commit

Permalink
Feat: Fixed when a new word is not in vocabulary
Browse files Browse the repository at this point in the history
  • Loading branch information
SebastianCB-dev committed Dec 4, 2022
1 parent dfcb6e0 commit ef32b96
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 4 deletions.
2 changes: 1 addition & 1 deletion app.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
clf = joblib.load('./models/logistic_regression.pkl')

#comentario = "Me quiero suicidar este día no puede ser peor que el de ayer mi padre me odio y mi madre no me quiere ver"
comentario = "Me quiero suicidar este día no puede ser peor que el de ayer mi padre me odio y mi madre no me quiere ver"
comentario = "Hoy juega Chelsea vs Barcelona y me siento emocionado"
# Preprocesado del comentario
comentario_procesado = pp.preprocesamiento_con_ortografia(comentario)
if comentario_procesado == "":
Expand Down
Binary file modified depresion.model
Binary file not shown.
6 changes: 3 additions & 3 deletions model_word2vec_service.py
Original file line number Diff line number Diff line change
Expand Up @@ -61,15 +61,15 @@ def get_word_vectors(self, corpus):
:return: La palabra vector para la palabra.
"""
array_result = []
# TODO en error añadir al vocabulario y volver a llamar a la función
for word in corpus:
try:
array_result.append(self.model.wv[word])
except:
array_result.append(self.getVector250())
except Exception as e:
return self.getVector250()
return array_result

def get_cosine_similarity_BECK(self, corpus):
self.add_corpus(corpus)
beck = self.get_beck()
data = []
for item in beck.keys():
Expand Down

0 comments on commit ef32b96

Please sign in to comment.