API Reference
Add feature system definition file on top of the stack of config files. |
|
Return a new feature system from context string in the given format. |
|
Feature set lattice defined by config instance. |
|
Formal concept intent as ordered set of features. |
|
Define possible feature combinations and their minimal specification. |
- features.add_config(filename)
Add feature system definition file on top of the stack of config files.
- Parameters:
filename – Path to the INI-file with feature system definitions.
Note
If
filename
is a relative path, it is resolved relative to the directory of the caller (which may be different from the current working dicrectry).
- features.make_features(context, frmat='table', str_maximal=False)
Return a new feature system from context string in the given format.
- Parameters:
Example
>>> make_features(''' ... |+male|-male|+adult|-adult| ... man | X | | X | | ... woman| | X | X | | ... boy | X | | | X | ... girl | | X | | X | ... ''') <FeatureSystem object of 4 atoms 10 featuresets at 0x...>
FeatureSystem
- class features.FeatureSystem(config='default', string=None)
Feature set lattice defined by config instance.
- __call__(string='', allow_invalid=False)
Idempotently return featureset from parsed feature
string
.
- __contains__(other)
Test for feature set membership.
- __getitem__(index)
Return the feature set with the given
index
.
- __iter__()
Yield all feature sets.
- __len__()
Return the number of feature sets.
- property atoms
The systems Minimal non-infimum feature sets.
- context
The FCA context defining the feature system.
- description
A description of the feature system.
- downset_union(featuresets)
Yield all featuresets that imply any of the given ones.
- graphviz(highlight=None, maximal_label=None, topdown=None, filename=None, directory=None, render=False, view=False, **kwargs)
Return the system lattice visualization as graphviz source.
- infimum
The systems most specific feature set.
- join(featuresets)
Return the nearest featureset that subsumes all given ones.
- key
The unique name of the feature system.
- lattice
The corresponding FCA lattice of the feature system.
- meet(featuresets)
Return the nearest featureset that implies all given ones.
- supremum
The systems most general feature set.
- upset_union(featuresets)
Yield all featuresets that subsume any of the given ones.
FeatureSet
- class features.bases.FeatureSet(string='')
Formal concept intent as ordered set of features.
- property atoms
The subsumed atoms.
- complement_of(other)
Empty common extent and universal extent union comparison.
- concept
The corresponding FCA concept.
- downset()
Return the list of subsumed neighbors (including self).
- implies(other)
Implication comparison.
- incompatible_with(other)
Empty common extent comparison.
- index
The position of the feature set with its system.
- intersection(other)
Return the closest implied neighbor (generalization, join).
- property lower_neighbors
The directly subsumed neighbors.
- orthogonal_to(other)
Nonempty common extent, incomparable, nonempty extent union comparison.
- properly_implies(other)
Proper implication comparison.
- properly_subsumes(other)
Proper subsumption comparison.
- string
Space-concatenated minimal features.
- string_extent
Space-concatenated extent labels.
- string_maximal
All features space-concatenated.
- subcontrary_with(other)
Nonempty common extent and universal extent union comparison.
- subsumes(other)
Submsumption comparison.
- union(other)
Return the closest subsumed neighbor (unification, meet).
- property upper_neighbors
The directly implied neighbors.
- upset()
Return the list of implied neighbors (including self).
Config
- class features.Config(key='default')
Define possible feature combinations and their minimal specification.