NlpTools API
Class

NlpTools\Utils\ClassifierBasedTransformation

class ClassifierBasedTransformation implements TransformationInterface

Classify whatever is passed in the transform and pass it a different set of transformations based on the class.

Can be used to create, for instance, language based transformations.

Methods

__construct(ClassifierInterface $cls)

In order to classify anything with NlpTools we need something that implements the ClassifierInterface.

mixed transform($w)

Classify the passed in variable w and then apply each transformation to the output of the previous one.

register(string $class, array|TransformationInterface $transforms)

Register a set of transformations for a given class.

Details

at line 29
public __construct(ClassifierInterface $cls)

In order to classify anything with NlpTools we need something that implements the ClassifierInterface.

We also need the set
of classes but that will be calculated by the classes for which
we register a transformation.

Parameters

ClassifierInterface $cls

at line 38
public mixed transform($w)

Classify the passed in variable w and then apply each transformation to the output of the previous one.

Parameters

$w

Return Value

mixed

at line 58
public register(string $class, array|TransformationInterface $transforms)

Register a set of transformations for a given class.

Parameters

string $class
array|TransformationInterface $transforms Either an array of transformations or a single transformation