Keyword Identification
Keywords are identified from the transformed Text to identify which set of actions needs to be performed by Aryan.
Below code snippet provides the list of keywords that are identified and respective set of actions that are triggered by Aryan.
If no keyword is identified for pre-defined set of actions, then flow fall backs on Wikipedia to get the answer. In case of any exceptions control fall backs to starting point of the Worker script and Aryan requests Human on "How can I Help?"
For example: If you say News or Headlines then News flow is triggered, if Human says quote or quotes then QuoteFlow is triggered. This are the keywords
if subStrCheck(transformedSpeech,"timezone") or subStrCheck(transformedSpeech,"time zone"):
getTimeZone(rawspeech,aifriend)
elif subStrCheck(transformedSpeech,"date") or subStrCheck(transformedSpeech,"time") or subStrCheck(transformedSpeech,"year") or subStrCheck(transformedSpeech,"month"):
TimeQuery(transformedSpeech,rawspeech,aifriend)
elif subStrCheck(transformedSpeech,"can you sneeze") or subStrCheck(transformedSpeech,"sneeze"):
CanyouSneeze(aifriend)
elif subStrCheck(transformedSpeech,"bad word") or subStrCheck(transformedSpeech,"bad words"):
SayaBadWord(aifriend)
elif subStrCheck(transformedSpeech,"play song") or subStrCheck(transformedSpeech,"play"):
playSong(aifriend)
elif subStrCheck(transformedSpeech,"latitude") or subStrCheck(transformedSpeech,"longitude"):
getLatitudeLongitude(rawspeech,aifriend)
elif subStrCheck(transformedSpeech,"weather"):
CheckForEmailFlow(weatherByCity,rawspeech,transformedSpeech,aifriend)
elif subStrCheck(transformedSpeech,"jokes") or subStrCheck(transformedSpeech,"joke"):
getJokes(transformedSpeech,aifriend)
elif subStrCheck(transformedSpeech,"bore") or subStrCheck(transformedSpeech,"boredem") or subStrCheck(transformedSpeech,"bored"):
removeBoredomFlow(transformedSpeech,aifriend)
elif subStrCheck(transformedSpeech,"repeat after") or subStrCheck(transformedSpeech,"repeat"):
repeatAfterMe(aifriend)
elif subStrCheck(transformedSpeech,"introduce yourself") or subStrCheck(transformedSpeech,"introduce"):
introduceYourself(aifriend)
elif subStrCheck(transformedSpeech,"news") or subStrCheck(transformedSpeech,"headline") or subStrCheck(transformedSpeech,"headlines"):
CheckForEmailFlow(getNews,rawspeech,transformedSpeech,aifriend)
elif subStrCheck(transformedSpeech,"currency") or subStrCheck(transformedSpeech,"currencies"):
getCurrency(rawspeech,aifriend)
elif subStrCheck(transformedSpeech,"capital") or subStrCheck(transformedSpeech,"capitals"):
getCapital(rawspeech,aifriend)
elif subStrCheck(transformedSpeech,"zodiac") or subStrCheck(transformedSpeech,"astro sign") or subStrCheck(transformedSpeech,"sun sign"):
getZodiacFlow(rawspeech,aifriend)
elif subStrCheck(transformedSpeech,"record") or subStrCheck(transformedSpeech,"record audio") or subStrCheck(transformedSpeech,"record voice"):
SaveAudio(aifriend)
elif subStrCheck(transformedSpeech,"skills") or subStrCheck(transformedSpeech,"describe skill") or subStrCheck(transformedSpeech,"describe skills"):
DescribeSkills(aifriend)
elif subStrCheck(transformedSpeech,"quote") or subStrCheck(transformedSpeech,"quotes"):
if subStrCheck(rawspeech,"list") or subStrCheck(rawspeech,"what") or subStrCheck(rawspeech,"describe"):
ListofQuotesCategory(aifriend)
else:
identifyQuoteCategory(transformedSpeech,aifriend)
elif subStrCheck(transformedSpeech,"send email") or subStrCheck(transformedSpeech,"email"):
sendEmail(aifriend)
else:
wikiSearch(transformedSpeech,detailFlag,aifriend)
Copy link