weallwegot / omscs_chatbot

Issues Repository for Georgia Tech OMSCS Chat bot
MIT License
1 stars 0 forks source link

general info response #31

Closed weallwegot closed 6 years ago

weallwegot commented 6 years ago

From @weAllWeGot on December 1, 2016 6:43

what is GT, what is your name, what is your purpose, what is your job, who created you, how old are you, whens your birthday, etc... maybe even kbai specific questions

_Copied from original issue: weAllWeGot/kbai_chatbot3#11

weallwegot commented 6 years ago

` def determineGeneralVagueRequests(self,rawinput): inputBlob = TextBlob(rawinput) alltags = inputBlob.tags allwords = [tagtuple[0].upper() for tagtuple in alltags] w = 0 intent1="" intent2=""

wtt is word tag tuple

    for wtt in alltags:
        justtword = wtt[0].upper()
        justtag = wtt[1]
        if 'PRP$' in justtag:
            intent1="personal"
        elif 'NAME' in justtword:
            intent2="name"
        elif 'PURPOSE' in justtword or 'EXIST' in justtword or 'JOB' in justtword:
            intent2="purpose"
        elif 'CREAT' in justtword or 'BIRTHDAY' in justtword or 'PROGRAM' in justtword or 'SOFTWARE' in justtword:
            intent2="creation"
    if intent1 == "personal" and intent2 == "":
        w="personal"
        return w
    elif intent1 == "personal" and intent2 == "purpose":
        w="purpose"
        return w
    elif intent1 == "personal" and intent2 == "creation":
        w="creation"
        return w
    elif intent1 == "personal" and intent2 == "name":
        w="name"
        return w
    elif intent1 == "" and intent2 == "":
        if any(word in greetings for word in allwords):
            w="greet"
        elif 'OMSCS' in allwords and 'WHAT' in allwords:
            w="omscs"
        elif 'GT' in allwords or 'GEORGIATECH' in allwords or ('TECH' in allwords and 'GEORGIA' in allwords):
            w="gt"
        elif 'OLD' in allwords and 'HOW' in allwords and 'YOU' in allwords:
            w="personal"
    return w

`