PeterCxy / telegram-bot-language-chinese

Chinese language model for telegram-bot-coffee
1 stars 1 forks source link

Do not strip emojis; assign them to a class. #9

Open Artoria2e5 opened 9 years ago

Artoria2e5 commented 9 years ago

Naive implmentation:

gemogi = require 'gemogi'
customTag = (word, tag) ->
    if tag isnt 'x' # We process only x
        tag

    if word in startTags
        '_my_start'
    else if word in endTags
        '_my_end'
    else if word in balTags
        '_my_bal'
    else if word in litTags
        '_my_lit_' + word
    else if word in gemogi.named    # I'd prefer contains().
        '_my_emoji' # + gemogi.unicode[named].tags[0]
    else
        tag
PeterCxy commented 9 years ago

NodeJieba doesn't work with emojis at all.

Artoria2e5 commented 9 years ago

It WORKED. ON YOUR BOT.