API Reference

add_config Add feature system definition file on top of the stack of config files.
make_features Return a new feature system from context string in the given format.
FeatureSystem Feature set lattice defined by config instance.
features.bases.FeatureSet Formal concept intent as ordered set of features.
features.Config 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:
  • context (str) – 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  |
... ''')  # doctest: +ELLIPSIS
<FeatureSystem object of 4 atoms 10 featuresets at 0x...>

FeatureSystem

class features.FeatureSystem(config)

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.

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(concept)

Formal concept intent as ordered set of features.

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).

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).

upper_neighbors

The directly implied neighbors.

upset()

Return the list of implied neighbors (including self).

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.