def parse_str(names): names = names.lower() for target, to_replace in aliases.items(): for rp in to_replace: names = names.replace(rp,target) ascii_str = remover_acentos(names) return ascii_str
def query(text): if not text: return None obj = TextProcessing("PUBqD=D4=4KKr4WvOfxh#VMkayw$W-iO", "PRI-@KOUBovv#gV-cPGC3wd$%P2fYU3k") try: return obj.sentiment(util.remover_acentos(text)) except Exception: return {'label' : 'erro'}
def analise(tweets_list, query, my_queue, d1, d2, d3): for tweet in tweets_list: text_without_accents = util.remover_acentos(tweet['text']) if text_without_accents: analise1 = alchemy.classifyAlchemyAPI(text_without_accents) if d1 else {'label' : 'off'} analise2 = analyse_textprocessing(text_without_accents) if d2 else {'label' : 'off'} analise3 = analyse_affin(text_without_accents) if d3 else {'label' : 'off'} my_queue.put((tweet, analise1, analise2, analise3)) else: my_queue.put((tweet, {'label' : 'error'}, {'label' : 'error'}, {'label' : 'error'}))