(vocab_file)
return vocab
Loads a vocabulary file into a dictionary.
Loads a vocabulary file into a dictionary.
Loads a vocabulary file into a dictionary .
def load_vocab(vocab_file):
	"""Loads a vocabulary file into a dictionary."""
	vocab = collections.OrderedDict()
	index = 0
	with open(vocab_file, "r", encoding="utf-8") as reader:
		while True:
			token = reader.readline()
			if not token:
				break
			
			### joonho.lim @ 2019-03-15
			if token.find('n_iters=') == 0 or token.find('max_length=') == 0 :
				continue
			token = token.split('\t')[0]
			
			token = token.strip()
			vocab[token] = index
			index += 1
	return vocab
def load_vocab ( vocab_file ) : vocab = collections . OrderedDict ( ) index = 0 with open ( vocab_file , "r" , encoding = "utf-8" ) as reader : while True : token = reader . readline ( ) if not token : break ### joonho.lim @ 2019-03-15 if token . find ( 'n_iters=' ) == 0 or token . find ( 'max_length=' ) == 0 : continue token = token . split ( '\t' ) [ 0 ] token = token . strip ( ) vocab [ token ] = index index += 1 return vocab