mirror of
https://github.com/explosion/spaCy.git
synced 2025-01-11 17:56:30 +03:00
Add pipe to AttributeRuler (#5889)
This commit is contained in:
parent
9b7f198390
commit
06c3a5e048
|
@ -89,6 +89,21 @@ class AttributeRuler(Pipe):
|
||||||
set_token_attrs(token, attrs)
|
set_token_attrs(token, attrs)
|
||||||
return doc
|
return doc
|
||||||
|
|
||||||
|
def pipe(self, stream, *, batch_size=128):
|
||||||
|
"""Apply the pipe to a stream of documents. This usually happens under
|
||||||
|
the hood when the nlp object is called on a text and all components are
|
||||||
|
applied to the Doc.
|
||||||
|
|
||||||
|
stream (Iterable[Doc]): A stream of documents.
|
||||||
|
batch_size (int): The number of documents to buffer.
|
||||||
|
YIELDS (Doc): Processed documents in order.
|
||||||
|
|
||||||
|
DOCS: https://spacy.io/attributeruler/pipe#pipe
|
||||||
|
"""
|
||||||
|
for doc in stream:
|
||||||
|
doc = self(doc)
|
||||||
|
yield doc
|
||||||
|
|
||||||
def load_from_tag_map(
|
def load_from_tag_map(
|
||||||
self, tag_map: Dict[str, Dict[Union[int, str], Union[int, str]]]
|
self, tag_map: Dict[str, Dict[Union[int, str], Union[int, str]]]
|
||||||
) -> None:
|
) -> None:
|
||||||
|
|
Loading…
Reference in New Issue
Block a user