def getNouns(NLUOutput, subjectList): returnList = [] for subject in subjectList: a = [] if NLUOutput[0][subject] in pronounKeys: a = [pronounSubjects[NLUOutput[0][subject]], pronounObjects[NLUOutput[0][subject]]] elif subject == "sort": order = NLUOutput[0].get("order") sortType = NLUOutput[0][subject] b = "" if order == "asc": if sortType == "gross": b = "least profitable" if sortType == "rating": b = "least popular" if sortType == "year": b = "oldest" else: # if order == "desc": if sortType == "gross": b = "most profitable" if sortType == "rating": b = "most popular" if sortType == "year": b = "newest" a = [b, b] else: a = [nlgu.flipPersons(subject, NLUOutput[0][subject]), nlgu.flipPersons(subject, NLUOutput[0][subject])] returnList.append(a) return returnList
def printSmallItemList(itemType, resultList): n = 0 rstring = "" for result in resultList: n += 1 if n == len(resultList): rstring += " and " + nlgu.flipPersons(itemType, str(result)) elif n == len(resultList) - 1: rstring += nlgu.flipPersons(itemType, str(result)) else: rstring += nlgu.flipPersons(itemType, str(result)) + ", " return rstring
def getNouns(NLUOutput, subjectList): returnList = [] for subject in subjectList: a = [] if NLUOutput[0][subject] in pronounKeys: a = [ pronounSubjects[NLUOutput[0][subject]], pronounObjects[NLUOutput[0][subject]] ] elif subject == "sort": order = NLUOutput[0].get("order") sortType = NLUOutput[0][subject] b = "" if order == "asc": if sortType == "gross": b = "least profitable" if sortType == "rating": b = "least popular" if sortType == "year": b = "oldest" else: #if order == "desc": if sortType == "gross": b = "most profitable" if sortType == "rating": b = "most popular" if sortType == "year": b = "newest" a = [b, b] else: a = [ nlgu.flipPersons(subject, NLUOutput[0][subject]), nlgu.flipPersons(subject, NLUOutput[0][subject]) ] returnList.append(a) return returnList
def printBigItemList(itemType, resultList): rstring = "" for result in resultList: rstring += nlgu.flipPersons(itemType, str(result)) + "\n" return rstring pass
def printItem(itemType, result): return nlgu.flipPersons(itemType, str(result))