mirror of
https://github.com/explosion/spaCy.git
synced 2025-02-27 09:00:40 +03:00
Auto-format code with black (#9474)
* Auto-format code with black * Update spacy/pipeline/pipe.pyi Co-authored-by: explosion-bot <explosion-bot@users.noreply.github.com> Co-authored-by: Sofie Van Landeghem <svlandeg@users.noreply.github.com>
This commit is contained in:
parent
b5143b1b84
commit
29e83f0819
|
@ -25,7 +25,7 @@ except ImportError:
|
|||
if sys.version_info[:2] >= (3, 8): # Python 3.8+
|
||||
from typing import Literal
|
||||
else:
|
||||
from typing_extensions import Literal # noqa: F401
|
||||
from typing_extensions import Literal # noqa: F401
|
||||
|
||||
# Important note: The importlib_metadata "backport" includes functionality
|
||||
# that's not part of the built-in importlib.metadata. We should treat this
|
||||
|
|
|
@ -56,7 +56,9 @@ class RussianLemmatizer(Lemmatizer):
|
|||
if not len(filtered_analyses):
|
||||
return [string.lower()]
|
||||
if morphology is None or (len(morphology) == 1 and POS in morphology):
|
||||
return list(dict.fromkeys([analysis.normal_form for analysis in filtered_analyses]))
|
||||
return list(
|
||||
dict.fromkeys([analysis.normal_form for analysis in filtered_analyses])
|
||||
)
|
||||
if univ_pos in ("ADJ", "DET", "NOUN", "PROPN"):
|
||||
features_to_compare = ["Case", "Number", "Gender"]
|
||||
elif univ_pos == "NUM":
|
||||
|
@ -87,7 +89,9 @@ class RussianLemmatizer(Lemmatizer):
|
|||
filtered_analyses.append(analysis)
|
||||
if not len(filtered_analyses):
|
||||
return [string.lower()]
|
||||
return list(dict.fromkeys([analysis.normal_form for analysis in filtered_analyses]))
|
||||
return list(
|
||||
dict.fromkeys([analysis.normal_form for analysis in filtered_analyses])
|
||||
)
|
||||
|
||||
def pymorphy2_lookup_lemmatize(self, token: Token) -> List[str]:
|
||||
string = token.text
|
||||
|
|
|
@ -1,5 +1,6 @@
|
|||
from pathlib import Path
|
||||
from typing import Any, Callable, Dict, Iterable, Iterator, List, NoReturn, Optional, Tuple, Union
|
||||
from typing import Any, Callable, Dict, Iterable, Iterator, List
|
||||
from typing import NoReturn, Optional, Tuple, Union
|
||||
|
||||
from ..tokens.doc import Doc
|
||||
|
||||
|
@ -8,9 +9,14 @@ from ..language import Language
|
|||
|
||||
class Pipe:
|
||||
def __call__(self, doc: Doc) -> Doc: ...
|
||||
def pipe(self, stream: Iterable[Doc], *, batch_size: int = ...) -> Iterator[Doc]: ...
|
||||
def pipe(
|
||||
self, stream: Iterable[Doc], *, batch_size: int = ...
|
||||
) -> Iterator[Doc]: ...
|
||||
def initialize(
|
||||
self, get_examples: Callable[[], Iterable[Example]], *, nlp: Language = ...,
|
||||
self,
|
||||
get_examples: Callable[[], Iterable[Example]],
|
||||
*,
|
||||
nlp: Language = ...,
|
||||
) -> None: ...
|
||||
def score(
|
||||
self, examples: Iterable[Example], **kwargs: Any
|
||||
|
@ -26,7 +32,7 @@ class Pipe:
|
|||
self, error_handler: Callable[[str, "Pipe", List[Doc], Exception], NoReturn]
|
||||
) -> None: ...
|
||||
def get_error_handler(
|
||||
self
|
||||
self,
|
||||
) -> Callable[[str, "Pipe", List[Doc], Exception], NoReturn]: ...
|
||||
|
||||
def deserialize_config(path: Path) -> Any: ...
|
||||
|
|
|
@ -196,7 +196,11 @@ def test_pipe_class_component_model_custom():
|
|||
@Language.factory(name, default_config=default_config)
|
||||
class Component:
|
||||
def __init__(
|
||||
self, nlp: Language, model: Model, name: str, value1: StrictInt = StrictInt(10)
|
||||
self,
|
||||
nlp: Language,
|
||||
model: Model,
|
||||
name: str,
|
||||
value1: StrictInt = StrictInt(10),
|
||||
):
|
||||
self.nlp = nlp
|
||||
self.model = model
|
||||
|
|
|
@ -22,7 +22,6 @@ class Vocab:
|
|||
strings: StringStore
|
||||
vectors: Vectors
|
||||
writing_system: Dict[str, Any]
|
||||
|
||||
def __init__(
|
||||
self,
|
||||
lex_attr_getters: Optional[Dict[str, Callable[[str], Any]]] = ...,
|
||||
|
|
Loading…
Reference in New Issue
Block a user