Skip to content

Commit

Permalink
fix: attribute error when trying to access lp.words
Browse files Browse the repository at this point in the history
Fixes #106
Fixes #104
  • Loading branch information
srevinsaju committed Feb 18, 2021
1 parent 1207272 commit 4dc9e2b
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 22 deletions.
42 changes: 21 additions & 21 deletions sugaroid/brain/canmay.py
Original file line number Diff line number Diff line change
Expand Up @@ -104,7 +104,7 @@ def process(self, statement, additional_response_selection_parameters=None):
response = (
"I should be able to {}, "
"but it all depends on updates which I have received".format(
self.chatbot.lp.words(verb)[0]
self.chatbot.lp.lemma(verb)[0]
)
)
emotion = Emotion.rich
Expand All @@ -126,7 +126,7 @@ def process(self, statement, additional_response_selection_parameters=None):
else:
if verb == "die":
response = "I wouild die only when you say 'Bye'"
elif self.chatbot.lp.words(verb)[0] in [
elif self.chatbot.lp.lemma(verb)[0] in [
"teach",
"tell",
"say",
Expand All @@ -135,16 +135,16 @@ def process(self, statement, additional_response_selection_parameters=None):
]:
response = (
"Sure! Just don't ask if I can {}. Just ask".format(
self.chatbot.lp.words(verb)[0]
self.chatbot.lp.lemma(verb)[0]
)
)
emotion = Emotion.angel
else:
if self.chatbot.lp.words(verb)[0] == "do":
if self.chatbot.lp.lemma(verb)[0] == "do":
confidence = 0
response = (
"I think I would not be able to {}. I apologize".format(
self.chatbot.lp.words(verb)[0]
self.chatbot.lp.lemma(verb)[0]
)
)
emotion = Emotion.cry_overflow
Expand All @@ -155,7 +155,7 @@ def process(self, statement, additional_response_selection_parameters=None):
response = (
"Sure, I would love to help {n} to {v}. "
"Share sugaroid with {n].".format(
n=noun, v=self.chatbot.lp.words(verb)[0]
n=noun, v=self.chatbot.lp.lemma(verb)[0]
)
)
emotion = Emotion.positive
Expand Down Expand Up @@ -183,7 +183,7 @@ def process(self, statement, additional_response_selection_parameters=None):
emotion = Emotion.angry
else:
response = "I am not sure if I could {verb}".format(
verb=self.chatbot.lp.words(verb)[0]
verb=self.chatbot.lp.lemma(verb)[0]
)
confidence = aimed / 100 + 0.7
elif aimed >= 75:
Expand All @@ -206,7 +206,7 @@ def process(self, statement, additional_response_selection_parameters=None):

else:
response = "I should be able to {}, but it all depends on updates which I have received".format(
self.chatbot.lp.words(verb)[0]
self.chatbot.lp.lemma(verb)[0]
)
emotion = Emotion.rich

Expand Down Expand Up @@ -251,11 +251,11 @@ def process(self, statement, additional_response_selection_parameters=None):
response = "Am I really {}".format(adj)
emotion = Emotion.non_expressive
elif verb:
if self.chatbot.lp.words(verb)[0] == "do":
if self.chatbot.lp.lemma(verb)[0] == "do":
confidence = 0
response = (
"I think I would not be able to {}. I apologize".format(
self.chatbot.lp.words(verb)[0]
self.chatbot.lp.lemma(verb)[0]
)
)
else:
Expand All @@ -275,7 +275,7 @@ def process(self, statement, additional_response_selection_parameters=None):
response = (
"Do you really want to {}. "
"Try rethinking your decision".format(
self.chatbot.lp.words(verb)[0]
self.chatbot.lp.lemma(verb)[0]
)
)
emotion = Emotion.non_expressive_left
Expand All @@ -291,11 +291,11 @@ def process(self, statement, additional_response_selection_parameters=None):
emotion = Emotion.github
else:
response = "I guess, you would achieve your goal of {}ing".format(
self.chatbot.lp.words(verb)[0]
self.chatbot.lp.lemma(verb)[0]
)
emotion = Emotion.positive
else:
if self.chatbot.lp.words(verb)[0] in [
if self.chatbot.lp.lemma(verb)[0] in [
"cry",
"sob",
"sleep",
Expand All @@ -306,13 +306,13 @@ def process(self, statement, additional_response_selection_parameters=None):
response = (
"Why do you want to {}, "
"there are many better things to do in life".format(
self.chatbot.lp.words(verb)[0]
self.chatbot.lp.lemma(verb)[0]
)
)
emotion = Emotion.adorable
else:
response = "No, probably not, you shouldn't {}".format(
self.chatbot.lp.words(verb)[0]
self.chatbot.lp.lemma(verb)[0]
)
emotion = Emotion.positive
confidence = aimed / 100 + 0.9
Expand All @@ -326,21 +326,21 @@ def process(self, statement, additional_response_selection_parameters=None):
verb = "do"
noun = "that"
response = "Well. I am unsure if you really need to {} {}".format(
self.chatbot.lp.words(verb)[0], noun
self.chatbot.lp.lemma(verb)[0], noun
)
confidence = confidence - 0.2
emotion = Emotion.cry_overflow
elif sentiments["neg"] > sentiments["pos"]:
response = (
"Well I think, its a bad thing to do. "
"You shouldn't {} {}".format(
self.chatbot.lp.words(verb)[0], noun
self.chatbot.lp.lemma(verb)[0], noun
)
)
emotion = Emotion.negative
else:
response = "I guess its good thing which you have thought about. You should {} {}".format(
self.chatbot.lp.words(verb)[0], noun
self.chatbot.lp.lemma(verb)[0], noun
)
emotion = Emotion.positive

Expand All @@ -364,7 +364,7 @@ def process(self, statement, additional_response_selection_parameters=None):
elif sentiments["neg"] > sentiments["pos"]:
response = (
"Well I think, its a bad thing to do. I wouldn't {} {}".format(
self.chatbot.lp.words(verb)[0], noun
self.chatbot.lp.lemma(verb)[0], noun
)
)
emotion = Emotion.dead
Expand All @@ -374,15 +374,15 @@ def process(self, statement, additional_response_selection_parameters=None):
response = (
"I guess its good thing which you have thought about. Me being a bot, "
"wouldn't be able to do that. You should {} like {}".format(
self.chatbot.lp.words(verb)[0], noun
self.chatbot.lp.lemma(verb)[0], noun
)
)
emotion = Emotion.dead
else:
response = (
"I guess its good thing which you have thought about. Me being a bot, "
"wouldn't be able to do that. You should probably {} {}".format(
self.chatbot.lp.words(verb)[0], noun
self.chatbot.lp.lemma(verb)[0], noun
)
)
emotion = Emotion.neutral
Expand Down
2 changes: 1 addition & 1 deletion sugaroid/sugaroid.py
Original file line number Diff line number Diff line change
Expand Up @@ -108,7 +108,7 @@ def __init__(
"sugaroid.brain.play.PlayAdapter",
]
self.adapters = [
"sugaroid.brain.convert.CurrencyAdapter",
#"sugaroid.brain.convert.CurrencyAdapter",
"sugaroid.brain.trivia.TriviaAdapter",
"sugaroid.brain.let.LetAdapter",
"sugaroid.brain.whatwhat.WhatWhatAdapter",
Expand Down

0 comments on commit 4dc9e2b

Please sign in to comment.