(vocab_file_path)
return vocabs
Load vocabs, vocab: {"word": 1, ...}
Load vocabs, vocab: {"word": 1, ...}
Load vocabs vocab : { word : 1 ... }
def load_vocab_dict(vocab_file_path):
  """Load vocabs, vocab: {"word": 1, ...}"""
  logging.info("Loading vocab from {}".format(vocab_file_path))
  with open(vocab_file_path, encoding='utf-8') as in_f:
    vocabs = {}
    for line in in_f:
      parts = line.rstrip().split("\t")
      if len(parts) < 2:
        continue
      vocabs[parts[0]] = parts[1]
  logging.info("Loded {} vocabs from {}".format(len(vocabs), vocab_file_path))
  return vocabs
def load_vocab_dict ( vocab_file_path ) : logging . info ( "Loading vocab from {}" . format ( vocab_file_path ) ) with open ( vocab_file_path , encoding = 'utf-8' ) as in_f : vocabs = { } for line in in_f : parts = line . rstrip ( ) . split ( "\t" ) if len ( parts ) < 2 : continue vocabs [ parts [ 0 ] ] = parts [ 1 ] logging . info ( "Loded {} vocabs from {}" . format ( len ( vocabs ) , vocab_file_path ) ) return vocabs