From 80b18124d20de79c5ef9c794ae496394c401edcb Mon Sep 17 00:00:00 2001 From: Ines Montani Date: Wed, 29 Jul 2020 14:03:35 +0200 Subject: [PATCH 1/5] Fix docstring [ci skip] --- spacy/pipeline/pipe.pyx | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/spacy/pipeline/pipe.pyx b/spacy/pipeline/pipe.pyx index f8ca28724..05f900e08 100644 --- a/spacy/pipeline/pipe.pyx +++ b/spacy/pipeline/pipe.pyx @@ -32,7 +32,9 @@ class Pipe: raise NotImplementedError def __call__(self, Doc doc): - """Add context-sensitive embeddings to the Doc.tensor attribute. + """Apply the pipe to one document. The document is modified in place, + and returned. This usually happens under the hood when the nlp object + is called on a text and all components are applied to the Doc. docs (Doc): The Doc to preocess. RETURNS (Doc): The processed Doc. From 8d56260d922bb566d010bb09d9cd524e4c82a58d Mon Sep 17 00:00:00 2001 From: Ines Montani Date: Wed, 29 Jul 2020 14:07:13 +0200 Subject: [PATCH 2/5] Fix docstrings [ci skip] --- spacy/pipeline/pipe.pyx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/spacy/pipeline/pipe.pyx b/spacy/pipeline/pipe.pyx index 05f900e08..3500d6cf5 100644 --- a/spacy/pipeline/pipe.pyx +++ b/spacy/pipeline/pipe.pyx @@ -76,7 +76,7 @@ class Pipe: """Modify a batch of documents, using pre-computed scores. docs (Iterable[Doc]): The documents to modify. - tokvecses: The tensors to set, produced by Pipe.predict. + scores: The scores to assign. DOCS: https://spacy.io/api/pipe#predict """ From 6e2623d3f8b9379ac44ec9079ddb724ecb80f47d Mon Sep 17 00:00:00 2001 From: Ines Montani Date: Wed, 29 Jul 2020 14:08:05 +0200 Subject: [PATCH 3/5] Fix docstring [ci skip] --- spacy/pipeline/pipe.pyx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/spacy/pipeline/pipe.pyx b/spacy/pipeline/pipe.pyx index 3500d6cf5..ab80aa32e 100644 --- a/spacy/pipeline/pipe.pyx +++ b/spacy/pipeline/pipe.pyx @@ -78,7 +78,7 @@ class Pipe: docs (Iterable[Doc]): The documents to modify. scores: The scores to assign. - DOCS: https://spacy.io/api/pipe#predict + DOCS: https://spacy.io/api/pipe#set_annotations """ raise NotImplementedError From ff0bc05da82b2b5b033c3dcc27fe499305517dd4 Mon Sep 17 00:00:00 2001 From: Ines Montani Date: Wed, 29 Jul 2020 14:09:37 +0200 Subject: [PATCH 4/5] Fix docstrings [ci skip] --- spacy/pipeline/entity_linker.py | 2 +- spacy/pipeline/morphologizer.pyx | 2 +- spacy/pipeline/senter.pyx | 2 +- spacy/pipeline/tagger.pyx | 2 +- spacy/pipeline/textcat.py | 2 +- spacy/pipeline/tok2vec.py | 2 +- 6 files changed, 6 insertions(+), 6 deletions(-) diff --git a/spacy/pipeline/entity_linker.py b/spacy/pipeline/entity_linker.py index 4165dab83..45713108a 100644 --- a/spacy/pipeline/entity_linker.py +++ b/spacy/pipeline/entity_linker.py @@ -387,7 +387,7 @@ class EntityLinker(Pipe): docs (Iterable[Doc]): The documents to modify. kb_ids (List[str]): The IDs to set, produced by EntityLinker.predict. - DOCS: https://spacy.io/api/entitylinker#predict + DOCS: https://spacy.io/api/entitylinker#set_annotations """ count_ents = len([ent for doc in docs for ent in doc.ents]) if count_ents != len(kb_ids): diff --git a/spacy/pipeline/morphologizer.pyx b/spacy/pipeline/morphologizer.pyx index a6be129ba..2f2601f3f 100644 --- a/spacy/pipeline/morphologizer.pyx +++ b/spacy/pipeline/morphologizer.pyx @@ -160,7 +160,7 @@ class Morphologizer(Tagger): docs (Iterable[Doc]): The documents to modify. batch_tag_ids: The IDs to set, produced by Morphologizer.predict. - DOCS: https://spacy.io/api/morphologizer#predict + DOCS: https://spacy.io/api/morphologizer#set_annotations """ if isinstance(docs, Doc): docs = [docs] diff --git a/spacy/pipeline/senter.pyx b/spacy/pipeline/senter.pyx index 743ceb32b..58f6f04b6 100644 --- a/spacy/pipeline/senter.pyx +++ b/spacy/pipeline/senter.pyx @@ -76,7 +76,7 @@ class SentenceRecognizer(Tagger): docs (Iterable[Doc]): The documents to modify. batch_tag_ids: The IDs to set, produced by SentenceRecognizer.predict. - DOCS: https://spacy.io/api/sentencerecognizer#predict + DOCS: https://spacy.io/api/sentencerecognizer#set_annotations """ if isinstance(docs, Doc): docs = [docs] diff --git a/spacy/pipeline/tagger.pyx b/spacy/pipeline/tagger.pyx index c52a7889b..c96f9c029 100644 --- a/spacy/pipeline/tagger.pyx +++ b/spacy/pipeline/tagger.pyx @@ -145,7 +145,7 @@ class Tagger(Pipe): docs (Iterable[Doc]): The documents to modify. batch_tag_ids: The IDs to set, produced by Tagger.predict. - DOCS: https://spacy.io/api/tagger#predict + DOCS: https://spacy.io/api/tagger#set_annotations """ if isinstance(docs, Doc): docs = [docs] diff --git a/spacy/pipeline/textcat.py b/spacy/pipeline/textcat.py index 2aaa4a769..856f3632a 100644 --- a/spacy/pipeline/textcat.py +++ b/spacy/pipeline/textcat.py @@ -163,7 +163,7 @@ class TextCategorizer(Pipe): docs (Iterable[Doc]): The documents to modify. scores: The scores to set, produced by TextCategorizer.predict. - DOCS: https://spacy.io/api/textcategorizer#predict + DOCS: https://spacy.io/api/textcategorizer#set_annotations """ for i, doc in enumerate(docs): for j, label in enumerate(self.labels): diff --git a/spacy/pipeline/tok2vec.py b/spacy/pipeline/tok2vec.py index 5bda12d1b..ea6e90169 100644 --- a/spacy/pipeline/tok2vec.py +++ b/spacy/pipeline/tok2vec.py @@ -109,7 +109,7 @@ class Tok2Vec(Pipe): docs (Iterable[Doc]): The documents to modify. tokvecses: The tensors to set, produced by Tok2Vec.predict. - DOCS: https://spacy.io/api/tok2vec#predict + DOCS: https://spacy.io/api/tok2vec#set_annotations """ for doc, tokvecs in zip(docs, tokvecses): assert tokvecs.shape[0] == len(doc) From 62266fb8286e0918366b9488b4aa4a38b9d49437 Mon Sep 17 00:00:00 2001 From: Ines Montani Date: Wed, 29 Jul 2020 14:49:49 +0200 Subject: [PATCH 5/5] Fix broken type annotation --- spacy/tokens/_serialize.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/spacy/tokens/_serialize.py b/spacy/tokens/_serialize.py index 0a5fd0c59..192067ed4 100644 --- a/spacy/tokens/_serialize.py +++ b/spacy/tokens/_serialize.py @@ -50,7 +50,7 @@ class DocBin: self, attrs: Iterable[str] = ALL_ATTRS, store_user_data: bool = False, - docs=Iterable[Doc], + docs: Iterable[Doc] = tuple(), ) -> None: """Create a DocBin object to hold serialized annotations.