Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,7 @@
base2 = base.head(1000)

def remover_acentos(txt):
txt = normalize('NFKD', txt).encode('ASCII', 'ignore').decode('ASCII')
return txt
return normalize('NFKD', txt).encode('ASCII', 'ignore').decode('ASCII')

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Function remover_acentos refactored with the following changes:

  • Inline variable that is immediately returned (inline-immediately-returned-variable)


def remove_punctuations(text):
for punctuation in string.punctuation:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,12 +18,11 @@

def calcular_sentimento(text):
if text < 0.3:
resultado = 'Negativo'
return 'Negativo'
elif text > 0.7:
resultado = 'Positivo'
return 'Positivo'
else:
resultado = 'Neutro'
return resultado
return 'Neutro'
Comment on lines -21 to +25

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Function calcular_sentimento refactored with the following changes:

  • Lift return into if (lift-return-into-if)


curtir['situacao'] = curtir['resultado'].apply(calcular_sentimento)
amei['situacao'] = amei['resultado'].apply(calcular_sentimento)
Expand Down