Skip to content

Commit

Permalink
improve error handling in deepSMILES reader
Browse files Browse the repository at this point in the history
  • Loading branch information
sfluegel committed Nov 24, 2023
1 parent c615f17 commit 46852e4
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions chebai/preprocessing/reader.py
Original file line number Diff line number Diff line change
Expand Up @@ -124,15 +124,15 @@ def name(cls):
def _read_data(self, raw_data):
try:
tokenized = _tokenize(self.converter.encode(raw_data))
tokenized = [self._get_token_index(v[1]) for v in tokenized]
except ValueError as e:
print(f'could not process {raw_data}')
print(f'Corresponding deepSMILES: {self.converter.encode(raw_data)}')
print(f'\t{e}')
self.error_count += 1
print(f'\terror count: {self.error_count}')
tokenized = []
return [
self._get_token_index(v[1]) for v in tokenized
]
return tokenized


class ChemDataUnlabeledReader(ChemDataReader):
Expand Down

0 comments on commit 46852e4

Please sign in to comment.