If you only need direct and reversed dictionary, it is better to change this method:
def initialize_vocabulary(vocabulary_path):
"""Initialize vocabulary from file.
We assume the vocabulary is stored one-item-per-line, so a file:
d
c
will result in a vocabulary {"d": 0, "c": 1}, and this function will
also return the reversed-vocabulary ["d", "c"].
To this method with optional reverse parameter:
def load_vocab(vocabulary_path, reverse = False)
This method should return only one vocabulary direct or reversed based on optional flag
If you only need direct and reversed dictionary, it is better to change this method:
To this method with optional reverse parameter:
def load_vocab(vocabulary_path, reverse = False)
This method should return only one vocabulary direct or reversed based on optional flag