API Reference

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:
  • context – Formal context table as plain-text string.
  • frmat – Format of the context string (‘table’, ‘cxt’, ‘csv’).
  • str_maximal (bool) –

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)

Feature set lattice defined by config instance.

__call__(string='')

Idempotently return featureset from parsed feature string.

atoms

Minimal non-infimum feature sets.

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)

Return the system lattice visualization as graphviz source.

join(featuresets)

Return the nearest featureset that subsumes all given ones.

meet(featuresets)

Return the nearest featureset that implies all given ones.

upset_union(featuresets)

Yield all featuresets that subsume any of the given ones.

FeatureSet

class features.bases.FeatureSet(concept)

Formal concept intent as ordered set of features.

atoms

Subsumed atoms.

complement_of(other)

Empty common extent and universal extent union.

downset()

Subsumed neighbors.

implies(other)

Implication.

incompatible_with(other)

Empty common extent.

intersection(other)

Closest implied neighbor (generalization, join).

lower_neighbors

Immediate subsumed neighbors.

orthogonal_to(other)

Nonempty common extent, incomparable, nonempty extent union.

properly_implies(other)

Proper implication.

properly_subsumes(other)

Proper subsumption.

subcontrary_with(other)

Nonempty common extent and universal extent union.

subsumes(other)

Submsumption.

union(other)

Closest subsumed neighbor (unification, meet).

upper_neighbors

Immediate implied neighbors.

upset()

Implied neighbors.

Config

class features.Config(key, context, format='table', aliases=None, inherits=None, str_maximal=False, description=None)

Define possible feature combinations and their minimal specification.