Skip to content

Fix: CountVectorizer Upper Case Issue on Unicode Characters - #3

Merged
pasaaliaslan merged 6 commits into
devfrom
fix/CountVectorizerUpperCaseIssue
Mar 6, 2022
Merged

pasaaliaslan merged 6 commits into
devfrom
fix/CountVectorizerUpperCaseIssue

Conversation

@pasaaliaslan

Copy link
Copy Markdown
Collaborator

Reference Issues/PRs

Fixes scikit-learn#21207

What does this implement/fix?

CountVectorizer couldn't convert special unicode characters such as ™️, ℠, Á, È, Ç, Ñ, Û, to lowercase (i.e. to tm, sm, a, e, c, n, u, respectively), due to a wrong algorithmic order of events: the code was trying to convert all letters to lowercase then get rid of any accents in them. However, as python's lower() function cannot recognize such unicode characters, they remained unchanged.

This PR is for the bug fix that implements support for converting such characters to lowercase by getting rid of their accents (e.g. ™️ is converted to TM) first, then applying python's lower() function on them.

@pasaaliaslan pasaaliaslan added the bug Something isn't working label Mar 6, 2022
@pasaaliaslan pasaaliaslan self-assigned this Mar 6, 2022

@lialber2 lialber2 left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good

@pasaaliaslan
pasaaliaslan merged commit 0a8c398 into dev Mar 6, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants