rics.mapping.support#

Functions and classes used by the Mapper for handling score matrices.

Warning

This module is considered an implementation detail, and may change without notice.

Functions

enable_verbose_debug_messages()

Temporarily enable verbose DEBUG-level messages.

Classes

MatchScores(scores, min_score)

High-level selection operations.

enable_verbose_debug_messages() Generator[None, None, None][source]#

Temporarily enable verbose DEBUG-level messages.

class MatchScores(scores: DataFrame, min_score: float)[source]#

Bases: object

High-level selection operations.

Parameters
  • scores – A score matrix, where scores.index are values and score.columns are treated as the candidates.

  • min_score – Minimum score to consider make a value -> candidate match.

to_directional_mapping(cardinality: Optional[Cardinality] = None) DirectionalMapping[ValueType, CandidateType][source]#

Create a DirectionalMapping with a given target Cardinality.

Parameters

cardinality – Explicit cardinality to set, see cardinality. If None, use the actual cardinality when selecting all matches with scores above the minimum.

Returns

A DirectionalMapping.

property above: List[Record]#

Get all records with scores above the threshold.

property below: List[Record]#

Get all records with scores below the threshold.

class Record(value: ValueType, candidate: CandidateType, score: float)[source]#

Bases: Generic[ValueType, CandidateType]

Data concerning a match.

value: ValueType#

A hashable value.

candidate: CandidateType#

A hashable candidate.

score: float#

Likeness score computed by some scoring function.

class Reject(record: Record[ValueType, CandidateType], superseding_value: Optional[Record[ValueType, CandidateType]] = None, superseding_candidate: Optional[Record[ValueType, CandidateType]] = None)[source]#

Bases: Generic[ValueType, CandidateType]

Data concerning the rejection of a match.

record: Record[ValueType, CandidateType]#
superseding_value: Optional[Record[ValueType, CandidateType]] = None#
superseding_candidate: Optional[Record[ValueType, CandidateType]] = None#
explain(min_score: float, full: bool = False) str[source]#

Create a string which explains the rejection.

Parameters
  • min_score – Minimum score to accept a match.

  • full – If True show full information about superseding matches.

Returns

An explanatory string.