Skip to content
This repository has been archived by the owner on Mar 13, 2023. It is now read-only.

feat: Improved emoji matching #712

Merged
merged 2 commits into from
Nov 4, 2022
Merged

feat: Improved emoji matching #712

merged 2 commits into from
Nov 4, 2022

Conversation

LordOfPolls
Copy link
Member

@LordOfPolls LordOfPolls commented Nov 1, 2022

What type of pull request is this?

  • Non-breaking code change
  • Breaking code change
  • Documentation change/addition
  • Tests change

Description

Further improvements to the emoji matching system.

This now explicitly matches to regional indicator emoji (something the emoji lib lacks) without matching standard ASCII printables. This reduces the chances of matching to non-emoji characters, while still mostly full emoji coverage, including emoji-combinations

The primary flaw this resolves is it ensures matching to the following emoji, without downsides
🇦 🇧 🇨 🇩 🇪 🇫 🇬 🇭 🇮 🇯 🇰 🇱 🇲 🇳 🇴 🇵 🇶 🇷 🇸 🇹 🇺 🇻 🇼 🇽 🇾 🇿
0️⃣ 1️⃣ 2️⃣ 3️⃣ 4️⃣ 5️⃣ 6️⃣ 7️⃣ 8️⃣ 9️⃣

Changes

  • Implement target tests that PartialEmjoji.str should or should not match to
  • Implement regex for fallback matching
  • Compare matches to string.printable for further protection against false positives

Checklist

  • I've formatted my code with Black
  • I've ensured my code works on Python 3.10.x
  • I've tested my code

@LordOfPolls LordOfPolls added the Improvement Something that is already implemented but can be done better label Nov 1, 2022
@LordOfPolls LordOfPolls merged commit cfd3bb1 into 2.x Nov 4, 2022
@LordOfPolls LordOfPolls deleted the improved-emoji branch November 4, 2022 07:44
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Improvement Something that is already implemented but can be done better
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants