def Principi(): entrada = True while (entrada): print(" MENU") print("===============") print("1--> Crear usuari") print("2--> Iniciar Sessio") print("3--> Ranking") print("4--> Eliminar Usuari") print("5--> Sortir") opcio = (input("OPCIO --> ")) if (opcio == "1"): os.system('cls') OpcionsUsuari.crearUsuari(mycursor) elif (opcio == "2"): os.system('cls') IniciSessio.iniciarsessio(mycursor) elif (opcio == "3"): os.system('cls') Ranking.Ranking(mycursor) elif (opcio == "4"): os.system('cls') OpcionsUsuari.eliminarusuari(mycursor) elif (opcio == "5"): print("Adeu!") entrada = False else: os.system('cls') print("valor incorrecte")
def main(self): while not self.done: self.events_input() self.display_frame() self.run_logic() if self.choice == "Play": GameLoop.Game(self.screen).main() elif self.choice == "Tutorial": pass #Instruction.Instruction(self.screen).main() elif self.choice == "Ranking": Ranking.Ranking(self.screen).main() elif self.choice == "Options": pass elif self.choice == "Quit": pygame.quit() sys.exit()
self.params = json.loads(f.read()) except ValueError as e: print(e) self.save() f.close() def save(self): f = codecs.open(CONFIG_FILE, 'w', 'utf-8') f.write(json.dumps(self.params)) f.close() ######################### PARTE CONVERSACIÓN ################################### HELLO, BIEN, NAME = range(3) d_users = {} ranking = rank.Ranking("Ranking") ranking.ReadTXT() print(ranking.printRanking()) to_type = [] ################################# DIÁLOGOS ##################################### import traceback try: def text(bot, update): text = update.message.text text_out = elimina_tildes(text) id = update.message.chat.id myuser = d_users[id] print(text)
for ageKeyword in keyword: print(ageKeyword) while True: # query variables query = [] query_tf = [] query_weight = [] query_text1 = f.readline().rstrip('\n') print(query_text1) if not query_text1: break query.append(PreprocessComment(query_text1)) query_tf = TF(indexing_list, query, 'query') query_weight = Weighting(query_tf, idf_list) query_weight = Normalize(query_weight) score = Scoring(weighting_list, query_weight) rank = Ranking(score) print(rank) print("") count += 1 for r in rank: if (str(list(r.keys())[0]) == '10대'): result += 1 print("전체 댓글 : %d " % count) print("결과 : %d " % result) print("정확도 : %f" % (result / count))
from datetime import timedelta, datetime from Reallocation import * from RewardMatrix import * from Training import * from Live import * from MTM import * from Ranking import * from QMatrix import * from PerformanceMeasures import * from Plots import * import calendar if __name__ == "__main__": dbObject = DBUtils() rankingObject = Ranking() mtmObject = MTM() rewardMatrixObject = RewardMatrix() qMatrixObject = QMatrix() trainingObject = Training() liveObject = Live() reallocationObject = Reallocation() plotObject = Plots() performanceObject = PerformanceMeasures() dbObject.dbConnect() ''' dbObject.dbQuery("DELETE FROM asset_allocation_table") dbObject.dbQuery("DELETE FROM asset_daily_allocation_table") dbObject.dbQuery("DELETE FROM mtm_table")
def ranking(self): pilas.cambiar_escena(Ranking.Ranking())
def _event_handler(event_type, slack_event): print(slack_event["event"]) msg = {} keywords ="" msg["color"] = "#3AA3E3" msg["text"] = "" msg["image_url"] = "None" if event_type == "app_mention": channel = slack_event["event"]["channel"] text = slack_event["event"]["text"] #text가 실제입력값 result = re.sub(r'<@\S+> ', '', text) # result = 받은 텍스트 title_list, title_url_list = crawl_movie_rank() # 영화 랭킹페이지 크롤링 호출 if "순위" in result: # 출력 선택 구문 msg["text"] = str(u'\n'.join(Ranking(title_list,title_url_list))) elif "ㅅㅇ" in result: # 출력 선택 구문 msg["text"] = str(u'\n'.join(Ranking(title_list, title_url_list))) elif "ㄹㅋ" in result: # 출력 선택 구문 msg["text"] = str(u'\n'.join(Ranking(title_list, title_url_list))) elif "ㅇㅈ" in result: msg["text"] = str(u'\n'.join(Release())) elif "개봉예정작" in result: msg["text"] = str(u'\n'.join(Release())) elif switching(result, title_list, title_url_list) == "정답": for i in range(10): # 타이틀 리스트 10개를 돌면서 텍스트와 비교해 주소를 url에 넘김, 영화제목이 없으면 url은 비어있음 if result == title_list[i]: title_URL = title_url_list[i] # 크롤링할 url 저장한 string break msg["image_url"] = img_link(title_URL) msg["text"] = str(u'\n'.join(info(title_URL))) # (영화제목과 주소4)개 elif "안녕" in result: msg["text"] = str(u"안녕하세요") # elif "출력실험" in result: # return elif "" in result: msg["text"] = str("실행 가능 명령어는 아래와 같습니다.\n순위\n개봉예정작\n영화제목(순위권 내)") # keywords = answer(text) sc.api_call( "chat.postMessage", channel=channel, text=keywords, attachments=json.dumps([msg]) ) msg["image_url"] = "None" return make_response("App mention message has been sent", 200, ) # ============= Event Type Not Found! ============= # # If the event_type does not have a handler message = "You have not added an event handler for the %s" % event_type # Return a helpful error message return make_response(message, 200, {"X-Slack-No-Retry": 1})