Code
Hub
Workspaces
Following
Trending
Connect
MCP
copy
Create free account
hub
/
github.com/pytorch/tutorials
/ addSentence
Method
addSentence
intermediate_source/seq2seq_translation_tutorial.py:162–164 ·
view source on GitHub ↗
(self, sentence)
Source
from the content-addressed store, hash-verified
160
self.n_words = 2
# Count SOS and EOS
161
162
def
addSentence(self, sentence):
163
for
word in sentence.split(
' '
):
164
self.addWord(word)
165
166
def
addWord(self, word):
167
if
word not in self.word2index:
Callers
1
prepareData
Function · 0.45
Calls
1
addWord
Method · 0.95
Tested by
no test coverage detected