Skip to content

Commit adbc5a7

Browse files
committed
parent and child type fix + removing payload initialization
1 parent 997e338 commit adbc5a7

File tree

4 files changed

+12
-12
lines changed

4 files changed

+12
-12
lines changed

forte/data/data_store.py

+2-2
Original file line numberDiff line numberDiff line change
@@ -890,7 +890,7 @@ def get_datastore_attr_idx(self, type_name: str, attr: str) -> int:
890890
891891
Args:
892892
type_name (str): The fully qualified type name of the entry.
893-
attr (str): The name of the attribute whose index beeds to be fetched.
893+
attr (str): The name of the attribute whose index needs to be fetched.
894894
895895
Returns:
896896
An integer representing the attributes position in the Data
@@ -917,7 +917,7 @@ def initialize_and_validate_entry(
917917
`member_type` is converted from an object to `str`.
918918
919919
Args:
920-
entry (list): The initial version of the dtaa store entry
920+
entry (list): The initial version of the data store entry
921921
whose values need to be validated.
922922
923923
Returns:

forte/data/extractors/relation_extractor.py

+2-2
Original file line numberDiff line numberDiff line change
@@ -69,14 +69,14 @@ def initialize(self, config: Union[Dict, Config]):
6969
"`entry_class` to this extractor " "must be a Link tpe."
7070
)
7171

72-
self._parent_class: Type[Annotation] = self._entry_class.ParentType
72+
self._parent_class: Type[Annotation] = self._entry_class.ParentType # type: ignore
7373
if not issubclass(self._parent_class, Annotation):
7474
raise ProcessorConfigError(
7575
f"The parent class of the provided {self.config.entry_type}"
7676
" must be an Annotation."
7777
)
7878

79-
self._child_class: Type[Annotation] = self._entry_class.ChildType
79+
self._child_class: Type[Annotation] = self._entry_class.ChildType # type: ignore
8080
if not issubclass(self._child_class, Annotation):
8181
raise ProcessorConfigError(
8282
f"The child class of the provided {self.config.entry_type}"

forte/data/ontology/core.py

+6
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@
2121
from collections.abc import MutableSequence, MutableMapping
2222
from dataclasses import dataclass
2323
from typing import (
24+
Any,
2425
Iterable,
2526
Optional,
2627
Tuple,
@@ -500,6 +501,11 @@ def data(self, array: Union[np.ndarray, List]):
500501

501502

502503
class BaseLink(Entry, ABC):
504+
505+
# this type Any is needed since subclasses of this class will have new types
506+
ParentType: Any = Entry
507+
ChildType: Any = Entry
508+
503509
def __init__(
504510
self,
505511
pack: ContainerType,

forte/data/ontology/top.py

+2-8
Original file line numberDiff line numberDiff line change
@@ -93,13 +93,10 @@ class Annotation(Entry):
9393
end: int
9494
payload_idx: int
9595

96-
def __init__(
97-
self, pack: PackType, begin: int, end: int, text_payload_idx: int = 0
98-
):
96+
def __init__(self, pack: PackType, begin: int, end: int):
9997
self._span: Optional[Span] = None
10098
self.begin: int = begin
10199
self.end: int = end
102-
self.payload_idx: int = text_payload_idx
103100
super().__init__(pack)
104101

105102
def __getstate__(self):
@@ -609,14 +606,11 @@ class AudioAnnotation(Entry):
609606
end: int
610607
payload_idx: int
611608

612-
def __init__(
613-
self, pack: PackType, begin: int, end: int, audio_payload_idx: int = 0
614-
):
609+
def __init__(self, pack: PackType, begin: int, end: int):
615610

616611
self._span: Optional[Span] = None
617612
self.begin: int = begin
618613
self.end: int = end
619-
self.payload_idx: int = audio_payload_idx
620614
super().__init__(pack)
621615

622616
@property

0 commit comments

Comments
 (0)