module Emoninja

Constants

STOPWORD_MIN_LENGTH
VERSION

Public Class Methods

emojify(text) click to toggle source
# File lib/emoninja.rb, line 12
def emojify text
  text.tap do |t|
    Data.vocabulary.each { |k, v| t.gsub!(/\b#{k}\b/i, v) }
    Data.argo.each { |k, v| t.gsub!(/\b#{k}\b/i, v.sample) if v.sample }
  end
end
emoninja(text) click to toggle source
# File lib/emoninja.rb, line 19
def emoninja text
  emojify(text).gsub(/\w+/) do |m|
    case
    when Data.stopword?(m) then m
    when (result = Data.keywords(m.stem).sample) then result.glyph
    else m
    end
  end
end
Also aliased as: yay
yay(text)
Alias for: emoninja
аватар(text) click to toggle source

rubocop:disable Style/MethodName rubocop:disable Style/OpMethod

# File lib/emoninja.rb, line 32
def аватар text
  Data.emoji(text, exact: false, number: 0, lang: :ru)
end
аватарки(text) click to toggle source

NB this won’t work with cased words, since ‘Regexp`

is currently failing to match it.

Will fix later.

# File lib/emoninja.rb, line 39
def аватарки text
  emoninja(text.gsub(Regexp.union(I18n.ru_en.keys), I18n.ru_en))
end
Also aliased as: йо
йо(text)
Alias for: аватарки