Refactor vocabularies.txt into test_vocabularies.py and fix its tests