#NEWLINE# def add_word_to_vocab( word , words , vocab_map , vocab_size ) : #NEWLINE# #INDENT# '\n    Add a word to a existing vocab. If word already exists, do nothing.\n    Especially useful for handling <s>, </s> and <unk>.\n\n    Return: updated vocab.\n    ' #NEWLINE# if ( word not in vocab_map ) : #NEWLINE# #INDENT# words . append ( word ) #NEWLINE# vocab_map [ word ] = vocab_size #NEWLINE# vocab_size += 1 #NEWLINE# #UNINDENT# return ( words , vocab_map , vocab_size )