Query editor
withmemecoins_social as (withcleaning as (SELECTCOALESCE(c.root_parent_url,c.parent_url) as parent_url, c.hash, c.fid, c.created_at, split(regexp_replace(regexp_replace(regexp_replace(regexp_replace(text, 'https://\S*',''),'[[:punct:]]', ''),'0x[a-fA-F0-9]{40}',''),'<[^>]+>',''),' ') as text_cleanedFROM dune.neynar.dataset_farcaster_casts cWHERE c.deleted_at is nulland c.created_at >= now() - interval '14' day --ticker has to have been cast at least once in the last two weeks), distinct_words as (SELECTupper(replace(regexp_extract(c.word, '\$[a-zA-Z0-9._-]+'),'$','')) as word, approx_distinct(c.fid) as ticker_castersFROM cleaning cLEFT JOIN unnest(text_cleaned) as c(word) on trueWHERE 1=1and trim(c.word) like '$%' --word has tickerand try(cast(replace(regexp_extract(c.word, '\$[a-zA-Z0-9._-]+'),'$','') as uint256)) is null --not a numberand replace(regexp_extract(c.word, '\$[a-zA-Z0-9._-]+'),'$','') != '' --not empty after extractGROUP BY 1-- HAVING approx_distinct(c.fid) >= 100 --must have at least 100 people casting about them), related_mappings as (SELECT*FROM (VALUES('DEGEN', '🎩'),('TN100X', '🍖'),('HIGHER', '↑'),('NOGS', '⌐◨-◨'),('SENDIT','↗'),('GLOOM','👽'),('PILL','💊'),('BORED','🥱')) AS t (word_raw, related_symbol))SELECTdw.word, dw.ticker_casters, rm.related_symbol, token.*FROM distinct_words dwLEFT JOIN dune.dune.result_erc_20_token_summary token --https://dune.com/queries/3592111/6052159ON token.symbol = dw.wordAND token.most_popular = 1 --get most relevant token symbol. Ideally we can use recipient_casters as part of the row_number() but that's too expensive compute wise right now.AND token.median_price <= 1 --less than a dollarAND token.rolling_one_months_trades > 0 --at least 1 trades in 30 daysAND token.total_supply > 0LEFT JOIN related_mappings rm ON rm.word_raw = dw.wordWHERE (token.symbol is not nullAND dw.word IN ('DEGEN','DOGINME','TYBG','HIGHER','LOWER','DOG','CRASH','FRAME','TN100X','ENJOY','IMAGINE','TICKER','SENDIT','YUP','MEMBER'