Skip to content

trimbed presets

trimbed.cli.list_presets

List the must-keep presets that --keep-preset and selection.keep_presets accept.

A preset is a named rule for tokens that must survive the trim regardless of what the corpus says: the byte alphabet, punctuation, a whole Unicode script. Names ending in :... are parametrised: supply the argument after the colon, e.g. script:Latin.

trimbed presets

trimbed.presets.render_presets() returns the same text, for a program that wants it.

The structural presets are printed apart from the rest, because the trim keeps those tokens whether or not you name them. Naming one is still how a run without a corpus gets a must-keep source, which is what trimbed trim --model ... does by default.

The registry is user-extensible, so this reflects whatever @register_preset has been applied by the time it runs. See examples/04_custom_preset.py for how to add your own.

run

run(verbose: bool = False, quiet: bool = False) -> None

Print every registered preset with what it selects, structural ones first.

Parameters:

Name Type Description Default
verbose bool

Emit debug logging.

False
quiet bool

Only emit warnings and errors.

False

add_arguments

add_arguments(parser: ArgumentParser) -> None

Add the listing arguments to parser.

Parameters:

Name Type Description Default
parser ArgumentParser

The trimbed presets subparser to populate.

required