openboard-team / openboard

GNU General Public License v3.0
2.56k stars 252 forks source link

Emoji search #35

Open ghost opened 4 years ago

ghost commented 4 years ago

Would be quite useful if there was a way to search for emojis.

Switch to Emoji view and then search (e.g. type "heart" and you will see the heart emojis ❤️, 🥰, 💌,❣️).

knoy commented 4 years ago

This is by far the best feature the Google keyboard has over AOSP

GLLM commented 4 years ago

I'd propose an alternative : do the emoji suggestion when the user types a column ":" right before the emoji names. Example: user types :heart > he gets a suggestion for ❤️ !

Oymate commented 4 years ago

If colon is implemented it should be part of introductory tour with how to get to emoji keyboard.

aha999 commented 4 years ago

133

While in the emoji menu, it would be awesome if we could hold the spacebar button and swipe left or right to very quickly swipe through all emojis at once. That way we can find the required ones faster without mindless repeatable swiping.

I've used this feature somewhere already.

(Other emoji finding features would also be awesome, since there is so many of them i have to strain to find them and go through a workout everytime to swipe through them to find the ones i'm looking for.)

kojid0 commented 4 years ago

IMO swipe from bottom to top is easier to navigate than from right to left

ChildishGiant commented 4 years ago

Is there a build available or does that wait until release? Automatic builds could be set up using a github action like this one: https://github.com/marketplace/actions/android-build

dslul commented 4 years ago

Is there a build available or does that wait until release? Automatic builds could be set up using a github action like this one: https://github.com/marketplace/actions/android-build

I uploaded a beta release here. EDIT: I pushed the update, it is available on the releases tab.

hockeymikey commented 3 years ago

IMO swipe from bottom to top is easier to navigate than from right to left

98b9a8f still not great, but it takes time to modernize this sh**ty emoji keyboard

Tested it out, you should make it configurable for the swipe if people want left to right or vertical. And have the other direction give the ability to page so with the vertical if I swipe left or right I go to the next section of emoji category. Remove the weird gradient background behind them too. It works for horizontal but looks weird just cutting off when swiping vertical.

JonnyHaystack commented 3 years ago

Tested it out, you should make it configurable for the swipe if people want left to right or vertical. And have the other direction give the ability to page so with the vertical if I swipe left or right I go to the next section of emoji category.

Yeah, I too would really like this to be configurable. Swiping through pages up and down hurts my wrist more and is slower. It also obscures my view of the emoji I'm swiping through more.

GLLM commented 3 years ago

My 2 cents, could the emoji pages scroll not stop at every page's end ! One big swipe actually stops after 3 lines ! It's not great.

thanks

Oymate commented 3 years ago

Also take inspiration from signal's emoji explorer

JonnyHaystack commented 3 years ago

@GLLM so you don't want it to be paginated? I don't like that idea because it makes it impossible to just swipe to a page and pick an emoji from muscle memory. I consider it a downgrade on every keyboard that has done that. Would be a lot less swiping if the multiple skin tone emoji were collapsed together though

GLLM commented 3 years ago

@GLLM so you don't want it to be paginated? I don't like that idea because it makes it impossible to just swipe to a page and pick an emoji from muscle memory. I consider it a downgrade on every keyboard that has done that. Would be a lot less swiping if the multiple skin tone emoji were collapsed together though

Well, having to make a swipe move several times to check all emojis of one section is not user friendly (at least, when the user is me) :-D

ghost commented 3 years ago

+1 for this, I need to learn java or something lol

sarayourfriend commented 2 years ago

I've been thinking a bit about this feature. I'd like to help implement it but I don't have any significant android dev experience. Poking around the code I think there's a couple different "phases" that this could be implemented in. Really two but they both have a specific dependency:

  1. "Suggestion" based emoji search, similar to iOS where when you type "grin" the auto-complete suggestion bar will show any emoji that is an exact match with the currently typed word as the last suggestion (or potentially multiple suggestions, IIRC iOS manages to fit up to three in the space of the final word)
  2. Direct emoji search within the Emoji keyboard

Both of these have a dependency on a pre-existing database of Emoji's corresponding to matchable terms. Emojipedia has these on their website, but it doesn't appear to be under any open license where it'd be appropriate to use it as a source of information. It might be worth reaching out to them to clarify this though, as there is some prior art in extracting the Emojipedia information: https://github.com/bcongdon/python-emojipedia

Of particular interest is the Emoji::alias method, I think these are the terms that would want to be matched against for finding an emoji suggestion or as the search terms for an emoji.

There are also other Emoji databases available on GitHub under permissive licenses. This one is MIT for example.

Adding these Emoji would make it part of the dictionary for each locale so that you could seamlessly support searching for emoji in any locale that had an Emoji dictionary.

I think making a decision around that in particular would be the most difficult part. Implementing either of the two options for emoji search would then presumably be relatively straightforward.

If a maintainer wanted to give input on what their desired approach for an emoji dictionary would be, that would be super helpful for trying to start implementing this!

Note: You could also do the shortcode (:) based approach, but it would require fully new UI elements I think for completing the term and also replacing the term with the Emoji. Maybe that's an option for down the road, it seems like it'd be significantly more complicated than the other two, but that's based on my scant knowledge of the project's code and Android dev in general.

MajeurAndroid commented 2 years ago

For you guys to know, this does not look like a big deal but this is really a big feature. It's more and less the same mechanisms as language dictionaries, which are currently implemented in native C++ with dedicated binary file formats etc... not a simple thing. Unicode organization does provide emoji naming resources, localized for most common languages. The only missing thing is an efficient way of implementing it in terms of performance and data structure. For the ':emoji:' slack/github thing, it's also really difficult to implement with the current way interactions between editor (app you're typing into) and inputmethod (openboard) work in Android. The closest we can get, I think, is having emoji suggestion when typing emoji's name.

sarayourfriend commented 2 years ago

Gotcha, thanks for the clarification.

The other thing that came to mind was needing some way to pick a skin tone for the suggested emojis instead of just suggesting the default every time (though it could be a separate feature to include that ability).

Helium314 commented 2 years ago

Using the shortcut of dictionaries might be able to achieve this kind of emoji search. I tried adding some emoji to my personal dictionary, with a word as a shortcut, and indeed it works.

So I think having an (optional) emoji dictionary with symbol and name as word and shortcut might be enough to achieve some kind of emoji search.

Helium314 commented 2 years ago

Following "dictionary" actually works.

dictionary=main:en,locale=en,description=english emoji dict,date=1542122459,version=1
 word=someword,f=99
  shortcut=🥵,f=whitelist
 word=otherword,f=3,not_a_word=true
  shortcut=🤮,f=10

When trying to type someword, suggestions are 🥵 and someword. When trying to type otherword, the only suggestion is 🤮 (because otherword is "not_a_word").

sarayourfriend commented 2 years ago

I tried this using the dictionary configuration built into the app and that works nicely as well, however I noticed that from will match grin for example (typing "from" will show the grinning emoji that has a shortcut of "grin"). Is that something preventable through the other configuration available in the actual dictionary format?

Helium314 commented 2 years ago

Not sure... you could try reducing frequency of the word to some low value like f=10. Or maybe frequency of the shortcut?

Helium314 commented 2 years ago

Reducing f from 99 to 10 works, I only get the emoji suggestion when typing the exact word.

MajeurAndroid commented 2 years ago

This has been partially done apparently, see here. I think we can write some tooling to parse unicode localized names and build dictionaries from that. Though we are limited to one word per emoji I guess.

flame-0 commented 2 years ago

any updates on this?

jnnkB commented 2 years ago

Though we are limited to one word per emoji I guess.

Why do you think that? Shouldn't it be possible to have to words that have the same emoji set as a shortcut?

jnnkB commented 2 years ago

I tried generating such a dictionary today, using the existing english dictionary and the unicode CLDR data. This is the code I used:

import xml.etree.ElementTree as ET
import time

DICT_START = "dictionary=emoji:en,description=Emoji for English words,"
DICT_START += f"locale=en,date={time.time():.0f},version=44\n"

frequency_list = {}

# Downloaded from https://github.com/openboard-team/openboard/
# blob/master/dictionaries/en_wordlist.combined.gz
with open("./en_wordlist.combined") as f:
    for line in f:
        if line.startswith(" word="):
            line = line.strip()
            items = line.split(",")
            items = [item.split("=") for item in items]
            data = {item[0]: item[1] for item in items}
            frequency_list[data["word"]] = data["f"]

# Downloaded from https://github.com/unicode-org/cldr/blob/latest/common/annotations/en.xml
tree = ET.parse("./en.xml")

root = tree.getroot()
with open("en_emoji.combined", "w") as f:
    f.write(DICT_START)

    for annotation in root.iterfind("annotations/annotation"):
        # The annotations besides those for TTS are often useless
        # for this (e.g. "large" for 🦤).
        if "type" in annotation.attrib and annotation.attrib["type"] == "tts":
            for word in annotation.text.split(" | "):
                emoji = annotation.attrib["cp"]
                frequency = frequency_list[word] if word in frequency_list else 0
                f.write(
                    f" word={word},f={frequency},not_a_word=true\n  shortcut={emoji},f=14\n"
                )

And this is the output file I got: en_emoji.zip

I unfortunately do not how to proceed or test this dict.

Helium314 commented 2 years ago

I unfortunately do not how to proceed or test this dict.

You need to create a dictionary file, see https://github.com/remi0s/aosp-dictionary-tools: download dicttool_aosp.jar and run java -jar dicttool_aosp.jar makedict -s en_emoji.combined -d emoji_en.dict (or adjust the file names to whatever you need)

You should be able to use the dictionary by putting it into the internal files directory in subfolder en, though this requires root access. Alternatively you can build a version of openboard that includes the dictionary.

You will see placeholder symbols for some emojis that are not supported by your Android version. And any emoji that use more than one word might not be suggested, but you may find them in the menu when long pressing suggestions.

jnnkB commented 2 years ago

Hey @Helium314, could you describe, where to exactly put the file? Or provide a path?

Helium314 commented 2 years ago

Should be /data/data/org.dslul.openboard.inputmethod.latin/files/dicts/en/. Edit: btw this can also be used to add or replace dictionaries for other languages, even if they don't have a built-in dictionary.

jnnkB commented 2 years ago

Interestingly in /data/data/org.dslul.openboard.inputmethod.latin/files/ there is no dicts folder:

# ls
UserHistoryDictionary.de.dict
UserHistoryDictionary.de_DE.dict
UserHistoryDictionary.el.dict
UserHistoryDictionary.en_GB.dict
UserHistoryDictionary.en_US.dict
spellcheck_userunigram.en_US.dict
userunigram.de_DE.dict
userunigram.el.dict
userunigram.en_US.dict

I currently run 1.4.4.

Helium314 commented 2 years ago

Did you try creating the folder?

jnnkB commented 2 years ago

Yes, but it didn't work unfortunately

Helium314 commented 2 years ago

I just tested this on a clean install of 1.4.4, and got it working. The dictionary file is in /data/data/org.dslul.openboard.inputmethod.latin/files/dicts/en/emoji_en.dict (though the file name should not matter)

Maybe it's a permission problem? You might have the file owned by root user, and not by the app. Or maybe there was a problem creating the dict file. Mine is 30 608 bytes, created as described above in https://github.com/openboard-team/openboard/issues/35#issuecomment-1170167691.

jnnkB commented 2 years ago

I think it was a problem regarding the permissions. Its working fine now :)

anedroid commented 2 years ago

I also want emoji search! 🥺

tdbe commented 2 years ago

Just curious if any devs have time, what are the difficulties to getting this to work? Because I am a dev and the frustration here stems from:

doesn't help that it's been 2 years and I can't find any feedback

MajeurAndroid commented 2 years ago

To be honest, I use at most 15 different emojis on my daily life, which I search only the first time before they are in my recents tab (and stay in it, see #618). So this not a huge issue, for me.

But hopefully, devs do not develop features only if they matter to them ! The main reason here is complexity, I analyzed this quit a bit and figured out two technical challenges:

It is feasible, but is not trivial. I am currently working on 'material you' design feature, I might work on this next, when I'll have more spare time.

tdbe commented 2 years ago

See I thought that too but it doesn't work out. That's like saying I only use about 100-1000 words of vocabulary in my daily life. So let's just chuck the remaining 10,000+ behind massive fucking lists! 😉

I'd say 90% of people know emoji names from english. If you can spell TikTok, you can spell :eggplant -> 🍆

What I would do is like others suggested: a dictionary; an emoji dictionary that is in parallel to whatever dictionaries you have active on the current keyboard (pls allow multiple language dicts on the same active keyboard as an option). When you write ":eggplant" or even "eggplant" (other keyboards do this) then suggest the correct spelling for the word eggplant, but also suggest 🍆 .

And you can have a list of synonyms if you want to be super thorough { ":eggplant" : ["aubergine", "eggplant"], "actualEmoji" : "🍆 "} and then maybe just direct translate this to other languages if you must. But most keyboards don't bother to translate emojis afaik. It seems Microsoft doesn't either in windows 10/11.

odmfl commented 1 year ago

I found another open-source keyboard based on latinime, emoji search is implemented and it seems to work for english language.

I made a fork and for those who want can try the apk

https://github.com/odmfl/KittenBoard/actions/runs/3741323106

eventually from what i understand implement this library and adapted it for keyboard

https://github.com/muan/emojilib

It's not impossible, it could be added in Openboard as well.

vinaykharayat commented 1 year ago

This will be the best feature, I am waiting for it to come. Then gboard will be good to go!!!

odmfl commented 1 year ago

The emoji search works fine, just merge the PR. Currently only in English, but I think it will be possible to expand to other languages ​​​​with the help of users