def parseImperative(links,words,combinations,current): subject="you" verbLink=links['W'] verb=verbLink[list(verbLink.keys())[0]][0][1] directObject=None if any(tups[0]=='O' for tups in words[verb]): objectLinks=[tups for tups in words[verb] if tups[0]=='O'] directObject=links['O'][objectLinks[0][1]][0][1] verb=combinations[verb] directObject=combinations[directObject] directObject=current[directObject] elif any(tups[0]== 'P' for tups in words[verb]): objectLinks=[tups for tups in words[verb] if tups[0]=='P'] directObject=links['P'][objectLinks[0][1]][0][1] verb=combinations[verb] directObject=combinations[directObject] directObject=current[directObject] elif any(tups[0]=='I' for tups in words[verb]): inf=links['I'][[tups for tups in words[verb] if tups[0]=='I'][0][1]][0][1] infLinks=words[inf] inf=combinations[inf] if any(tups[0]=='O' for tups in infLinks): directObject=links['O'][[tups for tups in infLinks if tups[0]=='O'][0][1]][0][1] directObject=combinations[directObject] directObject=infinitive(current,inf,current[directObject]) return current.verb(subject,verb).act(directObject)
def parseImperative(links, words, combinations, current): subject = "you" verbLink = links['W'] verb = verbLink[list(verbLink.keys())[0]][0][1] directObject = None if any(tups[0] == 'O' for tups in words[verb]): objectLinks = [tups for tups in words[verb] if tups[0] == 'O'] directObject = links['O'][objectLinks[0][1]][0][1] verb = combinations[verb] directObject = combinations[directObject] directObject = current[directObject] elif any(tups[0] == 'P' for tups in words[verb]): objectLinks = [tups for tups in words[verb] if tups[0] == 'P'] directObject = links['P'][objectLinks[0][1]][0][1] verb = combinations[verb] directObject = combinations[directObject] directObject = current[directObject] elif any(tups[0] == 'I' for tups in words[verb]): inf = links['I'][[tups for tups in words[verb] if tups[0] == 'I'][0][1]][0][1] infLinks = words[inf] inf = combinations[inf] if any(tups[0] == 'O' for tups in infLinks): directObject = links['O'][[ tups for tups in infLinks if tups[0] == 'O' ][0][1]][0][1] directObject = combinations[directObject] directObject = infinitive(current, inf, current[directObject]) return current.verb(subject, verb).act(directObject)
def parseInterogative(links, words, combinations, current): if 'S' in links: SV = links['S'] subject = SV[list(SV.keys())[0]][0][0] verb = SV[list(SV.keys())[0]][0][1] elif 'SI' in links: SV = links['SI'] subject = SV[list(SV.keys())[0]][0][1] verb = SV[list(SV.keys())[0]][0][0] elif 'SXI' in links: SV = links['SXI'] subject = SV[list(SV.keys())[0]][0][1] verb = SV[list(SV.keys())[0]][0][0] verbLinks = words[verb] subject = combinations[subject] verb = combinations[verb] if any(tups[0] == 'O' for tups in verbLinks): directObject = links['O'][[ tups for tups in verbLinks if tups[0] == 'O' ][0][1]][0][1] directObject = combinations[directObject] directObject = current[directObject] elif any(tups[0] == 'P' for tups in verbLinks): directObject = links['P'][[ tups for tups in verbLinks if tups[0] == 'P' ][0][1]][0][1] directObject = combinations[directObject] directObject = current[directObject] elif any(tups[0] == 'PF' for tups in verbLinks): directObject = links['PF'][[ tups for tups in verbLinks if tups[0] == 'PF' ][0][1]][0][0] directObject = combinations[directObject] directObject = current[directObject] elif any(tups[0] == 'B' for tups in verbLinks): directObject = links['B'][[ tups for tups in verbLinks if tups[0] == 'B' ][0][1]][0][0] directObject = combinations[directObject] directObject = current[directObject] elif any(tups[0] == 'I' for tups in verbLinks): inf = links['I'][[tups for tups in verbLinks if tups[0] == 'I'][0][1]][0][1] infLinks = words[inf] inf = combinations[inf] if any(tups[0] == 'O' for tups in infLinks): directObject = links['O'][[ tups for tups in infLinks if tups[0] == 'O' ][0][1]][0][1] elif any(tups[0] == 'B' for tups in infLinks): directObject = links['B'][[ tups for tups in infLinks if tups[0] == 'B' ][0][1]][0][0] directObject = combinations[directObject] directObject = infinitive(current, inf, current[directObject]) return current.verb(subject, verb).ask(directObject)
def parseInterogative(links,words,combinations,current): if 'S' in links: SV=links['S'] subject=SV[list(SV.keys())[0]][0][0] verb=SV[list(SV.keys())[0]][0][1] elif 'SI' in links: SV=links['SI'] subject=SV[list(SV.keys())[0]][0][1] verb=SV[list(SV.keys())[0]][0][0] elif 'SXI' in links: SV=links['SXI'] subject=SV[list(SV.keys())[0]][0][1] verb=SV[list(SV.keys())[0]][0][0] verbLinks=words[verb] subject=combinations[subject] verb=combinations[verb] if any(tups[0]=='O' for tups in verbLinks): directObject=links['O'][[tups for tups in verbLinks if tups[0]=='O'][0][1]][0][1] directObject=combinations[directObject] directObject=current[directObject] elif any(tups[0]=='P' for tups in verbLinks): directObject=links['P'][[tups for tups in verbLinks if tups[0]=='P'][0][1]][0][1] directObject=combinations[directObject] directObject=current[directObject] elif any(tups[0]=='PF' for tups in verbLinks): directObject=links['PF'][[tups for tups in verbLinks if tups[0]=='PF'][0][1]][0][0] directObject=combinations[directObject] directObject=current[directObject] elif any(tups[0]=='B' for tups in verbLinks): directObject=links['B'][[tups for tups in verbLinks if tups[0]=='B'][0][1]][0][0] directObject=combinations[directObject] directObject=current[directObject] elif any(tups[0]=='I' for tups in verbLinks): inf=links['I'][[tups for tups in verbLinks if tups[0]=='I'][0][1]][0][1] infLinks=words[inf] inf=combinations[inf] if any(tups[0]=='O' for tups in infLinks): directObject=links['O'][[tups for tups in infLinks if tups[0]=='O'][0][1]][0][1] elif any(tups[0]=='B' for tups in infLinks): directObject=links['B'][[tups for tups in infLinks if tups[0]=='B'][0][1]][0][0] directObject=combinations[directObject] directObject=infinitive(current,inf,current[directObject]) return current.verb(subject,verb).ask(directObject)
def parseDeclarative(links,words,combinations,current): if 'S' in links: SV=links['S'] subject=SV[list(SV.keys())[0]][0][0] verb=SV[list(SV.keys())[0]][0][1] elif 'SX' in links: SV=links['SX'] subject=SV[list(SV.keys())[0]][0][0] verb=SV[list(SV.keys())[0]][0][1] elif 'SI' in links: #used for adjective class definitions SV=links['SI'] subject=SV[list(SV.keys())[0]][0][1] verb=SV[list(SV.keys())[0]][0][0] verbLinks=words[verb] subject=combinations[subject] verb=combinations[verb] advs=() if any(tups[0]=='N' for tups in verbLinks): advLinks=[tups for tups in verbLinks if tups[0]=='N'] adv=links['N'][advLinks[0][1]][0][1] adv=combinations[adv] advs+=(adverb(stripSub(adv),current),) if any(tups[0]=='EB' for tups in verbLinks): advLinks=[tups for tups in verbLinks if tups[0]=='EB'] adv=links['EB'][advLinks[0][1]][0][1] adv=combinations[adv] advs+=(adverb(stripSub(adv),current),) if any(tups[0]=="MV" for tups in verbLinks): advLinks=[tups for tups in verbLinks if tups[0]=='MV'] for link in links ['MV'][advLinks[0][1]]: adv=link[1] adv=combinations[adv] advs+=(current[adv],) directObject=None if any(tups[0]=='O' for tups in verbLinks): objectLinks=[tups for tups in verbLinks if tups[0]=='O'] directObject=links['O'][objectLinks[0][1]][0][1] directObject=combinations[directObject] directObject=current[directObject] elif any(tups[0]== 'P' for tups in verbLinks): objectLinks=[tups for tups in verbLinks if tups[0]=='P'] directObject=links['P'][objectLinks[0][1]][0][1] directObject=combinations[directObject] directObject=current[directObject] elif any(tups[0]=='PF' for tups in verbLinks): #used for adjective class definition objectLinks=[tups for tups in verbLinks if tups[0]=='PF'] directObject=links['PF'][objectLinks[0][1]][0][0] directObject=combinations[directObject] subject,directObject=directObject,subject directObject=current[directObject] elif any(tups[0]=='I' for tups in verbLinks): inf=links['I'][[tups for tups in verbLinks if tups[0]=='I'][0][1]][0][1] infLinks=words[inf] inf=combinations[inf] if any(tups[0]=='O' for tups in infLinks): directObject=links['O'][[tups for tups in infLinks if tups[0]=='O'][0][1]][0][1] ## elif any(tups[0]=='B' for tups in infLinks): ## directObject=links['B'][[tups for tups in infLinks if tups[0]=='B'][0][1]][0][0] directObject=combinations[directObject] directObject=infinitive(current,inf,current[directObject]) current.verb(subject,verb)(directObject,advs=advs)
def parseDeclarative(links, words, combinations, current): if 'S' in links: SV = links['S'] subject = SV[list(SV.keys())[0]][0][0] verb = SV[list(SV.keys())[0]][0][1] elif 'SX' in links: SV = links['SX'] subject = SV[list(SV.keys())[0]][0][0] verb = SV[list(SV.keys())[0]][0][1] elif 'SI' in links: #used for adjective class definitions SV = links['SI'] subject = SV[list(SV.keys())[0]][0][1] verb = SV[list(SV.keys())[0]][0][0] verbLinks = words[verb] subject = combinations[subject] verb = combinations[verb] advs = () if any(tups[0] == 'N' for tups in verbLinks): advLinks = [tups for tups in verbLinks if tups[0] == 'N'] adv = links['N'][advLinks[0][1]][0][1] adv = combinations[adv] advs += (adverb(stripSub(adv), current), ) if any(tups[0] == 'EB' for tups in verbLinks): advLinks = [tups for tups in verbLinks if tups[0] == 'EB'] adv = links['EB'][advLinks[0][1]][0][1] adv = combinations[adv] advs += (adverb(stripSub(adv), current), ) if any(tups[0] == "MV" for tups in verbLinks): advLinks = [tups for tups in verbLinks if tups[0] == 'MV'] for link in links['MV'][advLinks[0][1]]: adv = link[1] adv = combinations[adv] advs += (current[adv], ) directObject = None if any(tups[0] == 'O' for tups in verbLinks): objectLinks = [tups for tups in verbLinks if tups[0] == 'O'] directObject = links['O'][objectLinks[0][1]][0][1] directObject = combinations[directObject] directObject = current[directObject] elif any(tups[0] == 'P' for tups in verbLinks): objectLinks = [tups for tups in verbLinks if tups[0] == 'P'] directObject = links['P'][objectLinks[0][1]][0][1] directObject = combinations[directObject] directObject = current[directObject] elif any(tups[0] == 'PF' for tups in verbLinks): #used for adjective class definition objectLinks = [tups for tups in verbLinks if tups[0] == 'PF'] directObject = links['PF'][objectLinks[0][1]][0][0] directObject = combinations[directObject] subject, directObject = directObject, subject directObject = current[directObject] elif any(tups[0] == 'I' for tups in verbLinks): inf = links['I'][[tups for tups in verbLinks if tups[0] == 'I'][0][1]][0][1] infLinks = words[inf] inf = combinations[inf] if any(tups[0] == 'O' for tups in infLinks): directObject = links['O'][[ tups for tups in infLinks if tups[0] == 'O' ][0][1]][0][1] ## elif any(tups[0]=='B' for tups in infLinks): ## directObject=links['B'][[tups for tups in infLinks if tups[0]=='B'][0][1]][0][0] directObject = combinations[directObject] directObject = infinitive(current, inf, current[directObject]) current.verb(subject, verb)(directObject, advs=advs)