mirror of
https://github.com/explosion/spaCy.git
synced 2024-12-27 10:26:35 +03:00
ec45f704b1
* Drop python 3.6/3.7, remove unneeded compat * Remove unused import * Minimal python 3.8+ docs updates
47 lines
1.2 KiB
Python
47 lines
1.2 KiB
Python
from typing import List, Tuple, Union, Optional, Callable, Any, Dict, Literal
|
|
from typing import overload
|
|
from .matcher import Matcher
|
|
from ..vocab import Vocab
|
|
from ..tokens import Doc, Span
|
|
|
|
class PhraseMatcher:
|
|
def __init__(
|
|
self, vocab: Vocab, attr: Optional[Union[int, str]], validate: bool = ...
|
|
) -> None: ...
|
|
def __reduce__(self) -> Any: ...
|
|
def __len__(self) -> int: ...
|
|
def __contains__(self, key: str) -> bool: ...
|
|
def add(
|
|
self,
|
|
key: str,
|
|
docs: List[Doc],
|
|
*,
|
|
on_match: Optional[
|
|
Callable[[Matcher, Doc, int, List[Tuple[Any, ...]]], Any]
|
|
] = ...,
|
|
) -> None: ...
|
|
def _add_from_arrays(
|
|
self,
|
|
key: str,
|
|
specs: List[List[int]],
|
|
*,
|
|
on_match: Optional[
|
|
Callable[[Matcher, Doc, int, List[Tuple[Any, ...]]], Any]
|
|
] = ...,
|
|
) -> None: ...
|
|
def remove(self, key: str) -> None: ...
|
|
@overload
|
|
def __call__(
|
|
self,
|
|
doclike: Union[Doc, Span],
|
|
*,
|
|
as_spans: Literal[False] = ...,
|
|
) -> List[Tuple[int, int, int]]: ...
|
|
@overload
|
|
def __call__(
|
|
self,
|
|
doclike: Union[Doc, Span],
|
|
*,
|
|
as_spans: Literal[True],
|
|
) -> List[Span]: ...
|