bnl.ops

This module provides the core algorithmic operations for transforming

The core components are:

  • A generic Strategy base class that provides a registry pattern.

  • Three specialized abstract strategy classes that inherit from Strategy:

    • SalienceStrategy: For calculating boundary importance.

    • CleanStrategy: For refining boundary contours.

    • LevelStrategy: For converting continuous salience into discrete levels.

  • Concrete implementations for each strategy type, which can be extended.

Classes

SalienceStrategy()

Abstract base class for salience calculation strategies.

SalByCount()

Salience based on frequency of occurrence.

SalByDepth()

Salience based on the coarsest layer of appearance.

SalByProb()

Salience weighted by layer density.

CleanStrategy()

Abstract base class for boundary cleaning strategies.

CleanByAbsorb([window])

Clean boundaries by absorbing less salient ones within a window.

CleanByKDE([bw])

Clean boundaries by finding peaks in a weighted kernel density estimate.

LevelStrategy()

Abstract base class for boundary level quantizing strategies.

LevelByUniqueSal()

Find all distinct salience values and use their integer rank as level.

LevelByMeanShift([bw])

Use mean shift clustering to find peaks in the salience values and clusters them into levels.