def __getitem__(self, tokens):
if not isinstance(tokens, (list, tuple)):<EOL><INDENT>return self._token_to_idx[tokens]<EOL><DEDENT>else:<EOL><INDENT>return [self._token_to_idx[token] for token in tokens]<EOL><DEDENT>
Looks up indices of text tokens according to the vocabulary.

        If `unknown_token` of the vocabulary is None, looking up unknown tokens results in KeyError.

        Parameters
        ----------
        tokens : str or list of strs
            A source token or tokens to be converted.


        Returns
        -------
        int or list of ints
            A token index or a list of token indices according to the vocabulary.