DECIMER/decimer.py
def detokenize_output(predicted_array: int) -> str:
    """
    This function takes the predited tokens from the DECIMER model
    and returns the decoded SMILES string.

    Args:
        predicted_array (int): Predicted tokens from DECIMER

    Returns:
        (str): SMILES representation of the molecule
    """
    outputs = [tokenizer.index_word[i] for i in predicted_array[0].numpy()]
    prediction = (
        "".join([str(elem) for elem in outputs])
        .replace("<start>", "")
        .replace("<end>", "")
    )

    return prediction

    This function takes the predited tokens from the DECIMER model
    and returns the decoded SMILES string.

    Args:
        predicted_array (int): Predicted tokens from DECIMER

    Returns:
        (str): SMILES representation of the molecule
    
This function takes the predited tokens from the DECIMER model
and returns the decoded SMILES string.
This function takes the predited tokens from the DECIMER model and returns the decoded SMILES string .
def detokenize_output(predicted_array: int) -> str:
    outputs = [tokenizer.index_word[i] for i in predicted_array[0].numpy()]
    prediction = (
        "".join([str(elem) for elem in outputs])
        .replace("<start>", "")
        .replace("<end>", "")
    )
    return prediction
def detokenize_output ( predicted_array : int ) -> str : outputs = [ tokenizer . index_word [ i ] for i in predicted_array [ 0 ] . numpy ( ) ] prediction = ( "" . join ( [ str ( elem ) for elem in outputs ] ) . replace ( "<start>" , "" ) . replace ( "<end>" , "" ) ) return prediction
This function takes the predited tokens from the DECIMER model
and returns the decoded SMILES string.
This function takes the predited tokens from the DECIMER model and returns the decoded SMILES string .
"""
    This function takes the predited tokens from the DECIMER model
    and returns the decoded SMILES string.

    Args:
        predicted_array (int): Predicted tokens from DECIMER

    Returns:
        (str): SMILES representation of the molecule
    """
SMILES representation of the molecule
SMILES representation of the molecule
(str)
predicted_array
int
Predicted tokens from DECIMER
Predicted tokens from DECIMER