nlpretext.preprocessor module

class nlpretext.preprocessor.Preprocessor[source]

Bases: object

static build_pipeline(operation_list: List[dict])sklearn.pipeline.Pipeline[source]

Build sklearn pipeline from a operation list

Parameters

operation_list (iterable) – list of __operations of preprocessing

Returns

Return type

sklearn.pipeline.Pipeline

pipe(operation: Callable, args: Optional[dict] = None)[source]

Add an operation and its arguments to pipe in the preprocessor

Parameters
  • operation (callable) – text preprocessing function

  • args (dict of arguments) –

run(text: str)str[source]

Apply pipeline to text

Parameters

text (string) – text to preprocess

Returns

Return type

string