Fix incorrect docstrings

This commit is contained in:
Matthew Honnibal 2020-09-29 18:30:38 +02:00
parent 7851020653
commit 0b5c72fce2
4 changed files with 5 additions and 12 deletions

View File

@ -103,7 +103,7 @@ class Morphologizer(Tagger):
@property @property
def label_data(self) -> Dict[str, Dict[str, Union[str, float, int, None]]]: def label_data(self) -> Dict[str, Dict[str, Union[str, float, int, None]]]:
"""RETURNS (Dict): A dictionary with all labels data.""" """A dictionary with all labels data."""
return {"morph": self.cfg["labels_morph"], "pos": self.cfg["labels_pos"]} return {"morph": self.cfg["labels_morph"], "pos": self.cfg["labels_pos"]}
def add_label(self, label): def add_label(self, label):

View File

@ -92,12 +92,7 @@ class Tagger(Pipe):
@property @property
def label_data(self): def label_data(self):
"""Data about the labels currently added to the component. """Data about the labels currently added to the component."""
RETURNS (Dict): The labels data.
DOCS: https://nightly.spacy.io/api/tagger#labels
"""
return tuple(self.cfg["labels"]) return tuple(self.cfg["labels"])
def __call__(self, doc): def __call__(self, doc):

View File

@ -161,10 +161,7 @@ class TextCategorizer(Pipe):
@property @property
def label_data(self) -> List[str]: def label_data(self) -> List[str]:
"""RETURNS (List[str]): Information about the component's labels. """RETURNS (List[str]): Information about the component's labels."""
DOCS: https://nightly.spacy.io/api/textcategorizer#labels
"""
return self.labels return self.labels
def pipe(self, stream: Iterable[Doc], *, batch_size: int = 128) -> Iterator[Doc]: def pipe(self, stream: Iterable[Doc], *, batch_size: int = 128) -> Iterator[Doc]:

View File

@ -7,6 +7,7 @@ from libcpp.vector cimport vector
from libc.string cimport memset from libc.string cimport memset
from libc.stdlib cimport calloc, free from libc.stdlib cimport calloc, free
import random import random
from typing import Optional
import srsly import srsly
from thinc.api import set_dropout_rate from thinc.api import set_dropout_rate
@ -409,7 +410,7 @@ cdef class Parser(Pipe):
def set_output(self, nO): def set_output(self, nO):
self.model.attrs["resize_output"](self.model, nO) self.model.attrs["resize_output"](self.model, nO)
def initialize(self, get_examples, *, nlp=None, labels=None): def initialize(self, get_examples, nlp=None, labels=None):
self._ensure_examples(get_examples) self._ensure_examples(get_examples)
lexeme_norms = self.vocab.lookups.get_table("lexeme_norm", {}) lexeme_norms = self.vocab.lookups.get_table("lexeme_norm", {})
if len(lexeme_norms) == 0 and self.vocab.lang in util.LEXEME_NORM_LANGS: if len(lexeme_norms) == 0 and self.vocab.lang in util.LEXEME_NORM_LANGS: