annif.transform package

Submodules

annif.transform.inputlimiter module

A simple transformation that truncates the text of input documents to a given character length.

class annif.transform.inputlimiter.InputLimiter(project, input_limit)

Bases: annif.transform.transform.BaseTransform

name = 'limit'
transform_fn(text)

Perform the text transformation.

annif.transform.langfilter module

annif.transform.transform module

Common functionality for transforming text of input documents.

class annif.transform.transform.BaseTransform(project)

Bases: object

Base class for text transformations, which need to implement the transform function.

name = None
abstract transform_fn(text)

Perform the text transformation.

class annif.transform.transform.IdentityTransform(project)

Bases: annif.transform.transform.BaseTransform

Transform that does not modify text but simply passes it through.

name = 'pass'
transform_fn(text)

Perform the text transformation.

class annif.transform.transform.TransformChain(transform_classes, args, project)

Bases: object

Class instantiating and holding the transformation objects performing the actual text transformation.

transform_corpus(corpus)
transform_text(text)

Module contents

Functionality for obtaining text transformation from string specification

annif.transform.get_transform(transform_specs, project)
annif.transform.parse_specs(transform_specs)

Parse a transformation specification into a list of tuples, e.g. ‘transf_1(x),transf_2(y=42),transf_3’ is parsed to [(transf_1, [x], {}), (transf_2, [], {y: 42}), (transf_3, [], {})].