def chatbatter(b):
    count2 = 0
    for x in b:
        if greet.__contains__(x):
            c = x
            count2 += 1
    if count2 != 0:
        print(greet[c])
    count = 0
    global my_list
    my_list = []
    for x in b:
        if ans.__contains__(x):
            my_list.append(x)
    my_list = list(set(my_list))
    count = len(my_list)
    if count == 1:
        query(0)
    elif count == 0 and count2 == 0:
        print(
            "Sorry i don't understand you.\nYou can call the college reception to get your answer.\nThe number is: 9876543210."
        )
    elif count2 != 0:
        print(
            'You can ask me queries related to new admissions.\nI can also tell you about Faculty members and placements!!'
        )
    else:
        for yo in range(0, count):
            global foo
            if (yo == count - 1):
                print("Lastly,")
            elif (yo != 0):
                print(random.choice(foo) + ',')
            query(yo)
    return
Exemple #2
0
def chatbatter(b):
    count2=0
    for x in b:
        if greet.__contains__(x):
            c=x
            count2+=1
    if count2!=0:
        print(greet[c])
    count=0
    my_list=[]
    for x in b:
        if words.__contains__(x):
            my_list.append(x)
            count+=1
    if count==1:
        c=my_list[0]
        #countpact=0
        countnact=0
        #print('You mentioned '+c)
        for x in b:
            #if pact.__contains__(x):
                #countpact+=1
            if nact.__contains__(x):
                countnact+=1
        #if(pact>=1):
            #print(words[c]['0'])
        if(countnact==0):
            print(words[c]['0'])
        else:
            flag=-1
            print('You mentioned '+c)
            print('But I am not sure if you really want to know about it.')
            print('Would you like to know about it??')
            temp=input().lower()
            if(temp=='y' or temp=='y '):
                flag=1
            if(temp=='n' or temp=='n '):
                flag=0
            if(flag==-1):
                count1=0
                right=[x for x in re.split('\W',temp) if x]
                for x in right:
                    if those_words.__contains__(x):
                        count1+=1
                if count1>0:
                    print('Please don\'t abuse!!! We at JUET don\'t tolerate it!!')
                    return
                if(right.__contains__('yes') or right.__contains__('yup')):
                    flag=1
                if(right.__contains__('no') or right.__contains__('nope')):
                    flag=0
            if(flag==0):
                print('Maybe I misunderstood you.\nPlease ask another query or contact the reception to get your answer. The number is: 9876543210')
            elif(flag==1):
                print(words[c]['0'])
            else:
                print('Sorry I don\'t understand you.\nPlease ask another query.')
        '''
        if len(words[c])>1:
            temp=input().lower()
            try:
                print(words[c][temp])
                if temp!='no' and temp!='n':
                    temp=input().lower()
                    if temp=='yes' or temp=='no' or temp=='0' or temp=='n' or temp=='y':
                        raise Exception("Sorry i don't understand you. Please make another query .\nYou can also call the college reception.\nThe number is: 9876543210.")
                    else:
                        try:
                            print(words[c][temp])
                        except:
                            print("Sorry i don't understand you. Please make another query.\nYou can also call the college reception.\nThe number is: 9876543210.")
            except:
                print("Sorry i don't understand you.Please make another query.\nYou can also call the college reception.\nThe number is: 9876543210.")
                '''
    elif count==0 and count2==0:
        print("Sorry i don't understand you.\nYou can call the college reception to get your answer.\nThe number is: 9876543210.")
    elif count2!=0:
        print('You can ask me queries related to new admissions.\nI can also tell you about Faculty members and placements!!')
    else:
        '''print('You have mentioned:-')
        i=1
        for x in my_list:
            print(str(i)+':'+x)
            i+=1
        '''
        print('You have asked {} queries at a time'.format(count))
        print('But I can help you one by one')
        print('So please ask a single query next time.')
        #print('So please select one entry at a time from the above')
        #main_like()
    return
