qgyd2021
commited on
Commit
·
0be65ae
0
Parent(s):
first commit
Browse files- .gitattributes +56 -0
- .gitignore +14 -0
- README.md +67 -0
- examples/preprocess/preprocess_tweets_with_emoji.py +84 -0
- examples/preprocess/temp.txt +1 -0
- main.py +18 -0
- project_settings.py +12 -0
- requirements.txt +5 -0
- tweets.py +82 -0
.gitattributes
ADDED
@@ -0,0 +1,56 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
*.7z filter=lfs diff=lfs merge=lfs -text
|
2 |
+
*.arrow filter=lfs diff=lfs merge=lfs -text
|
3 |
+
*.bin filter=lfs diff=lfs merge=lfs -text
|
4 |
+
*.bz2 filter=lfs diff=lfs merge=lfs -text
|
5 |
+
*.ckpt filter=lfs diff=lfs merge=lfs -text
|
6 |
+
*.ftz filter=lfs diff=lfs merge=lfs -text
|
7 |
+
*.gz filter=lfs diff=lfs merge=lfs -text
|
8 |
+
*.h5 filter=lfs diff=lfs merge=lfs -text
|
9 |
+
*.joblib filter=lfs diff=lfs merge=lfs -text
|
10 |
+
*.lfs.* filter=lfs diff=lfs merge=lfs -text
|
11 |
+
*.lz4 filter=lfs diff=lfs merge=lfs -text
|
12 |
+
*.mlmodel filter=lfs diff=lfs merge=lfs -text
|
13 |
+
*.model filter=lfs diff=lfs merge=lfs -text
|
14 |
+
*.msgpack filter=lfs diff=lfs merge=lfs -text
|
15 |
+
*.npy filter=lfs diff=lfs merge=lfs -text
|
16 |
+
*.npz filter=lfs diff=lfs merge=lfs -text
|
17 |
+
*.onnx filter=lfs diff=lfs merge=lfs -text
|
18 |
+
*.ot filter=lfs diff=lfs merge=lfs -text
|
19 |
+
*.parquet filter=lfs diff=lfs merge=lfs -text
|
20 |
+
*.pb filter=lfs diff=lfs merge=lfs -text
|
21 |
+
*.pickle filter=lfs diff=lfs merge=lfs -text
|
22 |
+
*.pkl filter=lfs diff=lfs merge=lfs -text
|
23 |
+
*.pt filter=lfs diff=lfs merge=lfs -text
|
24 |
+
*.pth filter=lfs diff=lfs merge=lfs -text
|
25 |
+
*.rar filter=lfs diff=lfs merge=lfs -text
|
26 |
+
*.safetensors filter=lfs diff=lfs merge=lfs -text
|
27 |
+
saved_model/**/* filter=lfs diff=lfs merge=lfs -text
|
28 |
+
*.tar.* filter=lfs diff=lfs merge=lfs -text
|
29 |
+
*.tar filter=lfs diff=lfs merge=lfs -text
|
30 |
+
*.tflite filter=lfs diff=lfs merge=lfs -text
|
31 |
+
*.tgz filter=lfs diff=lfs merge=lfs -text
|
32 |
+
*.wasm filter=lfs diff=lfs merge=lfs -text
|
33 |
+
*.xz filter=lfs diff=lfs merge=lfs -text
|
34 |
+
*.zip filter=lfs diff=lfs merge=lfs -text
|
35 |
+
*.zst filter=lfs diff=lfs merge=lfs -text
|
36 |
+
*tfevents* filter=lfs diff=lfs merge=lfs -text
|
37 |
+
# Audio files - uncompressed
|
38 |
+
*.pcm filter=lfs diff=lfs merge=lfs -text
|
39 |
+
*.sam filter=lfs diff=lfs merge=lfs -text
|
40 |
+
*.raw filter=lfs diff=lfs merge=lfs -text
|
41 |
+
# Audio files - compressed
|
42 |
+
*.aac filter=lfs diff=lfs merge=lfs -text
|
43 |
+
*.flac filter=lfs diff=lfs merge=lfs -text
|
44 |
+
*.mp3 filter=lfs diff=lfs merge=lfs -text
|
45 |
+
*.ogg filter=lfs diff=lfs merge=lfs -text
|
46 |
+
*.wav filter=lfs diff=lfs merge=lfs -text
|
47 |
+
# Image files - uncompressed
|
48 |
+
*.bmp filter=lfs diff=lfs merge=lfs -text
|
49 |
+
*.gif filter=lfs diff=lfs merge=lfs -text
|
50 |
+
*.png filter=lfs diff=lfs merge=lfs -text
|
51 |
+
*.tiff filter=lfs diff=lfs merge=lfs -text
|
52 |
+
# Image files - compressed
|
53 |
+
*.jpg filter=lfs diff=lfs merge=lfs -text
|
54 |
+
*.jpeg filter=lfs diff=lfs merge=lfs -text
|
55 |
+
*.webp filter=lfs diff=lfs merge=lfs -text
|
56 |
+
*.jsonl filter=lfs diff=lfs merge=lfs -text
|
.gitignore
ADDED
@@ -0,0 +1,14 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
|
2 |
+
.git/
|
3 |
+
.idea/
|
4 |
+
|
5 |
+
**/flagged/
|
6 |
+
**/log/
|
7 |
+
**/logs/
|
8 |
+
**/__pycache__/
|
9 |
+
|
10 |
+
data/
|
11 |
+
docs/
|
12 |
+
dotenv/
|
13 |
+
examples/preprocess/data
|
14 |
+
trained_models/
|
README.md
ADDED
@@ -0,0 +1,67 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
---
|
2 |
+
license: apache-2.0
|
3 |
+
---
|
4 |
+
## Tweets
|
5 |
+
|
6 |
+
|
7 |
+
Archive Team: The Twitter Stream Grab
|
8 |
+
https://archive.org/details/twitterstream
|
9 |
+
|
10 |
+
|
11 |
+
### Tweets With Emoji 数据集
|
12 |
+
|
13 |
+
数据来源:
|
14 |
+
```text
|
15 |
+
https://www.kaggle.com/datasets/ericwang1011/tweets-with-emoji
|
16 |
+
```
|
17 |
+
|
18 |
+
包含 emoji 表情的 tweets 推文。
|
19 |
+
|
20 |
+
用途:自动向文本中添加 emoji 表情。
|
21 |
+
|
22 |
+
示例:
|
23 |
+
| 样本数量 | 类别 | 例句1 | 例句2 |
|
24 |
+
| --- | --- | --- | --- |
|
25 |
+
| 20025 | backhand_index_pointing_right | 🧡@KeplerHomes AirdropBox event for #Arbitrum ecological users is here. A total of 550,000 addresses are eligible for #airdrop, and 5 types of AirDropbox with different scarcity can be issued. <br> <br> <br> <br> 💙Invitation code: 52DC39 <br> <br> 🏆Airdrop Portal:👉 https://t.co/fudohu97uV | Remember, success in online business is a marathon, not a sprint. Keep at it, stay focused, and success will come." #patience #onlinebusiness #success <br> <br> For more tips and Strategies, follow me 👉 @coach_lawrence1 https://t.co/IvtL9Om86J |
|
26 |
+
| 20000 | check_mark | Winner 🏆: @chinzhillaTG <br> <br> Verify your win on @YOSHIYOCHIYUH, read his pinned tweet and send the needed details to his DM. <br> <br> ✔️ https://t.co/2Rugq2zCrg | @Rwpcity Double road. ✔️ Daily at 2:00am. |
|
27 |
+
| 20000 | check_mark_button | 💰 Denet Giveaway !💰 BIG Chalage <br> <br> 🏆 Reward:$8239.25 worth of $FB Tokens <br> <br> ✅ Follow <br> ✅ Like & RT <br> ✅ Complete DeNet tasks ⤵️ <br> https://t.co/hHTFz4UKtO <br> <br> 🔔Tip: the more invites, the more you earn ! <br> <br> #Play2Earn #DOGE #Cryptos $ARB $USDT #eth #Giveaway #Airdrop #DeNet https://t.co/37jdSrXuyo | Countertop Ice Maker 🧊🧊 <br> <br> ✅$82.99 <br> <br> ❤️Clip $50Coupon <br> <br> ❤️5% off CODE: 1JTFQO0F <br> <br> 🔗https://t.co/HoI8cw9YgJ |
|
28 |
+
| 20000 | clown_face | Didn't that #CovidUK killer🤡 #Johnson do enough damage? Will folks be so gullible as to elect another devious establishment chancer @Keir_Starmer. if so #Nothing_will_Change | He is right.. there was/is no chaos 🤡 |
|
29 |
+
| 20000 | cooking | When you don’t like the person, it’s always like “what’s doing this one?”🫠🫠🫠🫠 | Still cooking 👨🍳 #uidesign #figma #UIUX https://t.co/ZvDpSO3LV1 |
|
30 |
+
| 20001 | egg | Happy Easter😀🐇🥚 | @elonmusk @teslaownersSV #eggs Easter eggs today will surely be delicious. #Eggs #Eggs #Eggs.🥚🥚🥚🍳🍳🍳 |
|
31 |
+
| 20000 | enraged_face | @Sandhillsrider @LoveAmerica615 @nygrlahart @Chriscarroll50 @1angryhillbilly @ZacharyIvanPor1 @PubliusNV @MaryfromMarin @GoldBaron08 @HPolisports @34FryingpanA22 @AugustusMcRae1 I would have gone after them fu*kers.😡😡😡 | @ChudsOfTikTok Award wages: DEFINITION 1. the smallest amount of money that an employer is legally allowed to pay for a particular type of work. <br> <br> Of course. 🙄😡 |
|
32 |
+
| 20000 | eyes | @big_emtee Pshhh. There's no differences between races <br> 👀 https://t.co/oDryND12Ar | For my TL <br> 👀 |
|
33 |
+
| 20000 | face_holding_back_tears | @Fairy_Trades This mentality though 😂😤 But can you borrow me $1k😩🥹 | @crisgrdi i'll be looking forward to more of your tweets for this promo! it's really so soft 🥹 |
|
34 |
+
| 20000 | face_savoring_food | @PastorAlexLove Thank you, pastor. My mouth should get more.... <br> Lol <br> I mean more cake... <br> Or do I? 🤤🤭😋🤣 | So horny right now, sending pics of my thick hard cock to every girl that dms 😋 <br> #horny #hard #cum #dick #cock #bwc #dmme #cocktribute #cumtribute #wankchat #wanktribute #nsfw #nsfwtwt #dickrate #tributeyou #sub #gavat #pasif |
|
35 |
+
| 20000 | face_with_steam_from_nose | @TheCaseySmith @DerrickEvans_WV Haha yep, get Trump😤 <br> All of the problems in this country will be gone. Right? Poof! | So all the “ I’m from Cleveland “ baseball jackets sold out 😤 |
|
36 |
+
| 20000 | face_with_tears_of_joy | @mattyV_BOSS Something we can finally agree on 😂 | @namasoprop TBF, he was tryna calm him down before the yellow too😂 |
|
37 |
+
| 20000 | fearful_face | @sunnyhoney_kay bruh i’m from california and I didn’t know that 😨😨 | @spideramys i think this might’ve been a harry potter fanfiction following lily 💀 <br> <br> also how does hermione have such a smart meaning, then the other two protagonists are “harry” “ronald” <br> <br> and of course “cho chang” exists 😨 |
|
38 |
+
| 20000 | fire | One of the things I hate most is the lie the fact of being deceived 😔 https://t.co/P9EHHwqO61 | I’ve been able to put my daughters hair in 2 full pig tails since she was 3 months old 😭 that’s insane |
|
39 |
+
| 20000 | folded_hands | If you know me you'll know I have wobbles, I hide, I don't speak and I fear the moment. I act odd but I bounce back . Sometimes I need to write it down to remind myself this is a blip not the final chapter there's more to this book of life for me. 🙏❤️ | @RepMattGaetz I personally don’t like you at all. Honestly. But if your a real Christian (even though I have my doubts considering who you like ). I will as a Christian wish you also a blessed and Happy Easter to you and your family. I’m not spreading hate on Easter Sunday. God Bless🙏 |
|
40 |
+
| 20000 | ghost | @DakotaLaden @ChelseaLaden @Tanner_Wiseman @Alex_Schroeder4 @ConnorStallings The support for the #ProjectFear kickstarter was so amazing and inspiring!! Thanks for reminding the #FearFam to never give up and good things happen to good people!! 👻😈 https://t.co/3bWpwsDY3C | @chillpillFTM @8play_games So SIK! This is the perfect way to $CHILL 💊🕹️🔥 <br> $FTM #FTM https://t.co/SJcG4DRGCP |
|
41 |
+
| 20000 | grinning_face_with_sweat | @mikegapinski @TeslaAndroid Yeah, maybe that’s it. 😅 | Dj, but sidenote how's ty williams made the shortlist 😅 few excellent games but surely nowhere near our pots |
|
42 |
+
| 20000 | hatching_chick | Happy Easter 🐣 🐰 Everyone <br> Bath & Body Works 💙 Sales <br> 40% OFF EVERYTHING <br> ALL MISTS & BODY CREAM $5.50 <br> Not included in 40% off promotion. <br> JUST ADDED! ENDS AT 6PM ONLINE! <br> FREE SHIPPING ON $50 <br> USED CODE - EASTERGIFT https://t.co/G2AyrbcGmV | Happy Easter friends! 🐣🐰💛 |
|
43 |
+
| 20000 | hot_face | @rambojr90 Then what’s this you posted? 🍯 😂 | That jawline can cut through anything….he’s so hot 🥵 ❤️🔥 |
|
44 |
+
| 20000 | loudly_crying_face | i thought i was gonna write notes this holy week tas i’m js watching true beauty 😭😭😭 | BUT WHAT ABOUT I HOPE I NEVER LOSE YOU HOPE THIS NEVER ENDSSSSSSS 😭😭😭😭😭 |
|
45 |
+
| 20000 | melting_face | This Han Jinsung with this Seo Changbin ‼️ <br> 😳🥴😵💫😵🫠 <br> <br> credit to @/cheesechoux_cb for Changbins vid and to whomever took CB's pic https://t.co/AjyfpZ8ZQ0 | @anyatrades i dont like it when life brings me lemons, But @anyatrades can bring me lemons any day of the week 🫠 |
|
46 |
+
| 20000 | middle_finger | When He is busy at work I like to send him pics and videos to brighten up his day 😏😈 | @ryuuly 🖕 |
|
47 |
+
| 20001 | partying_face | The mafia boss Jimin agenda is thriving and I am here for it 😌https://t.co/RUDXh2u4WZ | We're still over the moon about our Leander office ribbon cutting! 🥳😍 A huge thanks to everyone who came out to support and celebrate our new office opening. We're proud to now offer GI care to the Leander community! 💙 @LeanderChamber @Christine_LTX 💙 https://t.co/emylqhQXBK https://t.co/wdHWJdQZe5 |
|
48 |
+
| 20000 | party_popper | @RedRosesForAme1 Thank you so much! 🎉💙 | 🎉Web3 Protocol X MetaStudio Giveaway <br> <br> 🏆Prize Pool:- 5,000,000 $METAS + 200 USDT <br> <br> To Enter:- <br> ✔️Follow @Web3_Protocol & @MetaStudioLand <br> ✔️Like and RT 3 friends <br> ✔️ Fill form :- https://t.co/HHNA1MGw66 <br> <br> #daoforcreators #metaverseforcreators $metas |
|
49 |
+
| 20000 | pile_of_poo | y'all love saying this "y'AlL dOn'T kNoW hOw tHe GuBmEnT wOrKs" nonsensical 🐂💩 as if i can't call EVERYONE that's involved out. that man knew exactly what he did. | 👁💩👁 <br> Sewage spills in your area mapped as Tories accused of ‘throwing in towel’ on leaks https://t.co/nqU7i6tcfg |
|
50 |
+
| 20000 | rabbit | @TaylorNasse Happy Easter, Ashleigh. ☕️🐇🥚💐❤️ | 😍🥰Wishing you the happiest of Easter🐇🫶🏾🐣🥳 https://t.co/bHeeH28lK6 |
|
51 |
+
| 20000 | rabbit_face | Check this out @Malissa_Longo When this young man Play's Michael Jackson Smooth Criminal on Broken piano Happy Easter 🐰 enjoy https://t.co/9hXWIRQYsV | @spicylife24 😂😂🤣子供の説明〜💦だいたいやもん🤣🤣🤣 |
|
52 |
+
| 20001 | red_heart | @chojiVAL true, some human interaction will truly do so many ppl good man. it’s honestly easier for me to connect w ppl thru talking then texting anymore 😭 | Liverpool 2-2 A.Ramsdale 🔥 <br> <br> #LIVARS |
|
53 |
+
| 20000 | rolling_on_the_floor_laughing | @itsvoltic1 NONE OF THESE MFS KNOW IM TOP 50 ALL STATS NA REALM🤣🤣🤣🤣 | @jsamchill 🤣 that’s exactly what I want!! It’s too many girls |
|
54 |
+
| 20000 | saluting_face | @HypeEth_ Gm legend 🤘❤️ <br> Of course we are 🫡 | Have a Great Easter wkd @ripcache squad 🍳🫡 https://t.co/sKJFMKBdkv |
|
55 |
+
| 20000 | skull | Y’all gotta not put so much thought in the Super Mario Bros Movie 💀 | I ordered Coke Zero and they gave it to me in what looks like a plastic lassi da glass from the pind 💀 |
|
56 |
+
| 20000 | smiling_face | @eltoro_bro Im so mad i misssed it but it was so good to just see your name on my screen! ☺️ i cant wait to drive you crazy( i have a lot to make up for lol) | @drg357 Well you just continue getting better and get plenty of rest. I'm right here(on the other side of the universe ☺️) if you need a chat💞 https://t.co/AihkF5mJ9d |
|
57 |
+
| 20000 | smiling_face_with_halo | Goodnight everyone <3 remember to continue to stream 😇💜 https://t.co/nYJRkutITD | @KariLakeWarRoom @JenAFifield Congratulations mame Kari Lake you are also the beautiful face of all Americans. <br> 💐💐💐 <br> 😇♥️🕊️🤗😘🌙🥰👌👍🙏🙏🙏 |
|
58 |
+
| 20000 | smiling_face_with_heart-eyes | The Daughter & Son 👫🐇😍 https://t.co/X6rnSP5zyD | @GoodPieceOfSass That's so cool!! 😍 If you ever track it down, please share. I'd get a kick out of that forsure. |
|
59 |
+
| 20000 | smiling_face_with_hearts | @BossfanAndrew 😂 oooo the year I intend to send only the one song due to my level of adoration for it 🥰 #forgotten80s | @honeyluved Stooop!! You're making me cry even more! 😭😭 And I kinda miss your voice now btw! 🥹🫰🫶 |
|
60 |
+
| 20000 | smiling_face_with_sunglasses | I love when that ass be so soft like Charmin boy 😎🤗🤯 | Rather be surrounded by dat water than some fuck niggas that's why I love dat beach 🏖️😎 |
|
61 |
+
| 20000 | smiling_face_with_tear | i was wondering why i hadnt seen any dunes vids yet then i remembered it's 3h behind 🥲 | @alive_without_u 🥲👍 |
|
62 |
+
| 20000 | sparkles | @CreoleBbyBritt This is why you’re my favorite! ✨ | Added this little one to my throne 🥺✨ |
|
63 |
+
| 20000 | sun | @Erdayastronaut I hope that in reality they will do the boostback burn the other way round! 😳 | Exotic smoke 🌿with the sun roof down type of day ☀️ |
|
64 |
+
| 20000 | thinking_face | @Ko_Sa_Ra_Chi_ Then it's a whale or porpoises and sharks CAN be lovely too 🤔 | @fkeyamo So your job is to sort 🤔 unemployment, but somewhat bothered more about Obi. <br> 🤮 |
|
65 |
+
| 20000 | thumbs_up | @owenclark3 Fluffing hell, how peculiar 👍🙀 | @theSuiPunks @tocen__ 👍👍👍 |
|
66 |
+
| 20000 | white_heart | @aespa_official HAPPY B'DAY PRETTYYYYY 🤍 <br> <br> BLOOMING KARINA DAY <br> #지민아_마이의_푸른봄은_너야 <br> #Welcome_to_MyKarina | Finally. It's wrap. Well done Enigma babies @primiilly1 @winmetawin and the whole team. Becareful on the way back home. Have a rest naa 🤍 |
|
67 |
+
| 20000 | winking_face | @Holy_Trinity_AV The Prince and Wales and Prince George weren't the only Villa royalty at the game I see Pete 😉Glad you finally got over. Don't leave it so long next time. Don Unai is creating something special here | @Answer4today @BeutelDory @krassenstein I’m middle class and my taxes went down, but thank you trailer trash who wants to voice an opinion for me. 😉 |
|
examples/preprocess/preprocess_tweets_with_emoji.py
ADDED
@@ -0,0 +1,84 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
#!/usr/bin/python3
|
2 |
+
# -*- coding: utf-8 -*-
|
3 |
+
import argparse
|
4 |
+
import json
|
5 |
+
from pathlib import Path
|
6 |
+
|
7 |
+
import pandas as pd
|
8 |
+
|
9 |
+
from project_settings import project_path
|
10 |
+
|
11 |
+
|
12 |
+
def get_args():
|
13 |
+
parser = argparse.ArgumentParser()
|
14 |
+
parser.add_argument(
|
15 |
+
"--data_dir",
|
16 |
+
default="examples/preprocess/data/tweets_with_emoji",
|
17 |
+
type=str,
|
18 |
+
)
|
19 |
+
parser.add_argument(
|
20 |
+
"--output_file",
|
21 |
+
default="data/tweets_with_emoji.jsonl",
|
22 |
+
type=str,
|
23 |
+
)
|
24 |
+
args = parser.parse_args()
|
25 |
+
return args
|
26 |
+
|
27 |
+
|
28 |
+
def print_examples():
|
29 |
+
args = get_args()
|
30 |
+
|
31 |
+
data_dir = project_path / args.data_dir
|
32 |
+
|
33 |
+
print("| 样本数量 | 类别 | 例句1 | 例句2 |")
|
34 |
+
print("| --- | --- | --- | --- |")
|
35 |
+
for filename in data_dir.glob("*.csv"):
|
36 |
+
df = pd.read_csv(filename)
|
37 |
+
length = len(df)
|
38 |
+
category = filename.stem
|
39 |
+
text_list = list()
|
40 |
+
for i, row in df.iterrows():
|
41 |
+
row = dict(row)
|
42 |
+
text = row["Text"]
|
43 |
+
text = str(text).strip()
|
44 |
+
|
45 |
+
text = text.replace("\n", " <br> ")
|
46 |
+
text = text.replace("\r", " <br> ")
|
47 |
+
text_list.append(text)
|
48 |
+
|
49 |
+
if i >= 2:
|
50 |
+
break
|
51 |
+
|
52 |
+
row = "| {} | {} | {} | {} |".format(length, category, text_list[0], text_list[1])
|
53 |
+
print(row)
|
54 |
+
|
55 |
+
return
|
56 |
+
|
57 |
+
|
58 |
+
def main():
|
59 |
+
args = get_args()
|
60 |
+
|
61 |
+
data_dir = project_path / args.data_dir
|
62 |
+
output_file = project_path / args.output_file
|
63 |
+
|
64 |
+
with open(output_file, "w", encoding="utf-8") as fout:
|
65 |
+
for filename in data_dir.glob("*.csv"):
|
66 |
+
df = pd.read_csv(filename)
|
67 |
+
|
68 |
+
for i, row in df.iterrows():
|
69 |
+
row = dict(row)
|
70 |
+
text = row["Text"]
|
71 |
+
|
72 |
+
row_ = {
|
73 |
+
"text": text,
|
74 |
+
"category": filename.stem
|
75 |
+
}
|
76 |
+
row_ = json.dumps(row_, ensure_ascii=False)
|
77 |
+
row_ = "{}\n".format(row_)
|
78 |
+
fout.write(row_)
|
79 |
+
|
80 |
+
return
|
81 |
+
|
82 |
+
|
83 |
+
if __name__ == '__main__':
|
84 |
+
print_examples()
|
examples/preprocess/temp.txt
ADDED
@@ -0,0 +1 @@
|
|
|
|
|
1 |
+
| 20025 | backhand_index_pointing_right | 🧡@KeplerHomes AirdropBox event for #Arbitrum ecological users is here. A total of 550,000 addresses are eligible for #airdrop, and 5 types of AirDropbox with different scarcity can be issued. <br> <br> <br> <br> 💙Invitation code: 52DC39 <br> <br> 🏆Airdrop Portal:👉 https://t.co/fudohu97uV | Remember, success in online business is a marathon, not a sprint. Keep at it, stay focused, and success will come." #patience #onlinebusiness #success <br> <br> For more tips and Strategies, follow me 👉 @coach_lawrence1 https://t.co/IvtL9Om86J |
|
main.py
ADDED
@@ -0,0 +1,18 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
#!/usr/bin/python3
|
2 |
+
# -*- coding: utf-8 -*-
|
3 |
+
from datasets import load_dataset
|
4 |
+
|
5 |
+
dataset = load_dataset(
|
6 |
+
"tweets.py",
|
7 |
+
name="tweets_with_emoji",
|
8 |
+
split="train",
|
9 |
+
trust_remote_code=True,
|
10 |
+
streaming=True,
|
11 |
+
)
|
12 |
+
|
13 |
+
for sample in dataset:
|
14 |
+
print(sample)
|
15 |
+
|
16 |
+
|
17 |
+
if __name__ == '__main__':
|
18 |
+
pass
|
project_settings.py
ADDED
@@ -0,0 +1,12 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
#!/usr/bin/python3
|
2 |
+
# -*- coding: utf-8 -*-
|
3 |
+
import os
|
4 |
+
from pathlib import Path
|
5 |
+
|
6 |
+
|
7 |
+
project_path = os.path.abspath(os.path.dirname(__file__))
|
8 |
+
project_path = Path(project_path)
|
9 |
+
|
10 |
+
|
11 |
+
if __name__ == '__main__':
|
12 |
+
pass
|
requirements.txt
ADDED
@@ -0,0 +1,5 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
datasets==2.18.0
|
2 |
+
tqdm==4.66.2
|
3 |
+
pandas==1.1.5
|
4 |
+
xlrd==1.2.0
|
5 |
+
openpyxl==3.0.9
|
tweets.py
ADDED
@@ -0,0 +1,82 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
#!/usr/bin/python3
|
2 |
+
# -*- coding: utf-8 -*-
|
3 |
+
from glob import glob
|
4 |
+
import json
|
5 |
+
import os
|
6 |
+
from pathlib import Path
|
7 |
+
|
8 |
+
import datasets
|
9 |
+
|
10 |
+
|
11 |
+
_URLS = {
|
12 |
+
"tweets_with_emoji": "data/tweets_with_emoji.jsonl",
|
13 |
+
}
|
14 |
+
|
15 |
+
|
16 |
+
_CITATION = """\
|
17 |
+
@dataset{tweets,
|
18 |
+
author = {Xing Tian},
|
19 |
+
title = {tweets},
|
20 |
+
month = aug,
|
21 |
+
year = 2024,
|
22 |
+
publisher = {Xing Tian},
|
23 |
+
version = {1.0},
|
24 |
+
}
|
25 |
+
"""
|
26 |
+
|
27 |
+
|
28 |
+
class Tweets(datasets.GeneratorBasedBuilder):
|
29 |
+
VERSION = datasets.Version("1.0.0")
|
30 |
+
|
31 |
+
BUILDER_CONFIGS = [
|
32 |
+
datasets.BuilderConfig(name="tweets_with_emoji", version=VERSION, description="tweets_with_emoji"),
|
33 |
+
]
|
34 |
+
|
35 |
+
def _info(self):
|
36 |
+
features = datasets.Features(
|
37 |
+
{
|
38 |
+
"text": datasets.Value("string"),
|
39 |
+
"category": datasets.Value("string"),
|
40 |
+
}
|
41 |
+
)
|
42 |
+
|
43 |
+
return datasets.DatasetInfo(
|
44 |
+
features=features,
|
45 |
+
supervised_keys=None,
|
46 |
+
homepage="",
|
47 |
+
license="",
|
48 |
+
citation=_CITATION,
|
49 |
+
)
|
50 |
+
|
51 |
+
def _split_generators(self, dl_manager):
|
52 |
+
"""Returns SplitGenerators."""
|
53 |
+
url = _URLS[self.config.name]
|
54 |
+
dl_path = dl_manager.download(url)
|
55 |
+
archive_path = dl_path
|
56 |
+
|
57 |
+
return [
|
58 |
+
datasets.SplitGenerator(
|
59 |
+
name=datasets.Split.TRAIN,
|
60 |
+
gen_kwargs={"archive_path": archive_path, "split": "train"},
|
61 |
+
),
|
62 |
+
]
|
63 |
+
|
64 |
+
def _generate_examples(self, archive_path, split):
|
65 |
+
archive_path = Path(archive_path)
|
66 |
+
idx = 0
|
67 |
+
with open(archive_path, "r", encoding="utf-8") as f:
|
68 |
+
for row in f:
|
69 |
+
row = json.loads(row)
|
70 |
+
|
71 |
+
text = row["text"]
|
72 |
+
category = row["category"]
|
73 |
+
|
74 |
+
yield idx, {
|
75 |
+
"text": text,
|
76 |
+
"category": category,
|
77 |
+
}
|
78 |
+
idx += 1
|
79 |
+
|
80 |
+
|
81 |
+
if __name__ == '__main__':
|
82 |
+
pass
|