rics.mapping.types#

Types used for mapping.

Module Attributes

HL

Hashable type on the left side of a directional relationship.

HR

Hashable type on the right side of a directional relationship.

LeftToRight

A left-to-right mapping.

RightToLeft

A right-to-left mapping.

ValueType

A type of item being mapped.

CandidateType

A type of item being mapped.

MatchTuple

A tuple of candidates matched to a value.

ContextType

Type of context in which mapping is being performed.

UserOverrideFunction

Signature for a user-defined override function.

ScoreFunction

Signature for a likeness score function.

AliasFunction

Signature for an alias function for heuristic scoring.

FilterFunction

Signature for a filter function.

HeuristicsTypes

Types that may be interpreted as a score function heuristic.

Classes

TypeVar(name, *constraints[, bound, ...])

Type variable.

HL#

Hashable type on the left side of a directional relationship.

alias of TypeVar(‘HL’, bound=Hashable)

HR#

Hashable type on the right side of a directional relationship.

alias of TypeVar(‘HR’, bound=Hashable)

LeftToRight#

A left-to-right mapping.

alias of Dict[HL, Tuple[HR, …]]

RightToLeft#

A right-to-left mapping.

alias of Dict[HR, Tuple[HL, …]]

ValueType#

A type of item being mapped.

alias of TypeVar(‘ValueType’, bound=Hashable)

CandidateType#

A type of item being mapped.

alias of TypeVar(‘CandidateType’, bound=Hashable)

MatchTuple#

A tuple of candidates matched to a value.

alias of Tuple[CandidateType, …]

ContextType#

Type of context in which mapping is being performed.

alias of TypeVar(‘ContextType’, bound=Hashable)

UserOverrideFunction#

Signature for a user-defined override function.

Parameters
  • value – An element to find matches for.

  • candidates – Potential matches for value.

  • context – The context in which scoring is being performed.

Returns

Either None (let regular logic decide) or a single candidate c in candidates.

alias of Callable[[ValueType, Set[CandidateType], Optional[ContextType]], Optional[CandidateType]]

ScoreFunction#

Signature for a likeness score function.

Parameters
  • value – An element to find matches for.

  • candidates – Potential matches for value.

  • context – The context in which scoring is being performed.

Keyword Arguments

kwargs – Accepted only by some functions.

Yields

A score for each candidate c in candidates.

alias of Callable[[ValueType, Iterable[CandidateType], Optional[ContextType]], Iterable[float]]

AliasFunction#

Signature for an alias function for heuristic scoring.

Parameters
  • value – An element to find matches for.

  • candidates – Potential matches for value.

  • context – The context in which mapping is being performed.

Keyword Arguments

kwargs – Accepted only by some functions.

Returns

A tuple (name, candidates) with applied heuristics to increase (or decrease) score as desired.

alias of Callable[[ValueType, Iterable[CandidateType], Optional[ContextType]], Tuple[ValueType, Iterable[CandidateType]]]

FilterFunction#

Signature for a filter function.

Parameters
  • value – An element to find matches for.

  • candidates – Potential matches for value.

  • context – The context in which filtering is being performed.

Keyword Arguments

kwargs – Accepted only by some functions.

Returns

A subset of candidates to keep.

alias of Callable[[ValueType, Iterable[CandidateType], Optional[ContextType]], Set[CandidateType]]

HeuristicsTypes#

Types that may be interpreted as a score function heuristic.

alias of Union[Callable[[ValueType, Iterable[CandidateType], Optional[ContextType]], Tuple[ValueType, Iterable[CandidateType]]], Callable[[ValueType, Iterable[CandidateType], Optional[ContextType]], Set[CandidateType]]]