All Projects → forPelevin → gomoji

forPelevin / gomoji

Licence: MIT license
Helpful functions to work with emoji in Golang

Programming Languages

go
31211 projects - #10 most used programming language
Makefile
30231 projects

Projects that are alternatives of or similar to gomoji

stringsifter
A machine learning tool that ranks strings based on their relevance for malware analysis.
Stars: ✭ 567 (+800%)
Mutual labels:  strings
WeiboEmoji
Weibo Emoji is a repository for saving and sharing most Emoji images that are used/were previously used by the app Weibo.
Stars: ✭ 17 (-73.02%)
Mutual labels:  emoji
md-file-tree
Generate markdown list of all the files in a directory. Now also with emoji 📂 📄
Stars: ✭ 130 (+106.35%)
Mutual labels:  emoji
cz-gitmoji
🔬😜 Commitizen adapter for gitmoji.
Stars: ✭ 25 (-60.32%)
Mutual labels:  emoji
ansi-to-svg
😹 convert ANSI Escaped CLI strings to SVGs
Stars: ✭ 18 (-71.43%)
Mutual labels:  emoji
string theory
Flexible modern C++ string library with type-safe formatting
Stars: ✭ 32 (-49.21%)
Mutual labels:  strings
ResourcesPoet
Kotlin API for generating Android XML Resources
Stars: ✭ 102 (+61.9%)
Mutual labels:  strings
recyclebin
♻️ measures usage of a particular term on twitter
Stars: ✭ 21 (-66.67%)
Mutual labels:  emoji
emojimix
🤖 emojimix implemented in Svelte 🤖
Stars: ✭ 24 (-61.9%)
Mutual labels:  emoji
catmoji-colr
Twemoji, but with cats! Unicode 13.1! 🐱
Stars: ✭ 41 (-34.92%)
Mutual labels:  emoji
gitmoji-intellij-plugin
Intellij plugin for add a button on the commit dialog to add gitmoji
Stars: ✭ 35 (-44.44%)
Mutual labels:  emoji
react-emoji-input
😂 Emoji suggestions like the textareas in GitHub
Stars: ✭ 29 (-53.97%)
Mutual labels:  emoji
emojicodes
An extension to use emoji codes in your Sphinx documentation! 😍
Stars: ✭ 39 (-38.1%)
Mutual labels:  emoji
slackmoji
A collection of 1,000+ popular emoji for Slack and Discord
Stars: ✭ 90 (+42.86%)
Mutual labels:  emoji
react-reactions
😲 Create custom reaction pickers and counters or use your favorites!
Stars: ✭ 34 (-46.03%)
Mutual labels:  emoji
g-emoji-element
Backports native emoji characters to browsers that don't support them by replacing the characters with fallback images.
Stars: ✭ 112 (+77.78%)
Mutual labels:  emoji
emoji-data-python
Emoji toolkit for python. Parse emoji from colons and much more...
Stars: ✭ 39 (-38.1%)
Mutual labels:  emoji
EmojiKeyBoard
自定义表情键盘(支持系统表情, 图片表情),仅供参考学习~
Stars: ✭ 36 (-42.86%)
Mutual labels:  emoji
emoji-unicode
🤔 Search & Replace unicode emojis. Supports Unicode 10
Stars: ✭ 20 (-68.25%)
Mutual labels:  emoji
strsim
string similarity based on Dice's coefficient in go
Stars: ✭ 39 (-38.1%)
Mutual labels:  strings

GoMoji

work with emoji in the most convenient way

GoMoji is a Go package that provides a fast and simple way to work with emojis in strings. It has features such as:

Getting Started

Installing

To start using GoMoji, install Go and run go get:

$ go get -u github.com/forPelevin/gomoji

This will retrieve the package.

Check string contains emoji

package main

import (
    "github.com/forPelevin/gomoji"
)

func main() {
    res := gomoji.ContainsEmoji("hello world")
    println(res) // false
    
    res = gomoji.ContainsEmoji("hello world 🤗")
    println(res) // true
}

Find all

The function searches for all emoji occurrences in a string. It returns a nil slice if there are no emojis.

