if i run nosetests on lexicon_tests.py it shows error
but if i manually enter the arguments in scan() of lexicon.py it works well.
Any reason???
here is lexicon.py
def scan(sentence):
list1 =[[‘north’, ‘south’, ‘east’, ‘west’],
[‘go’, ‘kill’, ‘eat’],
[‘the’, ‘in’, ‘of’],
[‘door’, ‘bear’, ‘princess’, ‘cabinet’]]
words = sentence.split()
result = []
for word in words:
if word in list1[0]:
result.append((‘direction’, word))
elif word in list1[1]:
result.append((‘verb’, word))
elif word in list1[2]:
result.append((‘stop’, word))
elif word in list1[3]:
result.append((‘noun’, word))
else:
try:
ineger = int(word)
result.append((‘number’, word))
except:
result.append((‘error’, word))
print(result)