Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add support for Multi-person skintones #259

Merged
merged 8 commits into from
Jun 8, 2023
Merged

Conversation

cvzi
Copy link
Contributor

@cvzi cvzi commented Jun 6, 2023

Finally finished this. It looks like quite a lot of changes, but apart from the multi-person skintones, I mostly just moved code around and deleted unused code:

The logic from demojize() is moved to two separate private function tokenize() and filter_tokens() in a new file emoji/tokenizer.py

demojize(), replace_emoji(), emoji_list() and analyze() all use the same logic, that's why I moved it into the new private function tokenize() and filter_tokens(). Otherwise there would have been duplicated code.
Also the logic for the search tree is moved to the emoji/tokenizer.py file.

A new public function analyze() is available and that supports the multi-person skintones. It's similar to emoji_list(). It returns Token and EmojiMatch objects that provide more information than emoji_list() and also allow to split up ZWJ-emoji into the sub-emoji.

The handling of the multi-person skintones in demojize() and replace_emoji can be controlled by the new emoji.config class, which is a static class that works as a module-wide configuration:

emoji.config.demojize_keep_zwj = True
emoji.config.replace_emoji_keep_zwj = True

I have removed support for Python 2, 3.4, 3.5, because I used some features of Python 3.6. I removed lots of things that were specific to Python 2, especially all the u'strings' .

Fixes #204
Fixes #256

cvzi added 8 commits June 6, 2023 18:54
The logic from demojize() is moved to two separate function tokenize and filter_tokens in a new file emoji/tokenizer.py
Also the logic for the search tree is moved to that file.

A new public function analyze() is available, that supports the multi-person skintones

The handling of the multi-person skintones can be controlled by the new `emoji.config` class, which is a static class that works as a module-wide configuration.
(and remove some Python 2 tests that are no longer needed)
file header -*- coding: utf-8 -*-
strings with u-prefix e.g. u'string'
… and it has been replaced by get_codes_from_unicode_emoji_data_files.py
@TahirJalilov TahirJalilov self-requested a review June 8, 2023 07:48
@TahirJalilov TahirJalilov merged commit 3b2324c into carpedm20:master Jun 8, 2023
@TahirJalilov
Copy link
Collaborator

Thank you, @cvzi for your job!

@lsmith77
Copy link

lsmith77 commented Jun 8, 2023

indeed thank you!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

how to deal with emoji's like 👨🏽‍👩🏽‍👧🏽 Multi-person skin tones
3 participants