Giter VIP home page Giter VIP logo

emojilib's Introduction

emojilib CI status npm JavaScript Standard Style

Make emoji searchable with this keyword library.

Install

npm install emojilib --save

Usage

> require("emojilib")
{
  '๐Ÿ˜€': [
    'grinning_face',
    'face',
    'smile',
    'happy',
    'joy',
    ':D',
    'grin'
  ],
  '๐Ÿ˜ƒ': [
    'grinning_face_with_big_eyes',
    'face',
    'happy',
    'joy',
    'haha',
  ...
}

If you are looking for the unicode emoji dataset, including version, grouping, ordering, and skin tone support flag, check out unicode-emoji-json.

Migrating from 2.x

Previously:

> var emoji = require("emojilib")
> emoji.lib
{
  "grinning": {
    "keywords": ["face", "smile", "happy", "joy"],
    "char": "๐Ÿ˜€",
    "fitzpatrick_scale": false,
    "category": "people"
  },
  ...
}

Now, merge keywords with other metadata from unicode-emoji-json:

> var data = require('unicode-emoji-json')
> var keywordSet = require('emojilib')
> for (const emoji in data) {
data[emoji]['keywords'] = keywordSet[emoji]
}
> data['๐Ÿ˜€']
{
  name: 'grinning face',
  slug: 'grinning_face',
  group: 'Smileys & Emotion',
  emoji_version: '1.0',
  unicode_version: '1.0',
  skin_tone_support: false,
  keywords: [ 'grinning_face', 'face', 'smile', 'happy', 'joy', ':D', 'grin' ]
}

Previously:

> var emoji = require("emojilib")
> emoji.ordered
[ 'grinning', 'grimacing', 'grin', 'joy', 'smiley', 'smile', 'sweat_smile', ...]

Now this data can be found in unicode-emoji-json:

> var orderedEmoji = require('unicode-emoji-json/data-ordered-emoji')
['๐Ÿ˜€', '๐Ÿ˜ƒ', '๐Ÿ˜„', '๐Ÿ˜', '๐Ÿ˜†', '๐Ÿ˜…',...]

Previously:

> var emoji = require("emojilib")
> emoji.fitzpatrick_scale_modifiers
[ '๐Ÿป', '๐Ÿผ', '๐Ÿฝ', '๐Ÿพ', '๐Ÿฟ' ]

Now this data can be found in unicode-emoji-json:

> require('unicode-emoji-json/data-emoji-components')
{
  light_skin_tone: '๐Ÿป',
  medium_light_skin_tone: '๐Ÿผ',
  medium_skin_tone: '๐Ÿฝ',
  medium_dark_skin_tone: '๐Ÿพ',
  dark_skin_tone: '๐Ÿฟ',
  red_hair: '๐Ÿฆฐ',
  curly_hair: '๐Ÿฆฑ',
  white_hair: '๐Ÿฆณ',
  bald: '๐Ÿฆฒ'
}

Previously:

> require("emojilib").lib['v'].fitzpatrick_scale
true

> require("emojilib").lib['turtle'].fitzpatrick_scale
false

Now this data can be found in unicode-emoji-json:

> require('unicode-emoji-json')['โœŒ๏ธ'].skin_tone_support
true
> require('unicode-emoji-json')['๐Ÿข'].skin_tone_support
false

Development

See CONTRIBUTING.md.

emojilib's People

Contributors

allolex avatar alrra avatar andreruffert avatar andyvarvel avatar bromy avatar davefp avatar decanus avatar deon avatar dependabot[bot] avatar hrokafullur avatar hugovk avatar iamdharmveer avatar ivavictoria avatar iviolinsolo avatar jasonrudolph avatar juniperbelmont avatar kikobeats avatar muan avatar nelsonpecora avatar nishant-jain avatar notwaldorf avatar reyesh avatar risacan avatar sebastianaigner avatar sowmi3thri avatar sumanjeetsandhu avatar tamastimar avatar thatonecalculator avatar wbinnssmith avatar yous avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

emojilib's Issues

Flag names inconsistent with some other libraries/apps

emojilib & GitHub

  • ๐Ÿ‡บ๐Ÿ‡พ uruguay
  • ๐Ÿ‡ฌ๐Ÿ‡ง gb
  • ๐Ÿ‡บ๐Ÿ‡ธ us

iamcal/emoji-data & Slack

  • ๐Ÿ‡บ๐Ÿ‡พ flag-uy
  • ๐Ÿ‡ฌ๐Ÿ‡ง flag-gb
  • ๐Ÿ‡บ๐Ÿ‡ธ flag-us

How to proceed?

I'm not currently sure where these short names/codes come from. Is there some sort of standard? Should I open a request with iamcal/emoji-data, or should I change emojilib to use the flag-* format?

Note: I am trying to get emoji-mart to work correctly. See missive/emoji-mart#96 for more info.

What constitutes an acceptable keyword?

First of all, thank you for maintaining this repository!

I wrote a rudimentary emoji search program using your data, and noticed that, for example, "poop" does not match any of the keywords for ๐Ÿ’ฉ:

"๐Ÿ’ฉ": [
"pile_of_poo",
"hankey",
"shitface",
"fail",
"turd",
"shit"
],

There are a lot of other poop synonyms listed here, so I feel that "poop" would be an uncontroversial addition. But there are many synonyms for poop, and we might not want to include them all?

Another example I ran into was for ๐Ÿ“ฑ:

emojilib/dist/emoji-en-US.json

Lines 7259 to 7265 in f3169dc

"๐Ÿ“ฑ": [
"mobile_phone",
"technology",
"apple",
"gadgets",
"dial"
],

The first phrase I'd say if you asked me to identify this emoji is "cell phone." However, none of the keywords for this emoji would match "cell." Would it be appropriate to add "cell," "cell_phone," or "cellular_phone?" Are non-official keywords that use underscores OK, or should substrings like "phone" be added as well as "mobile_phone?"

Finally, and I write this sincerely, I'd like to discuss ๐Ÿ†:

emojilib/dist/emoji-en-US.json

Lines 4269 to 4275 in f3169dc

"๐Ÿ†": [
"eggplant",
"vegetable",
"nature",
"food",
"aubergine"
],

This emoji is often used to signify a penis. Would it be acceptable to add "dick" or "penis" to the list of associated keywords for this emoji? I think that doing so would better reflect common usage, but might stray too far from Unicode's "intended use" for the emoji (if that's a thing).

