A poem learning script in Python