ragraph.analysis.similarity.utils
#
Similarity utilities.
Module Contents#
Functions#
|
Get an object description function that checks whether an instance possesses |
|
Get an object description function that runs a predefined set of checks (which |
|
Check whether an objects has certain weights above a threshold in its weights |
|
Check whether an object contains certain contents. |
- ragraph.analysis.similarity.utils.on_hasattrs(attrs: List[str]) Callable[[Any], List[bool]] #
Get an object description function that checks whether an instance possesses certain attributes. It does not check the values thereof!
- Parameters:
attrs – List of attributes to check the existence of.
- Returns:
Object description function indicating attribute possession.
- ragraph.analysis.similarity.utils.on_checks(checks: List[Callable[[Any], bool]]) Callable[[Any], List[bool]] #
Get an object description function that runs a predefined set of checks (which should be in a fixed order) and returns their boolean results.
- Parameters:
checks – Checks to perform.
- Returns:
Object description function indicating check passings.
- ragraph.analysis.similarity.utils.on_hasweights(weights: List[str], threshold: float = 0.0) Callable[[Any], List[bool]] #
Check whether an objects has certain weights above a threshold in its weights dictionary property.
- Parameters:
weights – Keys to the
obj.weights
dictionary to check.threshold – Threshold to verify against.
- Returns:
Object description function indicating weights exceeding a threshold.
- ragraph.analysis.similarity.utils.on_contains(contents: List[Any]) Callable[[Any], List[bool]] #
Check whether an object contains certain contents.
- Parameters:
contents – Contents to check for with
lambda x: x in obj
.- Returns:
Object description function indicating content presence.