Exemplo n.º 1
0
def test_skip():
    word_list = lexicon.scan('eat the bear bla')
    assert_equal(word_list, [('verb', 'eat'), ('stop', 'the'), ('noun', 'bear'), ('error', 'bla')])
    parser.skip(word_list, 'verb')
    assert_equal(word_list, [('stop', 'the'), ('noun', 'bear'), ('error', 'bla')])
    parser.skip(word_list, 'stop')
    assert_equal(word_list, [('noun', 'bear'), ('error', 'bla')])
Exemplo n.º 2
0
def test_skip():
    assert_equal(
        parser.skip([('stop', 'at'), ('stop', 'the'), ('noun', 'planet')],
                    'stop'), None)
    assert_equal(
        parser.skip([('stop', 'at'), ('stop', 'the'), ('noun', 'planet')],
                    'noun'), None)
Exemplo n.º 3
0
def testing_skip():
    '''testing the skip function.'''
    word_list = lexicon.scan('bear kill princess')
    assert_equal(word_list, [('noun', 'bear'), ('verb', 'kill'),
                             ('noun', 'princess')])
    parser.skip(word_list, 'noun')
    assert_equal(word_list, [('verb', 'kill'), ('noun', 'princess')])
Exemplo n.º 4
0
def TestSkip():
    inputsent = lexicon.scan("bear eat castle")
    assert_equal(inputsent, [('noun', 'bear'), ('verb', 'eat'),
                             ('noun', 'castle')])
    parser.skip(inputsent, 'noun')
    assert_equal(inputsent, [('verb', 'eat'), ('noun', 'castle')])
    parser.skip(inputsent, 'verb')
    assert_equal(inputsent, [('noun', 'castle')])
Exemplo n.º 5
0
def test_skip():
	# skiping with an empty list
	word_list = []
	parser.skip(word_list, "noun")
	assert_equal(word_list, [])

	# skipping with a list with 1 item
	word_list = lexicon.scan("in")
	parser.skip(word_list, "noun")
	assert_equal(word_list, [("stop", "in")])
	parser.skip(word_list, "stop")
	assert_equal(word_list, [])

	# skipping with lists with many items
	word_list = lexicon.scan("in of from")
	parser.skip(word_list, "stop")
	assert_equal(word_list, [])

	word_list = lexicon.scan("Go up or down")
	parser.skip(word_list, "verb")
	assert_equal(word_list, [("direction", "up"),
							 ("error", "or"),
							 ("direction", "down")])
Exemplo n.º 6
0
def test_skip():
	word_list = lexicon2.scan('princess')
	assert_equal(word_list, [('noun', 'princess')])
	parser.skip(word_list, 'noun')
Exemplo n.º 7
0
def test_skip():
	words = [('stop', 'the'), ('noun', 'girl')]
	parser.skip(words, 'stop')
	assert_equal(words, [('noun', 'girl')])
def test_skip():
    # test to see if skip removes the first lot of stop words it comes accross
    word_list = [('stop', 'at'), ('stop', 'the'), ('verb', 'run'), ('stop', 'is')]
    parser.skip(word_list, 'stop')
    # word_list should be left with a verb then another stop word
    assert_equal(word_list, [('verb', 'run'), ('stop', 'is')])
Exemplo n.º 9
0
def skip():
    word_list = []
    assert None == parser.skip(word_list)

    word_list = lexicon.scan("bear go princess")
Exemplo n.º 10
0
def test_skip():
	word_list = lexicon.scan(sentence)
	assert_equal(word_list, [('noun','princess'), ('verb','go'),
													('direction', 'east')])
	parser.skip(word_list, 'noun')
	assert_equal(word_list, [('verb','go'), ('direction', 'east')])
Exemplo n.º 11
0
def test_skip():
    word_list = lexicon.scan("the door")
    parser.skip(word_list, "stop")
    assert_equal(word_list, [("noun", "door")])
Exemplo n.º 12
0
def test_skip():
    assert_equal(parser.skip("of", "stop"), (None))
    result = parser.skip("of", "stop")
Exemplo n.º 13
0
def test_skip(): #该函数会跳过和制定的词语类型相同的所有的tuple
    assert_equal(parser.skip([('verb', 'kill'), ('noun', 'princess')], 'verb'), None)
    assert_equal(parser.skip([('noun', 'princess'), ('verb', 'kill')], 'verb'), None)
Exemplo n.º 14
0
def test_skip():
    scanner = lexicon.scan("north bear go")
    assert_equal(scanner, [('direction', 'north'), ('noun', 'bear'),
                           ('verb', 'go')])
    assert_equal(parser.skip(scanner, 'direction'), None)
    assert_equal(scanner, [('noun', 'bear'), ('verb', 'go')])
Exemplo n.º 15
0
def test_skip():
    word_list_eg = [('verb', 'run'), ('direction', 'north'), ('stop', 'with'),
                    ('stop', 'the'), ('noun', 'bear')]

    assert_equal(parser.skip(word_list_eg, 'stop'), None)
Exemplo n.º 16
0
def test_skip():
    wordlist = [("verb", "kill"), ("stop", "the"), ("noun", "princess")]
    assert_equal(parser.skip(wordlist, "kill"), None)
Exemplo n.º 17
0
def test_skip():
  test = [('verb', 'punch'), ('noun', 'bear')]
  parser.skip(test, 'verb')
  assert_equal(test, [('noun', 'bear')])
  parser.skip(test, 'noun')
  assert_equal(test, [])
Exemplo n.º 18
0
def test_skip():
    word_list = lexicon.scan("bear eat cake")
    assert_equal(word_list,[("noun","bear"),("verb","eat"),("noun","cake")])
    parser.skip(word_list,"noun")
    assert_equal(word_list,[("verb","eat"),("noun","cake")])
Exemplo n.º 19
0
def test_skip():
    word_list = lexicon.scan('bear eat door')
    assert_equal(word_list, [('noun', 'bear'), ('verb', 'eat'),
                             ('noun', 'door')])
    parser.skip(word_list, 'noun')
    assert_equal(word_list, [('verb', 'eat'), ('noun', 'door')])
def test_skip():
    word_list = lexicon.scan("the door")
    parser.skip(word_list, 'stop')
    assert_equal(word_list, [('noun', 'door')])
Exemplo n.º 21
0
def test_skip():
    word_list = lexicon.scan('bear eat door')
    assert_equal(word_list, [('noun', 'bear'), ('verb', 'eat'), ('noun', 'door')])
    parser.skip(word_list, 'noun')
    assert_equal(word_list, [('verb', 'eat'), ('noun', 'door')])
Exemplo n.º 22
0
def test_skip():
    x = parser.skip([("stop", "the"), ("noun", "bear")], 'stop')
    #Should return none because the thing at index 0
    #Won't match stop
    assert_equal(x, None)