June 2017
Beginner
320 pages
7h 37m
English
What we should be able to get from our little game lexicon scanner is a list that looks like this:
Exercise 49 Python Session
Python 3.6.0 (default, Feb 2 2017, 12:48:29)[GCC 4.2.1 Compatible Apple LLVM 7.0.2 (clang-700.1.81)] on darwinType "help", "copyright", "credits" or "license" for more information.>>> from ex48 import lexicon>>> lexicon.scan("go north")[('verb', 'go'), ('direction', 'north')]>>> lexicon.scan("kill the princess")[('verb', 'kill'), ('stop', 'the'), ('noun', 'princess')]>>> lexicon.scan("eat the bear")[('verb', 'eat'), ('stop', 'the'), ('noun', 'bear')]
This will also work on longer sentences such as lexicon.scan("open the door and smack the bear in the nose") ...
Read now
Unlock full access