예제 #1
0
 def __init__(self):
     self.parser = lp()
     print "Using", self.parser.version
     self.clauseLinks = [
         "R", "Rn", "Bpj", "Bsj", "Mr", "Mj", "MX*r", "RSe", "QI*d", "MVs",
         "Ce", "TH", "Ci", "THb", "THi"
     ]
예제 #2
0
        except Exception as value:
            linkage=parseString(s, debug, itter+1, file)
            if not linkage:
                print(str(value.args[0]))
                if debug:
                    raise
            else:
                itter+=1
        else:
            itter+=1
            break
    return itter != 0

if __name__ == "__main__":
    debug=False  #turn on/off debugging output
    parser=lp() #initialize the parser
    current=conversation(sys.stdout,"savefile")  #initialize the context
    #talker=festival.open()
    
    while True:
        s=input().lstrip()
        print(s,file=sys.stderr)
        words=s.split(' ')
        if not parseThrough(s, debug, current):
            #hereafter are grammatically incorrect commands
            if 'run' in words:
                print(words)
            elif 'exit' in words:
                print(words)
            elif 'debug' in words:
                debug=not debug
예제 #3
0
 def __init__(self):
     self.parser = lp()
     print "Using", self.parser.version
     self.clauseLinks = ["R","Rn","Bpj","Bsj","Mr","Mj","MX*r","RSe","QI*d","MVs","Ce","TH","Ci","THb","THi"]
예제 #4
0
            linkage = parseString(s, debug, itter + 1, file)
            if not linkage:
                print(str(value.args[0]))
                if debug:
                    raise
            else:
                itter += 1
        else:
            itter += 1
            break
    return itter != 0


if __name__ == "__main__":
    debug = False  #turn on/off debugging output
    parser = lp()  #initialize the parser
    current = conversation(sys.stdout, "savefile")  #initialize the context
    #talker=festival.open()

    while True:
        s = input().lstrip()
        print(s, file=sys.stderr)
        words = s.split(' ')
        if not parseThrough(s, debug, current):
            #hereafter are grammatically incorrect commands
            if 'run' in words:
                print(words)
            elif 'exit' in words:
                print(words)
            elif 'debug' in words:
                debug = not debug