I suggest that a section be added to CONTRIBUTING.md or README.md that gives guidance to future contributors about questions like these.

โ€ฆand that's how I posted a GitHub issue about poop, cell phones, and penises ๐Ÿคช

Add emoji names back to list of keywords

Background:

I just remembered that my reasons for removing the names from 3.0 was because the name as an obvious keyword is available in unicode-emoji-json already. Sorry for the troubles.

#195 (comment)


It seems to me that #199, #200, and #201 might all be caused by the same issue. One of the motivation for using the emoji character as the key instead of text name as the key was because the unreliable nature of their emoji names. The text names might change, and when we edit emojilib there isn't an easy way to keep track of the name is so we can't really effectively exclude it from the keywords, therefore we might as well try to be thorough.

๐Ÿ˜”

Where can I find the mappings for current :EMOJICODE: systems (Slack, Discord, iOS, Android, etc.)?

Even the much referenced WEBFX Emoji Cheatsheet doesn't list its source or mappings. Github does, but I want to find out which code system is the most popular/used one - or rather which one's exist. I want to build an application that allows anyone to use emojicode in any application and any os and would appreciate any pointers in the right direction as to where I can find more information about the various mappings that exist already.

Unicode Emoji 11

Hey.

Thanks for this library. It has been very helpful.

Are there any plans to add support for Emoji 11?
https://emojipedia.org/unicode-11.0/

Twitter have already updated to support the new emojis, Microsoft have added support in the Windows 10 insider build and EmojiOne are planning on releasing in the first half of August.

I could give you a hand โœ‹

