cmusphinx / g2p-seq2seq

G2P with Tensorflow
Other
670 stars 194 forks source link

Avoid redundant dictionary construction #14

Closed nshmyrev closed 8 years ago

nshmyrev commented 8 years ago

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