File tree Expand file tree Collapse file tree 1 file changed +5
-1
lines changed Expand file tree Collapse file tree 1 file changed +5
-1
lines changed Original file line number Diff line number Diff line change @@ -210,6 +210,7 @@ class Vocabulary(object):
210210 start_id : int of start id
211211 end_id : int of end id
212212 unk_id : int of unk id
213+ pad_id : int of padding id
213214
214215 Vocab_files
215216 -------------
@@ -231,7 +232,8 @@ def __init__(self,
231232 vocab_file ,
232233 start_word = "<S>" ,
233234 end_word = "</S>" ,
234- unk_word = "<UNK>" ):
235+ unk_word = "<UNK>" ,
236+ pad_word = "<PAD>" ):
235237 if not tf .gfile .Exists (vocab_file ):
236238 tf .logging .fatal ("Vocab file %s not found." , vocab_file )
237239 tf .logging .info ("Initializing vocabulary from file: %s" , vocab_file )
@@ -256,9 +258,11 @@ def __init__(self,
256258 self .start_id = vocab [start_word ]
257259 self .end_id = vocab [end_word ]
258260 self .unk_id = vocab [unk_word ]
261+ self .pad_id = vocab [pad_word ]
259262 print (" start_id: %d" % self .start_id )
260263 print (" end_id: %d" % self .end_id )
261264 print (" unk_id: %d" % self .unk_id )
265+ print (" pad_id: %d" % self .pad_id )
262266
263267 def word_to_id (self , word ):
264268 """Returns the integer word id of a word string."""
You can’t perform that action at this time.
0 commit comments