Skip to content
This repository was archived by the owner on Jan 15, 2024. It is now read-only.
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 5 additions & 9 deletions src/gluonnlp/vocab/subwords.py
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ def __len__(self):
"""Return the number of subwords modeled."""
raise NotImplementedError

def indices_to_subwords(self, indices):
def indices_to_subwords(self, subwordindices):
"""Return list of subwords associated with subword indices.

This may raise RuntimeError if the subword function is not invertible.
Expand Down Expand Up @@ -135,11 +135,9 @@ def __len__(self):
def __repr__(self):
return 'ByteSubwords(encoding={})'.format(self.encoding)

def indices_to_subwords(self, indices):
def indices_to_subwords(self, subwordindices):
"""Return list of subwords associated with subword indices.

This may raise RuntimeError if the subword function is not invertible.

Parameters
----------
subwordindices : iterable of int
Expand All @@ -150,7 +148,7 @@ def indices_to_subwords(self, indices):
Iterable of str.

"""
return indices
return subwordindices

def subwords_to_indices(self, subwords):
"""Return list of subwordindices associated with subwords.
Expand Down Expand Up @@ -280,10 +278,8 @@ def __len__(self):
def __repr__(self):
return ('NGramHashes(num_subwords={}, ngrams={})'.format(self.num_subwords, self.ngrams))

def indices_to_subwords(self, indices):
"""Return list of subwords associated with subword indices.

This may raise RuntimeError if the subword function is not invertible.
def indices_to_subwords(self, subwordindices):
"""This raises RuntimeError because the subword function is not invertible.

Parameters
----------
Expand Down