-
-
Notifications
You must be signed in to change notification settings - Fork 4.3k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat: add example stubs (3) #12801
Merged
Merged
feat: add example stubs (3) #12801
Changes from all commits
Commits
Show all changes
17 commits
Select commit
Hold shift + click to select a range
2d1e614
feat: add example stubs
bdura 967ce50
fix: add required annotations
bdura 9cd17d7
fix: mypy issues
bdura 792b86d
fix: use Py36-compatible Portocol
bdura 0866014
Minor reformatting
adrianeboyd 331cf0e
Merge branch 'master' into feat/example-stubs
svlandeg a93f620
adding further type specifications and removing internal methods
svlandeg 69fd65d
Merge pull request #12798 from bdura/feat/example-stubs
svlandeg e79ade4
black formatting
svlandeg 975e9d4
widen type to iterable
svlandeg ef2bd64
add private methods that are being used by the built-in convertors
svlandeg 03db7e6
Merge branch 'develop' into feature/type_fixes
svlandeg 350b8dd
Merge branch 'upstream_develop' into feature/type_fixes
svlandeg 75514c4
revert changes to corpus.py
svlandeg 4220149
fixes
svlandeg 7b22b71
fixes
svlandeg 66a5ced
fix typing of PlainTextCorpus
svlandeg File filter
Filter by extension
Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,66 @@ | ||
from typing import Any, Callable, Dict, Iterable, List, Optional, Tuple | ||
|
||
from ..tokens import Doc, Span | ||
from ..vocab import Vocab | ||
from .alignment import Alignment | ||
|
||
def annotations_to_doc( | ||
vocab: Vocab, | ||
tok_annot: Dict[str, Any], | ||
doc_annot: Dict[str, Any], | ||
) -> Doc: ... | ||
def validate_examples( | ||
examples: Iterable[Example], | ||
method: str, | ||
) -> None: ... | ||
def validate_get_examples( | ||
get_examples: Callable[[], Iterable[Example]], | ||
method: str, | ||
): ... | ||
|
||
class Example: | ||
x: Doc | ||
y: Doc | ||
|
||
def __init__( | ||
self, | ||
predicted: Doc, | ||
reference: Doc, | ||
*, | ||
alignment: Optional[Alignment] = None, | ||
): ... | ||
def __len__(self) -> int: ... | ||
@property | ||
def predicted(self) -> Doc: ... | ||
@predicted.setter | ||
def predicted(self, doc: Doc) -> None: ... | ||
@property | ||
def reference(self) -> Doc: ... | ||
@reference.setter | ||
def reference(self, doc: Doc) -> None: ... | ||
def copy(self) -> Example: ... | ||
@classmethod | ||
def from_dict(cls, predicted: Doc, example_dict: Dict[str, Any]) -> Example: ... | ||
@property | ||
def alignment(self) -> Alignment: ... | ||
def get_aligned(self, field: str, as_string=False): ... | ||
def get_aligned_parse(self, projectivize=True): ... | ||
def get_aligned_sent_starts(self): ... | ||
def get_aligned_spans_x2y( | ||
self, x_spans: Iterable[Span], allow_overlap=False | ||
) -> List[Span]: ... | ||
def get_aligned_spans_y2x( | ||
self, y_spans: Iterable[Span], allow_overlap=False | ||
) -> List[Span]: ... | ||
def get_aligned_ents_and_ner(self) -> Tuple[List[Span], List[str]]: ... | ||
def get_aligned_ner(self) -> List[str]: ... | ||
def get_matching_ents(self, check_label: bool = True) -> List[Span]: ... | ||
def to_dict(self) -> Dict[str, Any]: ... | ||
def split_sents(self) -> List[Example]: ... | ||
@property | ||
def text(self) -> str: ... | ||
def __str__(self) -> str: ... | ||
def __repr__(self) -> str: ... | ||
|
||
def _parse_example_dict_data(example_dict): ... | ||
def _fix_legacy_dict_data(example_dict): ... |
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The setter should also accept a wider range of values including tuples, so this is incorrect in many ways. I don't really think we should encourage the use of tuples here, but the general bug/constraint from mypy is pretty limiting.