reading database and setting up a vocabulary