Skip to content

Commit 376b3ad

Browse files
authored
Improving documentation
Documenting maybe_build_from_corpus()
1 parent fecbb15 commit 376b3ad

File tree

1 file changed

+12
-1
lines changed

1 file changed

+12
-1
lines changed

tensorflow_datasets/core/features/text_feature.py

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -130,7 +130,18 @@ def load_metadata(self, data_dir, feature_name):
130130
"Files: %s" % (feature_name, feature_files))
131131

132132
def maybe_build_from_corpus(self, corpus_generator, **kwargs):
133-
"""Call SubwordTextEncoder.build_from_corpus is encoder_cls is such."""
133+
"""If `self.encoder` is `None` and `self._encoder_cls` is of type
134+
`SubwordTextEncoder`, the method instantiates `self.encoder` as returned
135+
by `SubwordTextEncoder.build_from_corpus()`.
136+
137+
Args:
138+
corpus_generator: generator yielding `str`, from which
139+
subwords will be constructed.
140+
kwargs: see SubwordTextEncoder.build_from_corpus() for details
141+
142+
Returns:
143+
None
144+
"""
134145
if self._encoder_cls is not text_lib.SubwordTextEncoder:
135146
return
136147
if self.encoder:

0 commit comments

Comments
 (0)