Skip to content

polyfuzz.models.BaseMatcher

The abstract BaseMatching to be modelled after for string matching

Source code in polyfuzz\models\_base.py
class BaseMatcher(ABC):
    """ The abstract BaseMatching to be modelled after for string matching """

    def __init__(self, model_id: str = "Model 0"):
        self.model_id = model_id
        self.type = "Base Model"

    @abstractmethod
    def match(self,
              from_list: List[str],
              to_list: List[str] = None,
              **kwargs) -> pd.DataFrame:
        """ Make sure you follow the same argument structure:

        Arguments:
            from_list: The list from which you want mappings
            to_list: The list where you want to map to

        Returns:
            matches: The best matches between the lists of strings
                     Columns:
                        * "From"
                        * "To"
                        * "Similarity"
        """
        raise NotImplementedError()

match(self, from_list, to_list=None, **kwargs)

Make sure you follow the same argument structure:

Parameters:

Name Type Description Default
from_list List[str]

The list from which you want mappings

required
to_list List[str]

The list where you want to map to

None

Returns:

Type Description
matches

The best matches between the lists of strings Columns: * "From" * "To" * "Similarity"

Source code in polyfuzz\models\_base.py
@abstractmethod
def match(self,
          from_list: List[str],
          to_list: List[str] = None,
          **kwargs) -> pd.DataFrame:
    """ Make sure you follow the same argument structure:

    Arguments:
        from_list: The list from which you want mappings
        to_list: The list where you want to map to

    Returns:
        matches: The best matches between the lists of strings
                 Columns:
                    * "From"
                    * "To"
                    * "Similarity"
    """
    raise NotImplementedError()