Skip to content

Decouple CountVectorizer => TextTokenizer + ItemCountVectorizer #23004

@eangius

Description

@eangius

Describe the workflow you want to enable

The CountVectorizer component has the responsibility of not just vectorizing term frequencies but also internally tokenizing & normalizing the input text into terms. While this functionality is convenient for NLP pipelines, it cannot be leveraged for similar type of non-NLP problems where one needs to perform tf-idf (or similar) on "document" bags of general items other than text.

Describe your proposed solution

Decouple the CountVectorizer into the following 2 specific purpose & reusable components: TextTokenizer & ItemCountVectorizer such that when both are run sequentially in a pipeline they produce the same behavior.

Describe alternatives you've considered, if relevant

In some but not all cases one could force this (vectorizing item frequency) behavior by carefully serializing the bag of items into a faked string document & configuring the CountVectorizer tokenizer parameters to split on specific delimiters. But this brittle serialization & string de-serialization becomes inefficient & a bit hacky.

Additional context

No response

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions