def __getitem__(self, tokens):
squeeze = False<EOL>if isinstance(tokens, _str_types):<EOL><INDENT>tokens = [tokens]<EOL>squeeze = True<EOL><DEDENT>indices = mx.nd.array([self.token_to_idx[t] for t in tokens],<EOL>ctx=self.source_embedding.weight.list_ctx()[<NUM_LIT:0>])<EOL>vecs = self.source_embedding(indices) + self.context_embedding(indices)<EOL>if squeeze:<EOL><INDENT>assert len(vecs) == <NUM_LIT:1><EOL>return vecs[<NUM_LIT:0>].squeeze()<EOL><DEDENT>else:<EOL><INDENT>return vecs<EOL><DEDENT>
Looks up embedding vectors of text tokens.

        Parameters
        ----------
        tokens : str or list of strs
            A token or a list of tokens.

        Returns
        -------
        mxnet.ndarray.NDArray:
            The embedding vector(s) of the token(s). According to numpy
            conventions, if `tokens` is a string, returns a 1-D NDArray
            (vector); if `tokens` is a list of strings, returns a 2-D NDArray
            (matrix) of shape=(len(tokens), vec_len).