Datasets:

Languages:
Chinese
Tags:
Not-For-All-Audiences
License:
b-corpus / emoji /tmp_b_emoji.py
Limour's picture
Upload 2 files
ecc433e verified
raw
history blame
700 Bytes
import emoji
# emoji.emoji_count("😬😍😻😘😚😽") == 6
import json
with open(r'E:\tmp\kajiwoto_sharegpt-len_gt_6-upvotes_gt_0-sampled.json', encoding='utf-8') as f:
tmp = json.load(f)
sc = []
for conversations in tmp:
conversations = conversations['conversations']
cc = []
ss = False
for conversation in conversations:
cc.append(conversation['from'] + ':' + conversation['value'].replace('\n', '\\n'))
if conversation['from'] == 'gpt' and emoji.emoji_count(conversation['value']) > 0:
ss = True
if ss:
sc.extend(cc)
with open(r'D:\datasets\b-corpus\emoji\kajiwoto.txt', 'w', encoding='utf-8') as f:
f.write('\n'.join(sc))