Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fixed an issue, #8

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 4 additions & 2 deletions pysmilesutils/tokenize.py
Original file line number Diff line number Diff line change
Expand Up @@ -601,6 +601,8 @@ def _check_encoding_type(self, encoding_type: str) -> None:
def _state_properties(self) -> Dict[str, Any]:
"""Return properties to reconstruct the internal state of the tokenizer"""
dict_ = {"regex": self._re.pattern if self._re else ""}
dict_["_regex_tokens"] = self._regex_tokens
dict_["_tokens"] = self._tokens
dict_["special_tokens"] = {
name: val for name, val in self.special_tokens.items()
}
Expand All @@ -616,8 +618,8 @@ def _update_state(self, dict_: Dict[str, Any]) -> None:
self._end_of_smiles_token = dict_["special_tokens"]["end"]
self._padding_token = dict_["special_tokens"]["pad"]
self._unknown_token = dict_["special_tokens"]["unknown"]
self._regex_tokens = []
self._tokens = []
self._regex_tokens = dict_.get("_regex_tokens",[])
self._tokens = dict_.get("_tokens",[])


class SMILESAtomTokenizer(SMILESTokenizer):
Expand Down