예제 #1
0
파일: tourGuide.py 프로젝트: katadh/leiaS14
def startTourGuide():
    stan_parse = parse.syntaxParser()
    time.sleep(3)

    print "How can I help you?\n"
    while(1):
        text = raw_input("--> ")
        if text == "end":
            return
        if text == "" or text == "\n":
            continue
        leia.leia(text, planner=plan.planManager(), lexicon=knowledge.lexicon_alexnut.Lexicon(), sp=stan_parse)
예제 #2
0
파일: leia.py 프로젝트: katadh/leiaS14
def leia(sentence, 
         lexicon = knowledge.lexicon.Lexicon(), 
         planner = planManager(),
         sp = parse.syntaxParser(),
         Heuristics = heuristics.Heuristics,):

    tagged_words = sp.analyzeSentence(sentence) 
    
    #print 'from syntax'
    #print map(lambda tw: [tw.fullword, tw.lemma, tw.pos, tw.ne], tagged_words)
    #tagged_words = [Word('I', 'I', 'PRP', None), Word('fish', 'fish', 'VBZ', None), Word('fish','fish','NN',None)]
    #tagged_words = [parse.Word('gog', 'gog', 'NN', None), parse.Word('location', 'location', 'NN', None)]
    #print 'hard coded'
    #print map(lambda tw: [tw.fullword, tw.lemma, tw.pos, tw.ne], tagged_words)   
    
    linked_instances = tmr(tagged_words, lexicon, Heuristics)
    
    planner.updatePlanQueue(linked_instances)