From 61c0f5482cf4e8caa6a3921343f272dffe9cc9a9 Mon Sep 17 00:00:00 2001 From: Alex Fan Date: Tue, 14 Apr 2020 15:38:16 -0700 Subject: [PATCH 1/9] error edits --- .idea/NBAchatbot.iml | 2 +- hw_lexicon_entity_matching.py | 20 +++++++++++++++++--- 2 files changed, 18 insertions(+), 4 deletions(-) diff --git a/.idea/NBAchatbot.iml b/.idea/NBAchatbot.iml index 55faa5e..8bb3e80 100644 --- a/.idea/NBAchatbot.iml +++ b/.idea/NBAchatbot.iml @@ -2,7 +2,7 @@ - + \ No newline at end of file diff --git a/hw_lexicon_entity_matching.py b/hw_lexicon_entity_matching.py index 17aa6c0..497e9db 100644 --- a/hw_lexicon_entity_matching.py +++ b/hw_lexicon_entity_matching.py @@ -45,6 +45,8 @@ class State(Enum): TURNPF1S = auto() TURNPF1U = auto() TURNPF1ERR = auto() + TURNPF1ERRU = auto() + TURNPF1ERR1S = auto() TURNPF2AS = auto() TURNPF2AU = auto() TURNPF2BS = auto() @@ -447,16 +449,28 @@ def run (self, ngrams, vars, args): possible_results = '[{' \ 'better,worse,obliterate,crush,destroy,change,effect,difference,improve,adjust,adapt,implications,good,bad,weird' \ '}]' +end = '[{'\ + 'end,stop,terminate,cease'\ + '}]' + +proceed = '[{'\ + 'keep,continue,proceed,go on,carry on'\ + '}]' """playoffs turns""" #turn 1 -df.add_system_transition(State.START, State.TURNPF1U, r'[! "Hi I am NBA chatbot. The NBA season has been shutdown because of COVID. If we played playoffs based off the current standings, which team do you think would win?"]') +df.add_system_transition(State.START, State.TURNPF1U, r'[! "Hi I am NBA chatbot. The NBA season has been {shutdown,suspended,put on hold} because of COVID. ' + r' If we played playoffs {just based off the current standings,today,right now} though, which team do you think would win?"]') df.add_user_transition(State.TURNPF1U, State.TURNPF2AS, dont_know) df.add_user_transition(State.TURNPF1U, State.TURNPF2CS, '[#ONT(nonplayoffteams)]') df.add_user_transition(State.TURNPF1U, State.TURNPF2BS, '[$favUserTeam=#ONT(playoffteams)]') -df.set_error_successor(State.TURNPF1U, State.TURNPF1ERR) -df.add_system_transition(State.TURNPF1ERR, State.TURNPF2AS, 'Picking userTeam') +df.set_error_successor(State.TURNPF1U, State.TURNPF1ERR) +df.add_system_transition(State.TURNPF1ERR, State.TURNPF1ERRU, r'[! "Hmm, I dont think that is an NBA team. Do you want to keep talking? ' + r'We can either stop the conversation here and talk about something else, or I can keep on talking with you about a team that I think can win!"]') +df.add_user_transition(State.TURNPF1ERRU, State.END, end) +df.add_user_transition(State.TURNPF1ERRU, State.TURNPF1ERR1S, proceed) +df.add_system_transition(State.TURNPF1ERR1S, State.TURNPF2AU, r'[! #botFavTeam "Okay! I hope this will still be fun. I think that" $favSysTeam "can win the playoffs even with the unpredictability of the whole thing. What do you think?"]') #idk scenario df.add_system_transition(State.TURNPF2CS, State.TURNPF2AU, r'[! #botFavTeam "I dont think that team will be in the playoffs. But you know, I think that " $favSysTeam " can win. Do you agree?"]') From d987a9599e78bc1669199f3c939c613fc2fc1de3 Mon Sep 17 00:00:00 2001 From: shchung1234 Date: Tue, 14 Apr 2020 21:28:15 -0400 Subject: [PATCH 2/9] test --- hw_lexicon_entity_matching.py | 12 +++++++----- teams.json | 5 ++++- 2 files changed, 11 insertions(+), 6 deletions(-) diff --git a/hw_lexicon_entity_matching.py b/hw_lexicon_entity_matching.py index 70bfded..932d04c 100644 --- a/hw_lexicon_entity_matching.py +++ b/hw_lexicon_entity_matching.py @@ -253,7 +253,7 @@ def run (self, ngrams, vars, args): return "I found this most recent trade news that {} from {} is going to {}".format(player, givingTeam, receivingTeam) -class tradeNews(Macro): +class tradeNews(Macro): #this won't run because the range is changed due to change in json def run (self, ngrams, vars, args): with open('trades.json') as f: data = json.load(f) @@ -315,7 +315,7 @@ def run (self, ngrams, vars, args): #print(player) #print(role) - return "I found this most recent trade news that {} from {} is going to {}".format(player, givingTeam, receivingTeam) + return "{} from {} went to {}".format(player, givingTeam, receivingTeam) class goodBadTrade(Macro): @@ -489,7 +489,7 @@ def run (self, ngrams, vars, args): df.add_system_transition(State.TURNPF1ERR, State.TURNPF2AS, 'Picking userTeam') -#idk scenario +#idk scenario df.add_system_transition(State.TURNPF2CS, State.TURNPF2AU, r'[! #botFavTeam "I dont think that team will be in the playoffs. But you know, I think that " $favSysTeam " can win. Do you agree?"]') df.add_system_transition(State.TURNPF2AS, State.TURNPF2AU, r'[! #botFavTeam "It is okay to be unsure because predictability of playoffs is difficult without more data. I think that " $favSysTeam " can win. Do you agree?"]') df.add_user_transition(State.TURNPF2AU, State.TURNPF3AS, '[#ONT(agree)]') #can probably have a turn in here which catches the user saying another team, that will handle implicit no @@ -530,8 +530,10 @@ def run (self, ngrams, vars, args): #turn 0 #todo need to run trade macro up here to get the trades specific to teams #TURNPF5S comes from the idk scenario. will probably need to add in some things to engage more with user response, this is generic catcher -df.add_system_transition(State.TURNTRADE0AS, State.TURNTRADE0U, r'[! "Fair enough. Earlier in the season " #tradeNewsByTeam]') #I heard that" $receivingTeam "had traded for " $player ". Do you think that trade had repercussions for playoffs?"]') -df.add_system_transition(State.TURNTRADE0S, State.TURNTRADE0U, r'[! "Earlier in the season I heard that" #tradeNewsByTeam ". Do you think that trade had repercussions for playoffs?"]') +df.add_system_transition(State.START, State.TURNTRADE0AS, r'lalala') +df.add_system_transition(State.TURNTRADE0AS, State.TURNTRADE0U, r'[! "Fair enough. I think this year is interesting because there were several trades around playoff teams.' + r' you remember" #tradeNewsByTeam] " earlier this season?"') #I heard that" $receivingTeam "had traded for " $player ". Do you think that trade had repercussions for playoffs?"]') +df.add_system_transition(State.TURNTRADE0S, State.TURNTRADE0U, r'[! "Earlier in the season I heard that" #tradeNewsByTeam ". Do you think that this could impact playoffs in any way?"]') df.add_user_transition(State.TURNTRADE0U, State.TURNTRADE1S, "[#ONT(agree)]") #df.add_user_transition(State.TURNTRADE0U, State.TURNTRADE1S, "[ONT(disagree)]") df.add_user_transition(State.TURNTRADE0U, State.TURN0DK1S, dont_know) diff --git a/teams.json b/teams.json index 627924c..53f3abb 100644 --- a/teams.json +++ b/teams.json @@ -1879,7 +1879,10 @@ "blocks", "field goals", "three", - "fouls" + "fouls", + "good", + "bad", + "potential" ] } } \ No newline at end of file From 7fef50047a2aa12d8bb11ffecd8b03f20a299307 Mon Sep 17 00:00:00 2001 From: Alex Fan Date: Tue, 14 Apr 2020 18:57:41 -0700 Subject: [PATCH 3/9] errors --- hw_lexicon_entity_matching.py | 20 ++++++++++++-------- teams.json | 3 ++- 2 files changed, 14 insertions(+), 9 deletions(-) diff --git a/hw_lexicon_entity_matching.py b/hw_lexicon_entity_matching.py index 497e9db..14d2045 100644 --- a/hw_lexicon_entity_matching.py +++ b/hw_lexicon_entity_matching.py @@ -49,6 +49,7 @@ class State(Enum): TURNPF1ERR1S = auto() TURNPF2AS = auto() TURNPF2AU = auto() + TURNPF2A_DK = auto() TURNPF2BS = auto() TURNPF2BS1 = auto() TURNPF2BU1 = auto() @@ -459,8 +460,8 @@ def run (self, ngrams, vars, args): """playoffs turns""" #turn 1 -df.add_system_transition(State.START, State.TURNPF1U, r'[! "Hi I am NBA chatbot. The NBA season has been {shutdown,suspended,put on hold} because of COVID. ' - r' If we played playoffs {just based off the current standings,today,right now} though, which team do you think would win?"]') +df.add_system_transition(State.START, State.TURNPF1U, r'[! "Hi I am NBA chatbot. The NBA season has been" {shutdown,suspended,put on hold} "because of COVID. ' + r' If we played playoffs" {just based off the current standings,today,right now} "though, which team do you think would win?"]') df.add_user_transition(State.TURNPF1U, State.TURNPF2AS, dont_know) df.add_user_transition(State.TURNPF1U, State.TURNPF2CS, '[#ONT(nonplayoffteams)]') df.add_user_transition(State.TURNPF1U, State.TURNPF2BS, '[$favUserTeam=#ONT(playoffteams)]') @@ -473,21 +474,24 @@ def run (self, ngrams, vars, args): df.add_system_transition(State.TURNPF1ERR1S, State.TURNPF2AU, r'[! #botFavTeam "Okay! I hope this will still be fun. I think that" $favSysTeam "can win the playoffs even with the unpredictability of the whole thing. What do you think?"]') #idk scenario -df.add_system_transition(State.TURNPF2CS, State.TURNPF2AU, r'[! #botFavTeam "I dont think that team will be in the playoffs. But you know, I think that " $favSysTeam " can win. Do you agree?"]') -df.add_system_transition(State.TURNPF2AS, State.TURNPF2AU, r'[! #botFavTeam "It is okay to be unsure because predictability of playoffs is difficult without more data. I think that " $favSysTeam " can win. Do you agree?"]') +df.add_system_transition(State.TURNPF2CS, State.TURNPF2AU, r'[! #botFavTeam "I dont think that team will be in the playoffs. But you know, I think that" $favSysTeam "can win. Do you agree?"]') +df.add_system_transition(State.TURNPF2AS, State.TURNPF2AU, r'[! #botFavTeam "Its okay to be unsure because predictability of playoffs is difficult without more data. I think that " $favSysTeam " can win. Do you agree?"]') df.add_user_transition(State.TURNPF2AU, State.TURNPF3AS, '[#ONT(agree)]') df.add_user_transition(State.TURNPF2AU, State.TURNPF3BS, '[#ONT(disagree)]') +df.add_user_transition(State.TURNPF2AU, State.TURNPF2A_DK, dont_know) df.set_error_successor(State.TURNPF2AU, State.TURNPF2AERR) -df.add_system_transition(State.TURNPF2AERR, State.TURNPF3AS, 'uncertain about playoff team') +df.add_system_transition(State.TURNPF2AERR, State.TURNPF5U, r'[! "Thats an interesting take for sure. Personally, I think" $favSysTeam "will win because of" $favSysPlayer ". What do you think of" $favSysPlayer "?"]') +df.add_system_transition(State.TURNPF2A_DK, State.TURNPF5U, r'[! "Oh, are you not sure? Personally, I think" $favSysTeam "will win because of" $favSysPlayer ". What do you think of" $favSysPlayer "?"]') df.add_system_transition(State.TURNPF3AS, State.TURNPF3AU, r'[! "I always love meeting other fans of " $favSysTeam " Why do you think " $favSysTeam " is going to win?"]') df.add_system_transition(State.TURNPF3BS, State.TURNPF3AU, r'[! "Why do you think " $favSysTeam " will not win?"]') df.add_user_transition(State.TURNPF3AU, State.TURNPF4S, '[/[a-z A-Z]+/]') #pull any response here #this state throws an error because comparePlayers (or new Macro) needs to be able to work without having user input df.add_system_transition(State.TURNPF4S, State.TURNPF5U, r'[! "That is a good opinion. Personally, I think " $favSysTeam "will win because of " $favSysPlayer ". What do you think of " $favSysPlayer "?"]') #todo modify comparePlayer to work with either sysplayer or userplayer #error transition for turn 3 -#df.set_error_successor(State.TURNPF3AU, State.TURNPF3AERR) -#df.add_system_transition(State.TURNPF3AERR, State.TURN) +df.set_error_successor(State.TURNPF3AU, State.TURNPF3AERR) +df.add_system_transition(State.TURNPF3AERR, State.TURNPF5U, r'[! "That is a good opinion. Personally, I think " $favSysTeam "will win because of " $favSysPlayer ". What do you think of " $favSysPlayer "?"]') #todo modify comparePlayer to work with either sysplayer or userplayer + # Playoff Turn 2 (not idk scenario) df.add_system_transition(State.TURNPF2BS, State.TURNPF2BU, r'[! #botFavTeam "Why do you think" $favUserTeam "will win?"]') @@ -499,7 +503,7 @@ def run (self, ngrams, vars, args): df.add_user_transition(State.TURNPF2BU1, State.TURNPF3CS, "[$favUserPlayer=[#ONT(playoffteams)]]") #todo make ontology for players who are in and not in playoffs df.set_error_successor(State.TURNPF2BU1, State.TURNPF2BU_ERR2) -#df.add_system_transition(State.TURNPF2BU_ERR2, State.TURNPFU, r'[! "Thats fair. Personally, I think that" $favSysTeam "has the best chance of winning because of" $favSysPlayer]') +df.add_system_transition(State.TURNPF2BU_ERR2, State.TURNP5U, r'[! "Thats fair. Personally, I think that" $favSysTeam "has the best chance of winning because of" $favSysPlayer]') # Playoff Turn 3 df.add_system_transition(State.TURNPF3CS, State.TURNPF3U, r'[! "I think that " #comparePlayers ". What is your opinion?]') diff --git a/teams.json b/teams.json index b78975f..fe12ec6 100644 --- a/teams.json +++ b/teams.json @@ -1843,7 +1843,8 @@ "do", "of course", "sure", - "cool" + "cool", + "too" ], "disagree": [ "no", From ed68cbb2d395874ccf8d18fbeb646bed43935b53 Mon Sep 17 00:00:00 2001 From: shchung1234 Date: Tue, 14 Apr 2020 22:01:56 -0400 Subject: [PATCH 4/9] re --- hw_lexicon_entity_matching.py | 1 - 1 file changed, 1 deletion(-) diff --git a/hw_lexicon_entity_matching.py b/hw_lexicon_entity_matching.py index 932d04c..ed482c7 100644 --- a/hw_lexicon_entity_matching.py +++ b/hw_lexicon_entity_matching.py @@ -530,7 +530,6 @@ def run (self, ngrams, vars, args): #turn 0 #todo need to run trade macro up here to get the trades specific to teams #TURNPF5S comes from the idk scenario. will probably need to add in some things to engage more with user response, this is generic catcher -df.add_system_transition(State.START, State.TURNTRADE0AS, r'lalala') df.add_system_transition(State.TURNTRADE0AS, State.TURNTRADE0U, r'[! "Fair enough. I think this year is interesting because there were several trades around playoff teams.' r' you remember" #tradeNewsByTeam] " earlier this season?"') #I heard that" $receivingTeam "had traded for " $player ". Do you think that trade had repercussions for playoffs?"]') df.add_system_transition(State.TURNTRADE0S, State.TURNTRADE0U, r'[! "Earlier in the season I heard that" #tradeNewsByTeam ". Do you think that this could impact playoffs in any way?"]') From f191661ba7fa6d4577dbdb145075c4fb82e4d125 Mon Sep 17 00:00:00 2001 From: Anthony Date: Tue, 14 Apr 2020 22:32:38 -0400 Subject: [PATCH 5/9] checking Alex's work --- hw_lexicon_entity_matching.py | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/hw_lexicon_entity_matching.py b/hw_lexicon_entity_matching.py index cfcf192..47daafc 100644 --- a/hw_lexicon_entity_matching.py +++ b/hw_lexicon_entity_matching.py @@ -318,7 +318,7 @@ def run (self, ngrams, vars, args): #print(player) #print(role) - return "I found this most recent trade news that {} from {} is going to {}".format(player, givingTeam, receivingTeam) + return "{} from {} went to {}".format(player, givingTeam, receivingTeam) class goodBadTrade(Macro): @@ -536,20 +536,19 @@ def run (self, ngrams, vars, args): df.add_user_transition(State.TURNPF2BU1, State.TURNPF3CS, '[$favUserPlayer=[#ONT(playoffteams)]]') #todo make ontology for players who are in and not in playoffs and need to match it to make sure the player is actually on the team df.set_error_successor(State.TURNPF2BU1, State.TURNPF2BU_ERR2) -df.add_system_transition(State.TURNPF2BU_ERR2, State.TURNP5U, r'[! "Thats fair. Personally, I think that" $favSysTeam "has the best chance of winning because of" $favSysPlayer]') +df.add_system_transition(State.TURNPF2BU_ERR2, State.TURNPF5U, r'[! "Thats fair. Personally, I think that" $favSysTeam "has the best chance of winning because of" $favSysPlayer ". He is my hometown hero. What do you think of Kawhi Leonard?"]') # Playoff Turn 3 df.add_system_transition(State.TURNPF3CS, State.TURNPF3U, r'[! "I think that it is " #comparePlayers ". What is your opinion?"]') df.add_user_transition(State.TURNPF3U, State.TURNTRADE0S, "[#ONT(rationale)]") #need to add another way to transition to the trades here - +df.add_user_transition(State.TURNPF3U, State.TURNTRADE0AS, '[/[a-z A-Z]+/]') df.add_user_transition(State.TURNPF5U, State.TURNTRADE0AS, '[/[a-z A-Z]+/]') """trades turns""" #turn 0 -#todo need to run trade macro up here to get the trades specific to teams #TURNPF5S comes from the idk scenario. will probably need to add in some things to engage more with user response, this is generic catcher -df.add_system_transition(State.TURNTRADE0AS, State.TURNTRADE0U, r'[! "Fair enough. Earlier in the season " #tradeNewsByTeam]') #I heard that" $receivingTeam "had traded for " $player ". Do you think that trade had repercussions for playoffs?"]') +df.add_system_transition(State.TURNTRADE0AS, State.TURNTRADE0U, r'[! "Fair enough. Earlier in the season " #tradeNewsByTeam ". do you think that impacted how " $receivingTeam " seeded into playoffs?"]') #I heard that" $receivingTeam "had traded for " $player ". Do you think that trade had repercussions for playoffs?"]') df.add_system_transition(State.TURNTRADE0S, State.TURNTRADE0U, r'[! "Earlier in the season I heard that" #tradeNewsByTeam ". Do you think that trade had repercussions for playoffs?"]') df.add_user_transition(State.TURNTRADE0U, State.TURNTRADE1S, "[#ONT(agree)]") #df.add_user_transition(State.TURNTRADE0U, State.TURNTRADE1S, "[ONT(disagree)]") From 47d9e8bf8e321a770073649527dc124ba68a58c4 Mon Sep 17 00:00:00 2001 From: Anthony Date: Tue, 14 Apr 2020 23:09:06 -0400 Subject: [PATCH 6/9] a bit more detail --- hw_lexicon_entity_matching.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/hw_lexicon_entity_matching.py b/hw_lexicon_entity_matching.py index 47daafc..63c6d4f 100644 --- a/hw_lexicon_entity_matching.py +++ b/hw_lexicon_entity_matching.py @@ -529,7 +529,7 @@ def run (self, ngrams, vars, args): df.add_system_transition(State.TURNPF2BS, State.TURNPF2BU, r'[! #botFavTeam "Why do you think" $favUserTeam "will win?"]') df.add_user_transition(State.TURNPF2BU, State.TURNPF2BS1, '[$rationale=[#ONT(rationale)]]') # can change it to pick up a specific player too but again, needs to make sure player is actually on that team df.set_error_successor(State.TURNPF2BU, State.TURNPF2BU_ERR2) -df.add_system_transition(State.TURNPF2BU_ERR2, State.TURNPF3U, r'[! "Thats fair. Personally, I think that the" $favSysTeam "have the best chance of winning because of" $favSysPlayer]') #todo make sure this transition goes into the correct user transition +df.add_system_transition(State.TURNPF2BU_ERR2, State.TURNPF3U, r'[! "Thats fair. Personally, I do not think that " $favUserTeam " are that good. I think that the" $favSysTeam "have the best chance of winning because of" $favSysPlayer]') #todo make sure this transition goes into the correct user transition #ANDREW - System dosen't ask question, as a user idk how to respond to "Thats fair. Personally, I think that Bucks has the best chance of winning because of Giannis Antetokounmpo" df.add_system_transition(State.TURNPF2BS1, State.TURNPF2BU1, r'[! "Do you think there is a player that is integral to their team?"]') From fb31405af931e60f6a80b850d9f3dd3671ee4488 Mon Sep 17 00:00:00 2001 From: Anthony Date: Tue, 14 Apr 2020 23:32:44 -0400 Subject: [PATCH 7/9] removed todo comments --- hw_lexicon_entity_matching.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/hw_lexicon_entity_matching.py b/hw_lexicon_entity_matching.py index 63c6d4f..7a69e6d 100644 --- a/hw_lexicon_entity_matching.py +++ b/hw_lexicon_entity_matching.py @@ -519,10 +519,10 @@ def run (self, ngrams, vars, args): df.add_system_transition(State.TURNPF3BS, State.TURNPF3AU, r'[! "Why do you think " $favSysTeam " will not win?"]') df.add_user_transition(State.TURNPF3AU, State.TURNPF4S, '[/[a-z A-Z]+/]') #pull any response here #this state throws an error because comparePlayers (or new Macro) needs to be able to work without having user input -df.add_system_transition(State.TURNPF4S, State.TURNPF5U, r'[! "That is a good opinion. Personally, I think " $favSysTeam "will win because of " $favSysPlayer ". What do you think of " $favSysPlayer "?"]') #todo modify comparePlayer to work with either sysplayer or userplayer +df.add_system_transition(State.TURNPF4S, State.TURNPF5U, r'[! "That is a good opinion. Personally, I think " $favSysTeam "will win because of " $favSysPlayer ". What do you think of " $favSysPlayer "?"]') #error transition for turn 3 df.set_error_successor(State.TURNPF3AU, State.TURNPF3AERR) -df.add_system_transition(State.TURNPF3AERR, State.TURNPF5U, r'[! "That is a good opinion. Personally, I think " $favSysTeam "will win because of " $favSysPlayer ". What do you think of " $favSysPlayer "?"]') #todo modify comparePlayer to work with either sysplayer or userplayer +df.add_system_transition(State.TURNPF3AERR, State.TURNPF5U, r'[! "That is a good opinion. Personally, I think " $favSysTeam "will win because of " $favSysPlayer ". What do you think of " $favSysPlayer "?"]') # Playoff Turn 2 (not idk scenario) @@ -540,7 +540,7 @@ def run (self, ngrams, vars, args): # Playoff Turn 3 df.add_system_transition(State.TURNPF3CS, State.TURNPF3U, r'[! "I think that it is " #comparePlayers ". What is your opinion?"]') -df.add_user_transition(State.TURNPF3U, State.TURNTRADE0S, "[#ONT(rationale)]") #need to add another way to transition to the trades here +df.add_user_transition(State.TURNPF3U, State.TURNTRADE0S, "[$teamRationale=[#ONT(rationale)]]") #need to add another way to transition to the trades here df.add_user_transition(State.TURNPF3U, State.TURNTRADE0AS, '[/[a-z A-Z]+/]') df.add_user_transition(State.TURNPF5U, State.TURNTRADE0AS, '[/[a-z A-Z]+/]') From cfd8323c23f815a6ba889292646abddbd15f145a Mon Sep 17 00:00:00 2001 From: shchung1234 Date: Wed, 15 Apr 2020 18:33:44 -0400 Subject: [PATCH 8/9] work in progress --- .idea/NBAchatbot.iml | 2 +- hw_lexicon_entity_matching.py | 22 +++++++++++++--------- trades.json | 9 --------- 3 files changed, 14 insertions(+), 19 deletions(-) diff --git a/.idea/NBAchatbot.iml b/.idea/NBAchatbot.iml index 8bb3e80..55faa5e 100644 --- a/.idea/NBAchatbot.iml +++ b/.idea/NBAchatbot.iml @@ -2,7 +2,7 @@ - + \ No newline at end of file diff --git a/hw_lexicon_entity_matching.py b/hw_lexicon_entity_matching.py index 7a69e6d..ba7dccc 100644 --- a/hw_lexicon_entity_matching.py +++ b/hw_lexicon_entity_matching.py @@ -18,6 +18,7 @@ class State(Enum): TURN0DK1U = auto() TURN0ERR = auto() TURNTRADE1S = auto() + TURNTRADE1S1 = auto() TURNTRADE1U = auto() TURNTRADE1ERR = auto() TURNTRADE1BS = auto() @@ -261,7 +262,7 @@ def run (self, ngrams, vars, args): with open('trades.json') as f: data = json.load(f) trades = data['trades'] - trade = trades[randrange(55)]['TRANSACTION_DESCRIPTION'] + trade = trades[randrange(len(trades))]['TRANSACTION_DESCRIPTION'] receivingTeam = trade.split(' received')[0] givingTeam = trade.split('from ')[1] givingTeam = givingTeam[:-1] @@ -283,7 +284,7 @@ def run (self, ngrams, vars, args): #print(player) #print(role) - return "I found this most recent trade news that {} from {} is going to {}".format(player, givingTeam, receivingTeam) + return "{} from {} went to {}".format(player, givingTeam, receivingTeam) class tradeNewsByTeam(Macro): def run (self, ngrams, vars, args): @@ -371,7 +372,8 @@ def run (self, ngrams, vars, args): for i in range(2): s += n[0][i] s += "01" - if (n[0] == "Marcus" and n[1] == "Morris"): playerid = "morrima02" + playerid = s.lower() + #if (n[0] == "Marcus" and n[1] == "Morris"): playerid = "morrima02" player = Player(playerid) position = player.position exp = player.games_played @@ -527,9 +529,9 @@ def run (self, ngrams, vars, args): # Playoff Turn 2 (not idk scenario) df.add_system_transition(State.TURNPF2BS, State.TURNPF2BU, r'[! #botFavTeam "Why do you think" $favUserTeam "will win?"]') -df.add_user_transition(State.TURNPF2BU, State.TURNPF2BS1, '[$rationale=[#ONT(rationale)]]') # can change it to pick up a specific player too but again, needs to make sure player is actually on that team +df.add_user_transition(State.TURNPF2BU, State.TURNPF2BS1, '[$rationale=[#ONT(rationale)]]') #?? can change it to pick up a specific player too but again, needs to make sure player is actually on that team df.set_error_successor(State.TURNPF2BU, State.TURNPF2BU_ERR2) -df.add_system_transition(State.TURNPF2BU_ERR2, State.TURNPF3U, r'[! "Thats fair. Personally, I do not think that " $favUserTeam " are that good. I think that the" $favSysTeam "have the best chance of winning because of" $favSysPlayer]') #todo make sure this transition goes into the correct user transition +df.add_system_transition(State.TURNPF2BU_ERR2, State.TURNPF3U, r'[! "Thats fair. Personally, I do not think that " $favUserTeam "is that good. I think that the" $favSysTeam "have the best chance of winning because of" $favSysPlayer]') #todo make sure this transition goes into the correct user transition #ANDREW - System dosen't ask question, as a user idk how to respond to "Thats fair. Personally, I think that Bucks has the best chance of winning because of Giannis Antetokounmpo" df.add_system_transition(State.TURNPF2BS1, State.TURNPF2BU1, r'[! "Do you think there is a player that is integral to their team?"]') @@ -548,9 +550,10 @@ def run (self, ngrams, vars, args): """trades turns""" #turn 0 #TURNPF5S comes from the idk scenario. will probably need to add in some things to engage more with user response, this is generic catcher -df.add_system_transition(State.TURNTRADE0AS, State.TURNTRADE0U, r'[! "Fair enough. Earlier in the season " #tradeNewsByTeam ". do you think that impacted how " $receivingTeam " seeded into playoffs?"]') #I heard that" $receivingTeam "had traded for " $player ". Do you think that trade had repercussions for playoffs?"]') -df.add_system_transition(State.TURNTRADE0S, State.TURNTRADE0U, r'[! "Earlier in the season I heard that" #tradeNewsByTeam ". Do you think that trade had repercussions for playoffs?"]') -df.add_user_transition(State.TURNTRADE0U, State.TURNTRADE1S, "[#ONT(agree)]") +df.add_system_transition(State.TURNTRADE0AS, State.TURNTRADE0U, r'[! "Fair enough. Earlier in the season " #tradeNews() ". do you think this impacted or will impact playoffs in any way?"]') +df.add_system_transition(State.TURNTRADE0S, State.TURNTRADE0U, r'[! "Earlier in the season I heard that" #tradeNews() ". Do you think that trade will have impact for playoffs?"]') +df.add_user_transition(State.TURNTRADE0U, State.TURNTRADE1S, "[!#ONT(agree)]") +df.add_user_transition(State.TURNTRADE0U, State.TURNTRADE1S1, "[!#ONT(disagree)]") #df.add_user_transition(State.TURNTRADE0U, State.TURNTRADE1S, "[ONT(disagree)]") df.add_user_transition(State.TURNTRADE0U, State.TURN0DK1S, dont_know) df.add_system_transition(State.TURN0DK1S, State.TURN0DK1U, r'[! "No worries, if you dont know, I can just talk about trades! Is that okay?"]') @@ -565,7 +568,8 @@ def run (self, ngrams, vars, args): #turn 1 -df.add_system_transition(State.TURNTRADE1S, State.TURNTRADE1U, r'[!{#tradeNews()} ". Do you want to talk about this trade?"]') +df.add_system_transition(State.TURNTRADE1S, State.TURNTRADE1U, r'[! "ok then. lets talk about $player." #playerRating() " What do you think about him?"]') #r'[!{#tradeNews()} . Do you want to talk about this trade?"]' +df.add_system_transition(State.TURNTRADE1S1, State.TURNTRADE1U, r'[! "ok then. lets talk about $player." #playerRating() " What do you think about him?"]') df.add_user_transition(State.TURNTRADE1U, State.TURNTRADE2S, '[#ONT(agree)]') df.add_user_transition(State.TURNTRADE1U, State.TURNTRADE1BS, '[#ONT(disagree)]') df.add_system_transition(State.TURNTRADE1BS, State.TURNTRADE1BU, r'[! "We can also talk about all-stars, injuries, the draft, or stop talking. Which would you prefer?"]') diff --git a/trades.json b/trades.json index 7df3628..948844b 100644 --- a/trades.json +++ b/trades.json @@ -9,15 +9,6 @@ "Additional_Sort": 1610612755, "GroupSort": "Trade 2019095" }, - { - "Transaction_Type": "Trade", - "TRANSACTION_DATE": "2020-02-06T00:00:00", - "TRANSACTION_DESCRIPTION": "Minnesota Timberwolves received guard D'Angelo Russell from Golden State Warriors.", - "TEAM_ID": 1610612750, - "PLAYER_ID": 1626156, - "Additional_Sort": 1610612744, - "GroupSort": "Trade 2019096" - }, { "Transaction_Type": "Trade", "TRANSACTION_DATE": "2020-02-06T00:00:00", From 100685d0c73408614f91b789a9b3cb9b0e6e3438 Mon Sep 17 00:00:00 2001 From: shchung1234 Date: Wed, 15 Apr 2020 20:28:23 -0400 Subject: [PATCH 9/9] please --- .DS_Store | Bin 8196 -> 8196 bytes hw_lexicon_entity_matching.py | 27 +++++++++++++++++++++++++++ trades.json | 9 --------- 3 files changed, 27 insertions(+), 9 deletions(-) diff --git a/.DS_Store b/.DS_Store index 0d09fce2ff0a9f9c2a6db7e0302fffbec616eeda..f0552a87685aa55a877b6cd34def0abafe1b79e6 100644 GIT binary patch delta 267 zcmZp1XmQw}DqyW4vz~#0frUYjA)O(Up(Hoo#U-V*B$7Lbij_XnzE1)7q{kiwA4kce!KEqk~zx-7yZ?tRNwp~@Cy7zQWj=N14( zf#AU8&jLT0%&RxQ6Kr9X-+lE`_CBB}GeZVLIfGGdKHMO%%;bsU5{w5nuM$7OPMp%o HtHh%KuxwLL delta 267 zcmZp1XmQw}DqyX8sgr?$frUYjA)O(Up(Hoo#U-V*B$