Skip to content

Abstract Base Classes

nplinker.scoring.abc

ScoringBase

Bases: ABC

Abstract base class of scoring methods.

Attributes:

  • name (str) –

    The name of the scoring method.

  • npl (NPLinker | None) –

    The NPLinker object.

name class-attribute instance-attribute

name: str = 'ScoringBase'

npl class-attribute instance-attribute

npl: NPLinker | None = None

setup abstractmethod classmethod

setup(npl: NPLinker)

Setup class level attributes.

Source code in src/nplinker/scoring/abc.py
@classmethod
@abstractmethod
def setup(cls, npl: NPLinker):
    """Setup class level attributes."""
get_links(*objects, **parameters) -> LinkGraph

Get links information for the given objects.

Parameters:

  • objects

    A list of objects to get links for.

  • parameters

    The parameters used for scoring.

Returns:

Source code in src/nplinker/scoring/abc.py
@abstractmethod
def get_links(
    self,
    *objects,
    **parameters,
) -> LinkGraph:
    """Get links information for the given objects.

    Args:
        objects: A list of objects to get links for.
        parameters: The parameters used for scoring.

    Returns:
        The LinkGraph object.
    """

format_data abstractmethod

format_data(data) -> str

Format the scoring data to a string.

Source code in src/nplinker/scoring/abc.py
@abstractmethod
def format_data(self, data) -> str:
    """Format the scoring data to a string."""

sort abstractmethod

sort(objects, reverse=True) -> list

Sort the given objects based on the scoring data.

Source code in src/nplinker/scoring/abc.py
@abstractmethod
def sort(self, objects, reverse=True) -> list:
    """Sort the given objects based on the scoring data."""