package main

import (
    "github.com/forPelevin/gomoji"
)

func main() {
    res := gomoji.FindAll("🧖 hello 🦋 world")
    println(res)
}

Result:

[]gomoji.Emoji{
    {
        Slug:        "person-in-steamy-room",
        Character:   "🧖",
        UnicodeName: "E5.0 person in steamy room",
        CodePoint:   "1F9D6",
        Group:       "People & Body",
        SubGroup:    "person-activity",
    },
    {
        Slug:        "butterfly",
        Character:   "🦋",
        UnicodeName: "E3.0 butterfly",
        CodePoint:   "1F98B",
        Group:       "Animals & Nature",
        SubGroup:    "animal-bug",
    },
}

Get all

The function returns all existing emojis. You can do whatever you need with the list.

package main

import (
    "github.com/forPelevin/gomoji"
)

func main() {
    emojis := gomoji.AllEmojis()
    println(emojis)
}

Remove all emojis

The function removes all emojis from given string:

res := gomoji.RemoveEmojis("🧖 hello 🦋world")
println(res) // "hello world"

Get emoji info

The function returns info about provided emoji:

info, err := gomoji.GetInfo("1") // error: the string is not emoji
info, err := gomoji.GetInfo("1️⃣")
println(info)

Result:

gomoji.Entity{
    Slug:        "keycap-1",
    Character:   "1️⃣",
    UnicodeName: "E0.6 keycap: 1",
    CodePoint:   "0031 FE0F 20E3",
    Group:       "Symbols",
    SubGroup:    "keycap",
}

Emoji entity

All searching methods return the Emoji entity which contains comprehensive info about emoji.

type Emoji struct {
    Slug        string `json:"slug"`
    Character   string `json:"character"`
    UnicodeName string `json:"unicode_name"`
    CodePoint   string `json:"code_point"`
    Group       string `json:"group"`
    SubGroup    string `json:"sub_group"`
}

Example:

[]gomoji.Emoji{
    {
        Slug:        "butterfly",
        Character:   "🦋",
        UnicodeName: "E3.0 butterfly",
        CodePoint:   "1F98B",
        Group:       "Animals & Nature",
        SubGroup:    "animal-bug",
    },
    {
        Slug:        "roll-of-paper",
        Character:   "🧻",
        UnicodeName: "E11.0 roll of paper",
        CodePoint:   "1F9FB",
        Group:       "Objects",
        SubGroup:    "household",
    },
}

Performance

GoMoji Benchmarks

goos: darwin
goarch: amd64
pkg: github.com/forPelevin/gomoji
cpu: Intel(R) Core(TM) i5-8257U CPU @ 1.40GHz
BenchmarkContainsEmojiParallel
BenchmarkContainsEmojiParallel-8   	 7439398	       159.2 ns/op	     144 B/op	       3 allocs/op
BenchmarkContainsEmoji
BenchmarkContainsEmoji-8           	 2457042	       482.2 ns/op	     144 B/op	       3 allocs/op
BenchmarkRemoveEmojisParallel
BenchmarkRemoveEmojisParallel-8    	 4589841	       265.8 ns/op	     236 B/op	       5 allocs/op
BenchmarkRemoveEmojis
BenchmarkRemoveEmojis-8            	 1456464	       831.9 ns/op	     236 B/op	       5 allocs/op
BenchmarkGetInfoParallel
BenchmarkGetInfoParallel-8         	272416886	         4.433 ns/op	       0 B/op	       0 allocs/op
BenchmarkGetInfo
BenchmarkGetInfo-8                 	64521932	        19.86 ns/op	       0 B/op	       0 allocs/op
BenchmarkFindAllParallel
BenchmarkFindAllParallel-8         	 3989124	       295.9 ns/op	     456 B/op	       5 allocs/op
BenchmarkFindAll
BenchmarkFindAll-8                 	 1304463	       913.7 ns/op	     456 B/op	       5 allocs/op

Contact

Vlad Gukasov @vgukasov

License

GoMoji source code is available under the MIT License.

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].