mirror of
https://github.com/explosion/spaCy.git
synced 2024-12-26 01:46:28 +03:00
b60b027927
* Add default to MorphAnalysis.get Similar to `dict`, allow a `default` option for `MorphAnalysis.get` for the user to provide a default return value if the field is not found. The default return value remains `[]`, which is not the same as `dict.get`, but is already established as this method's default return value with the return type `List[str]`. However the new `default` option does not enforce that the user-provided default is actually `List[str]`. * Restore test case
21 lines
860 B
Python
21 lines
860 B
Python
from typing import Any, Dict, Iterator, List, Optional, Union
|
|
from ..vocab import Vocab
|
|
|
|
class MorphAnalysis:
|
|
def __init__(
|
|
self, vocab: Vocab, features: Union[Dict[str, str], str] = ...
|
|
) -> None: ...
|
|
@classmethod
|
|
def from_id(cls, vocab: Vocab, key: Any) -> MorphAnalysis: ...
|
|
def __contains__(self, feature: str) -> bool: ...
|
|
def __iter__(self) -> Iterator[str]: ...
|
|
def __len__(self) -> int: ...
|
|
def __hash__(self) -> int: ...
|
|
def __eq__(self, other: MorphAnalysis) -> bool: ... # type: ignore[override]
|
|
def __ne__(self, other: MorphAnalysis) -> bool: ... # type: ignore[override]
|
|
def get(self, field: Any, default: Optional[List[str]]) -> List[str]: ...
|
|
def to_json(self) -> str: ...
|
|
def to_dict(self) -> Dict[str, str]: ...
|
|
def __str__(self) -> str: ...
|
|
def __repr__(self) -> str: ...
|