Skip to content
This repository has been archived by the owner on Jan 15, 2024. It is now read-only.

Commit

Permalink
Fix doc and superfluous inheritance
Browse files Browse the repository at this point in the history
  • Loading branch information
leezu committed Jul 1, 2018
1 parent 276d89e commit d3dde28
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 3 deletions.
17 changes: 15 additions & 2 deletions gluonnlp/embedding/token_embedding.py
Original file line number Diff line number Diff line change
Expand Up @@ -480,8 +480,21 @@ def unknown_autoextend(self):

return self._unknown_autoextend

def __contains__(self, x):
return x in self._token_to_idx
def __contains__(self, token):
"""Check if token is known.
Parameters
----------
token : str
A token.
Returns
-------
bool:
Return True if the token is known. A token is known if it has been
assigned an index and vector.
"""
return token in self._token_to_idx

def __eq__(self, other):
if isinstance(other, TokenEmbedding):
Expand Down
2 changes: 1 addition & 1 deletion gluonnlp/model/train/embedding.py
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@ def __getitem__(self, tokens):
raise NotImplementedError


class SimpleEmbeddingModel(EmbeddingModel, Block):
class SimpleEmbeddingModel(EmbeddingModel):
"""A trainable embedding model.
This class is a simple wrapper around the mxnet.gluon.nn.Embedding. It
Expand Down

0 comments on commit d3dde28

Please sign in to comment.