Python implementation of a simple noun learning algorithm by