Exemple #3
0
def chatbatter(b):
    count2 = 0
    for x in b:
        if greet.__contains__(x):
            c = x
            count2 += 1
    if count2 != 0:
        print(greet[c])
    count = 0
    global my_list
    my_list = []
    for x in b:
        if my_keys.__contains__(x):
            my_list.append(x)
    my_list = list(set(my_list))
    count = len(my_list)
    global doub_list
    global foo
    check()
    if (len(doub_list) > 0):
        yo = 0
        length = len(doub_list)
        if (len(doub_list) == 1):
            query(yo, 2)
        else:
            for x in doub_list:
                if (yo != 0):
                    print(random.choice(foo) + ',')
                if (yo != length - 1):
                    query(yo, 2)
                yo += 1
        if (count > 0):
            ohcomeon_list = []
            for y in doub_list:
                p = y.split()
                ohcomeon_list.append(p[0])
                ohcomeon_list.append(p[1])
            ohcomeon_list = list(set(ohcomeon_list))
            hellno = []
            for x in my_list:
                if (not ohcomeon_list.__contains__(x)):
                    hellno.append(x)
            length = len(hellno)
            yo = 0
            my_list = hellno
            if (len(doub_list) > 1):
                if (len(hellno)):
                    print("Also,")
                else:
                    print("Lastly,")
                query(len(doub_list) - 1, 2)
            for x in hellno:
                if (yo == length - 1):
                    print("Lastly,")
                else:
                    print(random.choice(foo) + ',')
                query(yo, 1)
                yo += 1
    elif count == 1:
        query(0, 1)
    elif count == 0 and count2 == 0:
        print(
            "Sorry i don't understand you.\nYou can call the college reception to get your answer.\nThe number is: 9876543210."
        )
    elif count2 != 0:
        print(
            'You can ask me queries related to new admissions.\nI can also tell you about Faculty members and placements!!'
        )
    else:
        for yo in range(0, count):
            if (yo == count - 1):
                print("Lastly,")
            elif (yo != 0):
                print(random.choice(foo) + ',')
            query(yo, 1)
    return
Exemple #4
0
def chatbattter(b):
    count2 = 0
    for x in b:
        if greet.__contains__(x):
            c = x
            count2 += 1
    if count2 != 0:
        print(greet[c])
    count = 0
    my_list = []
    for x in b:
        if words.__contains__(x):
            my_list.append(x)
            count += 1
    #if count==1:
    #c=my_list[0]
    if (check(b)):
        global m
        print('You mentioned ' + m)
        print(doublr[m]['0'])
        if len(doublr[m]) > 1:
            temp = input().lower()
            try:
                print(doublr[m][temp])
                if temp != 'no' and temp != 'n':
                    temp = input().lower()
                    if temp == 'yes' or temp == 'no' or temp == '0' or temp == 'n' or temp == 'y':
                        raise Exception(
                            "Sorry i don't understand you. Please make another query .\nYou can also call the college reception for you are not satisfied with my answer\n. The number is: 9876543210. "
                        )
                    else:
                        try:
                            print(doublr[m][temp])
                        except:
                            print(
                                "Sorry i don't understand you. Please make another query.\nYou can also call the college reception for you are not satisfied with my answer\n. The number is: 9876543210."
                            )
            except:
                print(
                    "Sorry i don't understand you. Please make another query.\nYou can also call the college reception for you are not satisfied with my answer\n. The number is: 9876543210."
                )
    elif count == 1:
        c = my_list[0]
        print('You mentioned ' + c)
        print(words[c]['0'])
        if len(words[c]) > 1:
            temp = input().lower()
            try:
                print(words[c][temp])
                if temp != 'no' and temp != 'n':
                    temp = input().lower()
                    if temp == 'yes' or temp == 'no' or temp == '0' or temp == 'n' or temp == 'y':
                        raise Exception(
                            "Sorry i don't understand you. Please make another query .\nYou can also call the college reception.\nThe number is: 9876543210."
                        )
                    else:
                        try:
                            print(words[c][temp])
                        except:
                            print(
                                "Sorry i don't understand you. Please make another query.\nYou can also call the college reception.\nThe number is: 9876543210."
                            )
            except:
                print(
                    "Sorry i don't understand you.Please make another query.\nYou can also call the college reception.\nThe number is: 9876543210."
                )
    elif count == 0 and count2 == 0:
        print(
            "Sorry i don't understand you.\nYou can also call the college reception.\nThe number is: 9876543210."
        )
    elif count2 != 0:
        print('Don\'t just greet me!! Ask something!!')
    else:
        print('You have mentioned:-')
        i = 1
        for x in my_list:
            print(str(i) + ':' + x)
            i += 1
        print('But I can help you one by one')
        print('So please select one entry at a time from the above')
        main_like()
    return