Emojis missing

Some of the emojis are missing, which are among people, building and fruits etc.

Emoji list is outdated

There are a lot of new emojis missing in the json file.
How you're updating the list? manually?
I thought about adding some, but there are too many to add ๐Ÿ˜ฎ

By this emojis list (from unicode.org), there are around ~2600 emojis and in the file here the are around ~1400. It's not that practical to add them manually, that's why I'm asking.

Thanks!

New emojis please ?

Hello,

New emojis are missing, like yawning, pinching hand, white heart, and more
๐Ÿฅฑ๐Ÿค๐Ÿค๐Ÿป
Can you please update the list ?

A plugin I use seems to use your library so I updated it locally from now
image

GitHub Autocomplete

Please consider including the GitHub autocomplete emoji names in the library (full list here - https://api.github.com/emojis) as the names in this library do not exactly match GitHub's names.

For example, :couplekiss_woman_woman: (:couplekiss_woman_woman:) on GitHub is listed in this library as female_couplekiss.

Maybe an entry like this would work?

  "female_couplekiss": {
    "keywords": ["pair", "valentines", "love", "like", "dating", "marriage"],
    "char": "๐Ÿ‘ฉโ€โค๏ธโ€๐Ÿ’‹โ€๐Ÿ‘ฉ",
    "category": "people"
    "xref" : {
      "GitHub": "couplekiss_woman_woman"
    }
  }

Updating list

Hello,

we are using your list at Discourse: https://github.com/discourse/discourse/blob/master/lib/tasks/emoji.rake

Thanks for it!

However, we sometimes have to patch it (code, Fitzpatrick scale...). What kind of PR are you willing to merge? Anything that would match with http://unicode.org/emoji/charts/emoji-list.html ?

For example running_woman is noted as "fitzpatrick_scale": false while it should be true (http://unicode.org/emoji/charts/emoji-list.html#1f3c3_1f3fb_200d_2640_fe0f).

Emojis to words

Hello,

I want to write an application that gets emoji of a text and turns it into words (for blind people or visually impeared people who can't see emoji well, or to people that are not used to internet and don't understand emoji) and I wish to use emojilib. But to do that, I would have to create a hashmap that the key is the char, for instance:

 "grinning": {
    "keywords": ["face", "smile", "happy", "joy", ":D", "grin"],
    "char": "๐Ÿ˜€",
    "fitzpatrick_scale": false,
    "category": "people"
}

would become:

 "๐Ÿ˜€": {
    "keywords": ["face", "smile", "happy", "joy", ":D", "grin"],
    "name": "grinning",
    "fitzpatrick_scale": false,
    "category": "people"
}

I thought of creating some kind of script which would update the second file based on the first when the first was updated (When it received a new emoji or something like that). I was thinking of using Python for that, and everytime the emoji file was updated, this script should be run (or run it during NPM install)... What do you think? Plus I would add new functions to get text based on emoji.

Keyword workflow

A friend suggested that the keyword workflow could be more streamlined and moved away from the heaving friction flow of opening a PR and a manual review. Imagine something like

  • propose an English keyword for ๐Ÿซฅ
  • community (GitHub users?) get to vote on whether that keyword is valid
  • once a keyword gathers enough vote maybe someone (well me I guess) still do a final gut check
  • one button click we can use github actions to put that keyword into the json file
  • another github action to publish

questions

  • how many votes is enough votes?
  • would this get too noisy?
  • is that gut check needed?
  • need #194 before this can happen

This seems like something https://github.com/muan/emojilib/discussions can be used for.

https://github.blog/changelog/2021-06-29-github-discussions-events-available-on-github-actions/

localization/internationalization (l10n/i18n)

I was wondering if you already thought about localization/internationalization.
There is already a PR (#6) for that. What do you think about this approach?

I think it might be complicated to maintain. If you want to add/change an emoji you have to do it in n files.
My idea would be a format e.g.

emojis.json

[
  {
    "char": "๐Ÿ",
    "name": {
      "en": "emoji_name",
      โ€ฆ
    },
    "keywords": {
      "en": ["keyword1", "keyword2"],
      โ€ฆ
    },
    "category": {
      "en": "emoji_category",
      โ€ฆ
    }
  },
  {
    โ€ฆ
  }
]

Here you could maintain one file and parse it in a build process etc. to create the different files for each language (emojis_en.json โ€ฆ) in the format like it is now.

What do you think? ๐Ÿ˜Š:v:

Some countries don't use their name.

Almost all of the country flags use their name as the key in the emojis object. However, a small handful of 'major' countries, just use a two character code, like Japan, United States, United Kingdom etc. Because of this, theres no way to give the US emoji the full name. It does have "united", "states" as two separate key words (amongst others). Japan is another example that doesn't include the full name at all.

What system should be put in place, for example, if the emoji is a flag, the first keyword is always the full country name (even if it includes spaces)?

"jp": {
--
ย  | "keywords": ["japanese", "nation", "flag", "country", "banner"],
ย  | "char": "๐Ÿ‡ฏ๐Ÿ‡ต",
ย  | "fitzpatrick_scale": false,
ย  | "category": "flags"
ย  | },

Remove the `keys` array

Do we we really need the keys array? It can be easily obtained using Object.keys(emoji). ๐Ÿ’ญ

Currently I causes some trouble because I want to check if a word is emoji, so emoji[myWord] will fail for myWord === "keys" (it's not an emoji object but an array).

Looks like it's anyway causing some problems on the Emoji Searcher page:

image

I'm almost sure there is no :keys: aliased with :-1: but it's just an issue because of the keys object.

So, is the keys array really needed? I would vote to be removed. ๐ŸŽˆ

Category Names as Keywords Redundant?

Many emojis in the emojis.json list their category name (or a piece of their category name) as a keyword. In the same way that part of their description as a keyword (as the test enforces), should these be removed as redundant information as well?

A few examples:

  "mouse2": {
    "keywords": ["animal", "nature", "rodent"],
    "char": "๐Ÿ",
    "category": "nature"
  },

There are many animals with "nature" and "animal" included in keywords, and if the category is renamed to "Animals and Nature" will be really redundant. Though, having "animal" as a keyword might distinguish it from non-animal-nature-things (facepalm).

  "family": {
    "keywords": ["home", "parents", "child", "mom", "dad", "father", "mother", "people", "human"],
    "char": "๐Ÿ‘ช",
    "category": "people"
  },

Also in this case "people" indicates more than one person moreso than the category, so it's ambiguous here too.

Let me know what you think.

Where is the data from?

I was reading through it and wondering where the data was from? Mechanical Turk? Another website?

Categorization of keywords

It would be nice to be able to add keywords in a given category (or categorize keywords) like noun, verb, adjective, adverb, ...

Release often

I need to streamline this process. Probably need to do some research into how other people do this.

UPDATE Process currently:

  1. Prebuild for simplemap.json and commit if needed
  2. Update version number in bower.json and package.json
  3. Commit changes
  4. git tag
  5. git push --tags
  6. Create release on GitHub
  7. npm publish

I wish these steps can be reduced to a button as we merge in tiny updates like keyword additions. ๐Ÿ˜‚

Some emojis show empty characters

"pleading": { "keywords": ["face", "begging", "mercy"], "char": "๐Ÿฅบ", "fitzpatrick_scale": false, "category": "people" },

Add support for searching by relevance

I used emojilib to make this project and I thought of some ideas for features I wanted. These features would require restructuring the way the emoji/keyword relations are stored and adding some information that isn't present currently.

Problems I'm trying to solve:

  1. It would be nice to have emoji sorted by search relevance (e.g. ๐Ÿ˜ธ is more similar to "smile" than ๐Ÿ˜Ž).
  2. Searching for emoji by keyword could get slow if it's necessary to iterate through all emoji to find ones that match.

My ideas for solutions:

  • Store keyword->emoji relation
  • Store relevance rank between keyword and emoji
  • Use a build step to allow relations to be represented in multiple ways through different modules (e.g. keyword->emoji map in one and the existing structure in another)

An example:

// keyword.json
{
  "smile": [
    {"emoji": "smile", "similarity": 95},
    {"emoji": "grinning", "similarity": 84},
    {"emoji": "sunglasses", "similarity": 40}
  ],
  "dog": [
    {"emoji": "dog", "similarity": 95},
    {"emoji": "dog2", "similarity": 92},
    {"emoji": "poodle", "similarity": 75},
    {"emoji": "feet", "similarity": 30}
  ]
}

// category.json
{
  "people": [
    "grinning",
    "grin",
    "joy"
  ]
}

// emoji.json
{
  "smile": {
    "char": "๐Ÿ˜„"
  },
  "grinning": {
    "char": "๐Ÿ˜€"
  },
  "sunglasses": {
    "char": "๐Ÿ˜Ž"
  }
}

These files could be compiled into emojis.json to allow backwards-compatibility.

I thought about making a library structured somewhat similar to this and basing the initial data on emojilib, but keeping it up to date would require adding similarity rankings for new additions to emojilib.

What do you think about a library like this and would it make sense to add this information to emojilib?

Add Vulcan Salute emoji (๐Ÿ––๐Ÿฝ)

I've been using the Vulcan Salite emoji for quite a while and can't seem to figure out what the text version of the emoji (for example :octocat: is :octocat:) is.

I've come up with for emojis.json

"vulcan-salute": {
    "keywords": ["vulcan", "salute", "star", "trek", "sprock", "leonard", "nimoy", "hand", "nerdfighters"],
    "char": "๐Ÿ––๐Ÿฝ",
    "category": "people"
  },

but don't know the text version. Can anyone help and add this into the library?

Add type definitions

This is more of a suggestive pull request to move to TypeScript or just set up a definition file. I would be happy to make a PR for this myself, but I want to hear your stance on typings first - if you don't want this, I'll make a PR on DefinetlyTyped instead ๐Ÿ‘

Idea: List Unicode version for each emoji

I sometimes don't want to use emojis that I know are too new to be supported on certain devices. For example unicorn might not be too new for my situation, but maybe duck is.

The Unicode version isn't a perfect indicator of age/newness, but it seems like a decent one.

Internationalization API

Hi @muan, as I saw in #6 and #9 you said we should just create a emoji-[locale].json file.
How does the index.js file should handle those in the future ?

Implement Fitzpatrick scale modifiers

It would be nice to have support for the Fitzpatrick scale modifiers for diversity. (Even though support is far from ubiquitous, with Chrome notably lagging behind in implementing this.)

The Fitzpatrick modifiers are used to add diversity to emoji. For example, ๐Ÿ‘ฆ๐Ÿฝ should display a boy with FITZ-4 applied.

Since not all emoji support the FITZ modifiers, this is not a trivial change. But I think it would be a nice addition to have.

Delete "custom" emojis

Can we get rid of "custom" emojis? Or at least put them in another file so we can pick around them. It feels like garbage. The character is null. Thats lame.

New emojis to be added

https://github.com/muan/emojilib/blob/bd543325f3becf1146eb361c30aa0e3f1ce1195b/emojis.json ref: #24

Thanks to @yoshokatana & @wbinnssmith "Smileys & People" + "Animals & Nature" are 99% done. The 1% is just the 14 different types of families which I was too lazy to add after re-ordering all of them. ๐Ÿ˜ฌ

master is currently sort of usable, i just need to cut a 2.0.0 version for it; however I would really like to get all the new emoji in for the 2.0.0... Hopefully that wouldn't be too long. โ‰๏ธ

So if anyone's interested in helping it'd be awesome! And let me know here if there are any questions.

TODOS:

โœŒ๏ธ

No way to find emoji by name

Hi!

I used your lib to replace emoji titles with real emojis, for example :wave: to ๐Ÿ‘‹๐Ÿป .
In version 2.4 there was a map name:metadata but now I can't see a way on how to find emoji by name

Any suggestions?
Thanks in advance

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.