# Drop obvious non-calls before analyst review (promo/retrospective); rules fixed here. import re,pandas as pd,sys; sys.path.insert(0,'scripts'); from subs2txt import load PROMO=re.compile(r'Telegram|tlegram|टेलीग्राम|चैलेंज|अकाउंट|iPhone|फोन|गिव ?अवे|वीआईपी|VIP|पे ?आउट|फंड|डिपॉजिट|\$|BTC|बिटकॉइन|गोल्ड|क्रूड|प्लेटफ़ॉर्म|प्लेटफार्म|प्लेटफ़ार्म|ब्रोकर') d=pd.read_csv('data/candidates.csv'); keep=[] for v,g in d.groupby('vid'): L=load(f'data/subs/{v}.hi-orig.json3') for r in g.itertuples(): t=r.entry_off_s; w=' '.join(x for tt,x in L if t-25<=tt<=t+15) keep.append(dict(cid=r.cid,promo=bool(PROMO.search(w)),win=w[:260])) k=pd.DataFrame(keep); d=d.merge(k,on='cid'); d.to_csv('data/candidates_pf.csv',index=False) print(len(d),'promo',d.promo.sum(),'left',(~d.promo).sum())