rxn.chemutils.tokenization.tokenize_smiles

rxn.chemutils.tokenization.tokenize_smiles(smiles, fallback_value=None)[source]

Tokenize a SMILES molecule or reaction, and join the tokens with spaces.

Parameters
  • smiles (str) – SMILES string to tokenize, for instance ‘CC(CO)=N>>CC(C=O)N’.

  • fallback_value (Optional[str], default: None) – what value to returns when the tokenization is unsuccessful. Default: no fallback, will propagate the TokenizationError exception.

Return type

str

Returns

SMILES string after tokenization, for instance ‘C C ( C O ) = N >> C C ( C = O ) N’.