Package ai.djl.modality.nlp.preprocess
Class LambdaProcessor
java.lang.Object
ai.djl.modality.nlp.preprocess.LambdaProcessor
- All Implemented Interfaces:
TextProcessor
TextProcessor will apply user defined lambda function on input tokens.
The function can only support single input and output.
-
Constructor Summary
ConstructorsConstructorDescriptionLambdaProcessor(Function<String, String> processor) Creates aLambdaProcessorand specify the function to apply. -
Method Summary
Modifier and TypeMethodDescriptionpreprocess(List<String> tokens) Applies the preprocessing defined to the given input tokens.
-
Constructor Details
-
LambdaProcessor
Creates aLambdaProcessorand specify the function to apply.- Parameters:
processor- The lambda function to apply on input String
-
-
Method Details
-
preprocess
Applies the preprocessing defined to the given input tokens.- Specified by:
preprocessin interfaceTextProcessor- Parameters:
tokens- the tokens created after the input text is tokenized- Returns:
- the preprocessed tokens
-