def index_of_masked_word(sentence, bert):
    "Return index of the masked word in `sentence` using `bert`'s' tokenizer.\n\n    We use this function to calculate the linear distance between the target\n    and controller as BERT sees it.\n\n    Parameters\n    ----------\n    sentence : str\n\n    Returns\n    -------\n    int\n\n    "
    tokens = bert.tokenize(sentence)
    try:
        return tokens.index(MASK)
    except ValueError:
        return (- 1)
Return index of the masked word in `sentence` using `bert`'s' tokenizer.

We use this function to calculate the linear distance between the target
and controller as BERT sees it.

Parameters
----------
sentence : str

Returns
-------
int
def index_of_masked_word(sentence, bert):
    "Return index of the masked word in `sentence` using `bert`'s' tokenizer.\n\n    We use this function to calculate the linear distance between the target\n    and controller as BERT sees it.\n\n    Parameters\n    ----------\n    sentence : str\n\n    Returns\n    -------\n    int\n\n    "
    tokens = bert.tokenize(sentence)
    try:
        return tokens.index(MASK)
    except ValueError:
        return (- 1)