from __future__ import annotations
from abc import ABC
from abc import abstractmethod
from typing import TYPE_CHECKING
import pandas as pd
if TYPE_CHECKING:
from aoptk.chemical import Chemical
from aoptk.effect import Effect
from aoptk.relationships.relationship import Relationship
[docs]
class FindRelationship(ABC):
"""Interface for finding relationships in text."""
@abstractmethod
[docs]
def find_relationships_in_text(
self,
text: str,
chemicals: list[Chemical],
effects: list[Effect],
) -> list[Relationship]:
"""Find relationships between chemicals and effects in the given text."""
@abstractmethod
[docs]
def find_relationships_in_table(
self,
table_df: pd.DataFrame,
effects: list[Effect],
) -> list[Relationship]:
"""Find relationships between chemicals and effects in the given table data."""
@abstractmethod
[docs]
def find_relationships_in_text_and_images(
self,
text: str,
image_paths: list[str],
effects: list[Effect],
) -> list[Relationship]:
"""Find relationships between chemicals and effects in the given text and images combined."""