Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import random
- import sys
- strings = {
- "2": [":battlefield-2:", ":bf2:"],
- "99": [":99:"],
- "a": [":amazon:", ":amd:", ":anarchy:", ":angular:", ":ansible:", ":arch:", ":atlassian:", ":azure:"],
- "actually": [":actually:"],
- "ati": [":ati:"],
- "app": [":app:"],
- "aws": [":aws:"],
- "b": [":bing:", ":bitcoin:", ":blackbaud:", ":blogger:", ":bluetooth:", ":bootstrap:", ":braintree:"],
- "ba": [":bart:"],
- "banned": [":banned_stamp:"],
- "bc": [":bandcamp:"],
- "beos": [":beos:"],
- "bet": [":bet:"],
- "butter": [":butter:"],
- "brick": [":brick:"],
- "bruh": [":bruh:"],
- "c": [":akamai:", ":c:"],
- "caltrain": [":caltrain:"],
- "colgate": [":bolgate:"],
- "co": [":bolgate-fb-1:"],
- "dont panic": [":calm:"],
- "don't panic": [":calm:"],
- "i": [":40:"],
- "lgo": [":bolgate-fb-2:"],
- "n": [":apple-news:"],
- "ninety-nine": [":99:"],
- "o": [":0_points:", ":alstom:", ":bepis:", ":btn:"],
- "oof": [":00f:"],
- "s": [":bash:"],
- "te": [":bolgate-fb-3:"],
- "two": [":battlefield-2:"],
- "two hundred": [":200:"],
- "v": [":bestgirlthink:"],
- "xd": [":adobe_xd:"],
- }
- def match(string):
- if string == None or string == "":
- return (None, [])
- elif string in strings:
- return (string, strings[string])
- else:
- return match(string[:-1])
- def emojify(string):
- tokenized = string.split()
- emojified = []
- if len(tokenized) == 0:
- return []
- elif len(tokenized) > 1:
- for token in tokenized:
- emojified += emojify(token)
- emojified += ' '
- else:
- token = tokenized[0]
- (matched, candidates) = match(token)
- if not matched:
- emojified += token[0]
- emojified += emojify(token[1:])
- else:
- emojified += random.sample(candidates, 1)
- if matched != token:
- suffix = token[len(matched):]
- emojified += emojify(suffix)
- return emojified
- if __name__ == "__main__":
- if len(sys.argv) != 2:
- print("Usage: emojifont.py <string>")
- exit(1)
- emojified = emojify(sys.argv[1])
- for font in emojified:
- print(font, end = '')
- print()
- pass
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement