mirror of https://github.com/explosion/spaCy.git
Update docstrings and types
This commit is contained in:
parent
823e533dc1
commit
c675746ca2
|
@ -45,7 +45,9 @@ def configure_minibatch_by_words(
|
||||||
|
|
||||||
|
|
||||||
@registry.batchers("batch_by_sequence.v1")
|
@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 {}
|
optionals = {"get_length": get_length} if get_length is not None else {}
|
||||||
return partial(minibatch, size=size, **optionals)
|
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
|
"""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
|
are longer than the specified batch length, they will appear in a batch by
|
||||||
themselves, or be discarded if discard_oversize=True.
|
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):
|
if isinstance(size, int):
|
||||||
size_ = itertools.repeat(size)
|
size_ = itertools.repeat(size)
|
||||||
elif isinstance(size, List):
|
elif isinstance(size, List):
|
||||||
|
|
|
@ -74,7 +74,6 @@ class Corpus:
|
||||||
"""Yield examples from the data.
|
"""Yield examples from the data.
|
||||||
|
|
||||||
nlp (Language): The current nlp object.
|
nlp (Language): The current nlp object.
|
||||||
loc (Path): The file or directory to read from.
|
|
||||||
YIELDS (Example): The examples.
|
YIELDS (Example): The examples.
|
||||||
|
|
||||||
DOCS: https://spacy.io/api/corpus#call
|
DOCS: https://spacy.io/api/corpus#call
|
||||||
|
|
Loading…
Reference in New Issue