Nheko-Reborn / nheko

Desktop client for Matrix using Qt and C++20.
https://nheko-reborn.github.io/
GNU General Public License v3.0
1.92k stars 201 forks source link

Heuristics in emoji selector #1362

Open fpesari opened 1 year ago

fpesari commented 1 year ago

The Problem

Typing : (and any character after it) brings up a lot of emojis in a seemingly random fashion.

The suggestions also seem to defy what I expect as the most commonly used emojis which, even if probably culture-specific, could be restricted to a subset.

For example, typing :x offers these results:

image

Which sometimes do not even start with x but not :grinning_squinting:, also called the "XD" emoji (πŸ˜†) and :cross_mark:, the big X (❌).

Similarly, the autocompletion for :j offers these results:

image

With all due respect, I don't think these emojis are remotely as used as :face_with_tears_of_joy: (πŸ˜‚), which is the one I'd personally expect even if it does not technically start with "j".

The Solution

I think that emoji heuristics should be implemented, so that the most common emojis are suggested first. These heuristics:

There are various sources for compiling a list of the most commonly used emojis, one is this.

There also should be shortcuts for emojis which do not contain a specified character but are associated with it. For example, :$ gives zero results but there are many emojis which can be associated with it, such as πŸ’² or πŸ’΅ or πŸ€‘ or πŸ’°.

Alternatives

No response

Additional context

Related to completion, like #1361.

Happens in the latest version

deepbluev7 commented 1 year ago

You are aware, that the best match is at the bottom, right?

fpesari commented 1 year ago

You are aware, that the best match is at the bottom, right?

I am, but in none of the cases I tested I found the emoji which I expected.

For example, this is the completion for :s:

image

The emoji(s) I would expect would be smile-related, but there are none.

Similarly, neither :l (for "love") or :h (for "heart") bring up :red_heart: (:heart:), which is a hugely popular emoji. I actually had to look up the official name of the :red_heart: emoji on Emojipedia to find it, since not even :heart suggests it:

image

There is an additional problem. The emoji completion lists multiple variants of the same emoji, which IMHO is unhelpful because it's extremely rare that someone is going to use more than one variant. Here is an example for :w:

image

Of course, most users are only going to use one variant of :person_walking:! This variant could be configured in the settings and could be color-neutral (no skin tone) by default.

Also, in this case, I did not find popular emoji such as :winking: (:wink:) or :wine_glass: (🍷).

deepbluev7 commented 1 year ago

Well, in most of the cases you have the literal character you are searching for as the first result. The rest is just because we don't really have an emoji database apart from the raw unicode files and nobody so far found a better source set.

LorenDB commented 1 year ago

The rest is just because we don't really have an emoji database apart from the raw unicode files

Well, we do have https://github.com/Nheko-Reborn/nheko/blob/master/resources/shortcodes.txt, which allows us to manually add secondary shortcodes for emoji, so we could just add the above-mentioned entries to that. That may not completely solve this issue though.

I think that having a recency-based sort could definitely be useful for this, but we would have to figure out a good way to balance text matching and recency/frequency of use, and at that point we could also implement #926.