Update smi-ted/training/pubchem_encoder.py
Browse files
smi-ted/training/pubchem_encoder.py
CHANGED
|
@@ -72,7 +72,7 @@ class Encoder():
|
|
| 72 |
if self.add_eos == True:
|
| 73 |
char = char + ['<eos>']
|
| 74 |
|
| 75 |
-
return torch.tensor([self.char2id[
|
| 76 |
|
| 77 |
def encoder(self, tokens):
|
| 78 |
#return *map(lambda x: self.encode(x), tokens)
|
|
|
|
| 72 |
if self.add_eos == True:
|
| 73 |
char = char + ['<eos>']
|
| 74 |
|
| 75 |
+
return torch.tensor([self.char2id.get(word, self.char2id["<unk>"]) for word in char])
|
| 76 |
|
| 77 |
def encoder(self, tokens):
|
| 78 |
#return *map(lambda x: self.encode(x), tokens)
|