Skip to content

Commit

Permalink
Add files via upload
Browse files Browse the repository at this point in the history
  • Loading branch information
Egoluback authored May 18, 2021
1 parent c681c00 commit 029d5ac
Showing 1 changed file with 1 addition and 6 deletions.
7 changes: 1 addition & 6 deletions main.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,9 +28,6 @@ def tokenize_sentence(sentence: str, remove_stop_words: bool = True):
@bot.message_handler(content_types = ['text'])
def reply(message):
text = message.text
# result_ins = model_ins.predict([text])[0]
# result_thr = model_thr.predict([text])[0]
# result_obs = model_obs.predict([text])[0]

result_ins = round(model_ins.predict_proba([text]).T[1][0], 4)
result_thr = round(model_thr.predict_proba([text]).T[1][0], 4)
Expand All @@ -41,10 +38,8 @@ def reply(message):
print('------')

if (result_ins < 0.5 and result_thr < 0.5 and result_obs < 0.5): return

ans = f"Это оскорбление с вероятностью {result_ins}\nЭто угроза с вероятностью {result_thr}\nЭто домогательство с вероятностью {result_obs}\n"

bot.reply_to(message, ans)
bot.reply_to(message, f"Это оскорбление с вероятностью {result_ins}\nЭто угроза с вероятностью {result_thr}\nЭто домогательство с вероятностью {result_obs}\n")


bot.polling()

0 comments on commit 029d5ac

Please sign in to comment.