mirror of
https://github.com/explosion/spaCy.git
synced 2024-11-13 05:07:03 +03:00
6ae7618418
* Clean up Vocab constructor * Change effective type of `strings` from `Iterable[str]` to `Optional[StringStore]` * Don't automatically add strings to vocab * Change default values to `None` * Remove `**deprecated_kwargs` * Format
27 lines
1.2 KiB
Python
27 lines
1.2 KiB
Python
from typing import List, Optional, Iterable, Iterator, Union, Any, Tuple, overload
|
|
from pathlib import Path
|
|
|
|
class StringStore:
|
|
def __init__(self, strings: Optional[Iterable[str]] = None) -> None: ...
|
|
@overload
|
|
def __getitem__(self, string_or_hash: str) -> int: ...
|
|
@overload
|
|
def __getitem__(self, string_or_hash: int) -> str: ...
|
|
def as_int(self, string_or_hash: Union[str, int]) -> int: ...
|
|
def as_string(self, string_or_hash: Union[str, int]) -> str: ...
|
|
def add(self, string: str) -> int: ...
|
|
def items(self) -> List[Tuple[str, int]]: ...
|
|
def keys(self) -> List[str]: ...
|
|
def values(self) -> List[int]: ...
|
|
def __len__(self) -> int: ...
|
|
def __contains__(self, string_or_hash: Union[str, int]) -> bool: ...
|
|
def __iter__(self) -> Iterator[str]: ...
|
|
def __reduce__(self) -> Any: ...
|
|
def to_disk(self, path: Union[str, Path]) -> None: ...
|
|
def from_disk(self, path: Union[str, Path]) -> StringStore: ...
|
|
def to_bytes(self, **kwargs: Any) -> bytes: ...
|
|
def from_bytes(self, bytes_data: bytes, **kwargs: Any) -> StringStore: ...
|
|
def _reset_and_load(self, strings: Iterable[str]) -> None: ...
|
|
|
|
def get_string_id(string_or_hash: Union[str, int]) -> int: ...
|