MCPcopy Create free account
hub / github.com/pytorch/tutorials / addWord

Method addWord

intermediate_source/seq2seq_translation_tutorial.py:166–173  ·  view source on GitHub ↗
(self, word)

Source from the content-addressed store, hash-verified

164 self.addWord(word)
165
166 def addWord(self, word):
167 if word not in self.word2index:
168 self.word2index[word] = self.n_words
169 self.word2count[word] = 1
170 self.index2word[self.n_words] = word
171 self.n_words += 1
172 else:
173 self.word2count[word] += 1
174
175
176######################################################################

Callers 1

addSentenceMethod · 0.95

Calls

no outgoing calls

Tested by

no test coverage detected