<p>You might need to distinguish between a BERT model (the architecture) and a pre-trained BERT model. The former can definitely support emoji; the latter will only have reserved code points for them if they were in the data that was used to create the WordPiece tokenizer.</p>
<p>Here is <a href="http://juditacs.github.io/2019/02/19/bert-tokenization-stats.html" rel="nofollow noreferrer">an analysis of the 119,547 WordPiece vocab used in the HuggingFace multilingual model</a> It does not mention emoji. Note that 119K is very large for a vocab; more normal is 8K, 16K or 32K. The size of the vocab has quite a big influence on the model size: the first and last layers of a Transformer (e.g. BERT) model have way more weights than between any other layer.</p>
<p>I've just been skimming how the paper <a href="https://arxiv.org/abs/1910.13793" rel="nofollow noreferrer">Time to Take Emoji Seriously: They Vastly Improve Casual Conversational Models</a> deals with it. They append 3267 emoji to the end of the vocabulary. Then train it on some data with emoji in so it can try and learn what to do with those new characters.</p>
<p>BTW, a search of the HuggingFace github repository found they are using <code>from emoji import demojize</code>. This sounds like they convert emoji into text. Depending on what you are doing, you might need to disable it, or conversely you might need to be using that in your pipeline.</p>
Emojis are regarded as unknown(UNK) in BERT
<p>My research interest is effect of emojis in text. I am trying to classify sarcastic tweets in text. A month ago I have used a dataset where I added the tokens using:</p>
<blockquote>
<p>tokenizer.add_tokens('List of Emojis').</p>
</blockquote>
<p>So when I tested the BERT model had successfully added the tokens. But 2 days ago when I did the same thing for another dataset, BERT model has categorized then as 'UNK' tokens. My question is, is there a recent change in the BERT model? I have tried it with the following tokenizer,</p>
<blockquote>
<p>BertTokenizer.from_pretrained('bert-base-uncased')</p>
</blockquote>
<p>This is same for distilbert. It does not recognize the emojis despite explicitly adding them. At first I read somewhere there is no need to add them in the tokenizer because BERT or distilbert has already those emojis in the 30000 tokens but I tried both. By adding and without adding. For both cases it does not recognize the emojis.</p>
<p>What can I do to solve this issue. Your thoughts on this would be appreciated.</p>