Example #1
0
def test_parse_sentence():
    subject = ('noun', 'princess')
    verb = ('verb', 'go')
    obj = ('direction', 'left')
    w1 = [verb, object]
    word_list = [('stop', 'the'),
                 ('noun', 'princess'),
                 ('verb', 'go'),
                 ('direction', 'left')]
    s1 = sentence.parse_sentence(word_list)
    s2 = Sentence(subject, verb, obj)
    assert_equal(s1.subject, s2.subject)
    assert_equal(s1.verb, s2.verb)
    assert_equal(s1.object, s2.object)
Example #2
0
def test_princess():
    list = lexicon.scan("princess go east")
    sen = sentence.parse_sentence(list)
    print "subj: %s, verb: %s, obj: %s" % (sen.subject, sen.verb, sen.object)
Example #3
0
def test_exception():
    list = lexicon.scan("open the door")
    sen = sentence.parse_sentence(list)
    print "subj: %s, verb: %s, obj: %s" % (sen.subject, sen.verb, sen.object)
Example #4
0
def test_bear():
    list = lexicon.scan("bear eat door")
    sen = sentence.parse_sentence(list)
    print "subj: %s, verb: %s, obj: %s" % (sen.subject, sen.verb, sen.object)