Hierarchy¶
- ocdskit.hierarchy.get_base_class_name(class_names, prefix='')[source]¶
Derive a base class name from the longest common subsequence of words within class names.
- ocdskit.hierarchy.get_base_classes_via_fca(classes, min_intent=2, min_extent=2, max_field_prevalence=1.0, base_class_name_prefix='')[source]¶
Identify base classes using Formal Concept Analysis.
Builds a concept lattice from the property sets of each class. Concepts are filtered to those with at least
min_extentmember classes andmin_intentnon-inherited, non-common properties. Properties found in more thanmax_field_prevalenceof classes are considered common and ignored for themin_intentthreshold.- Parameters:
classes (dict) – mapping of definition names to sets of
{prop}:{hash}stringsmin_intent (int) – minimum number of non-inherited, non-common properties for a base class
min_extent (int) – minimum number of member classes for a base class
max_field_prevalence (float) – fields found in more than this proportion of classes are considered common
base_class_name_prefix (str) – a prefix to disambiguate base class names from existing class names
- Returns:
a list of dicts with
name,members, andpropskeys- Return type: