Skip to content
Snippets Groups Projects
TextMiningService.py 1.06 KiB
Newer Older
Carlos Vega's avatar
Carlos Vega committed
from abc import ABCMeta, abstractmethod
from typing import List
from models.publication import Publication
from models.coocurrence import CoOccurrence
Carlos Vega's avatar
Carlos Vega committed

Carlos Vega's avatar
Carlos Vega committed

Carlos Vega's avatar
Carlos Vega committed
class TextMiningService(metaclass=ABCMeta):
Carlos Vega's avatar
Carlos Vega committed
    def __init__(self, name: str, description: str):
        self.name = name
        self.description = description
Carlos Vega's avatar
Carlos Vega committed
    @abstractmethod
Valentin Groues's avatar
Valentin Groues committed
    def get_mentions(self, entities: List[str], limit: int = 20) -> List[Publication]:
        """Returns a list of publications for a given list of entity IDs in which the entities appear.

        Arguments:
            entities {List[str]} -- [description]

        Keyword Arguments:
            limit {int} -- [description] (default: {20})

        Returns:
            List[Publication] -- [description]
Carlos Vega's avatar
Carlos Vega committed
        pass

    @abstractmethod
    def get_co_occurrences(self, entity: str, limit: int = 20, types: List[str] = []s) -> List[CoOccurrence]:
        """
        Co-occurrences at publication level.
Carlos Vega's avatar
Carlos Vega committed

        To-do: decide how to handle resources that can provide co-occurrences at sentence level
        """
        pass