Update docstrings and types

This commit is contained in:
Ines Montani 2020-08-05 20:29:46 +02:00
parent 823e533dc1
commit c675746ca2
2 changed files with 5 additions and 3 deletions

View File

@ -45,7 +45,9 @@ def configure_minibatch_by_words(
@registry.batchers("batch_by_sequence.v1")
def configure_minibatch(size: Sizing, get_length=None) -> BatcherT:
def configure_minibatch(
size: Sizing, get_length: Optional[Callable[[ItemT], int]] = None
) -> BatcherT:
optionals = {"get_length": get_length} if get_length is not None else {}
return partial(minibatch, size=size, **optionals)
@ -79,7 +81,8 @@ def minibatch_by_words(
"""Create minibatches of roughly a given number of words. If any examples
are longer than the specified batch length, they will appear in a batch by
themselves, or be discarded if discard_oversize=True.
The argument 'docs' can be a list of strings, Doc's or Example's. """
The argument 'docs' can be a list of strings, Docs or Examples.
"""
if isinstance(size, int):
size_ = itertools.repeat(size)
elif isinstance(size, List):

View File

@ -74,7 +74,6 @@ class Corpus:
"""Yield examples from the data.
nlp (Language): The current nlp object.
loc (Path): The file or directory to read from.
YIELDS (Example): The examples.
DOCS: https://spacy.io/api/corpus#call