def __init__(self, collision_checker): self.collision_checker=collision_checker self.bmax=3 self.dmax=2 self.p=Information() self.q=Information() self.root=Node(self.q) self.Q= Queue.PriorityQueue() #velocity control parameters self.max_velocity_x=0.5 self.max_velocity_y=0.5 self.max_velocity_yaw= 0.5 self.step_velocity=0.01 self.max_accel=0.5 self.max_accel_yaw=1.0 self.time= get_time() self.current_x_velocity=0.0 self.current_y_velocity=0.0 self.current_yaw_velocity=0.0
def show(): global Background, Player, Affichage, e, interactEnigmes, Information, timerEG, lagrossedefaite sys.stdout.write("\033[2J") if Affichage == "back": Background.show(myBackground) Player.show(MyPlayer) elif Affichage == "hlp": Help.show(MyHelp) elif Affichage == "intro": Introduction.show(MyIntro) elif Affichage == "grd": grille.show(MyGrid) elif Affichage == "info": Information.show(MyInfo) print "Il te reste: ", timerEG.showMinuteur(getTime(monMinuteur)) elif Affichage == "lose": lagrossedefaite.show(MyDefaite) sys.stdout.write("\033[37m") sys.stdout.write("\033[40m") sys.stdout.write("\033[0;0H\n") return
def show(): global Background, Player, Affichage, e, interactEnigmes, Information sys.stdout.write("\033[2J") if Affichage == "back": Background.show(myBackground) Player.show(MyPlayer) elif Affichage == "hlp": Help.show(MyHelp) elif Affichage == "intro": Introduction.show(MyIntro) elif Affichage == "grd": grille.show(MyGrid) elif Affichage == "info": Information.show(MyInfo) sys.stdout.write("\033[37m") sys.stdout.write("\033[40m") sys.stdout.write("\033[0;0H\n") return
def extract_information(folder, keyword, algorithm): files = get_file_name(folder) # menyimpan list of file texts = [] # menyimpan kalimat for file in files: texts.append(break_into_sentence(file)) found = -999 i = 0 infos = [] # menyimpan list of information # mencari kemunculan keyword dalam kalimat for text in texts: for sentence in text: if algorithm.lower() == "kmp": found = kmp_match(sentence, keyword) if found != -999: cases = find_cases(sentence, kmp_match(sentence, keyword)) date = find_tanggal(sentence, find_tanggal(texts[i][2], "")) file_name = files[i] info = Information(cases, date, sentence, file_name) infos.append(info) elif algorithm.lower() == "bm": found = bm_match(sentence, keyword) if found != -999: cases = find_cases(sentence, bm_match(sentence, keyword)) date = find_tanggal(sentence, find_tanggal(texts[i][2], "")) file_name = files[i] info = Information(cases, date, sentence, file_name) infos.append(info) elif algorithm.lower() == "regex": found = regex_match(sentence, keyword) if found != -999: cases = find_cases(sentence, regex_match(sentence, keyword)) date = find_tanggal(sentence, find_tanggal(texts[i][2], "")) file_name = files[i] info = Information(cases, date, sentence, file_name) infos.append(info) i += 1 return infos
def getQuery(self, folderpath): """Get query for svo of each cluster. Save the subject2queries.json for each cluster Returns ------- None """ queryGenerator = Information.QueryGenerator(self.rootpath) print("Getting query for {}".format(folderpath)) queryGenerator.generateQuery(folderpath)
def find_best_split(data, available_features): # iterate all feature # iterate all values # should_i_check_this_subtree() # find best by score functions # growing_or_stop() all_data_num = data.shape[0] all_positive_num = np.sum(data[:, -1]) pos_prob = all_positive_num / all_data_num score_init = Information.entropy((pos_prob, 1 - pos_prob)) best_gain = 0 best_feature = None best_value = None # iterate all feature for f_id in available_features: feature_of_data = data[:, f_id] arg_sorted_foa = np.argsort(feature_of_data) # iterate all values separate_value = None pos_count = 0 # positive sample with feature value 'less then' the separate value data_count = 0 # all data ...... for data_index in arg_sorted_foa: current_value = data[data_index, f_id] # print(data[data_index, f_id], data[data_index, -1]) if separate_value is None: # First separate_value = current_value elif current_value > separate_value: # New separate point separate_value = current_value # use this split value to check score score = get_score_by_count(all_data_num, all_positive_num, data_count, pos_count, Information.entropy) print(separate_value, pos_count, data_count, score) gain = score_init - score if gain > best_gain: best_gain = gain best_feature = f_id best_value = separate_value # counters if data[data_index, -1] == 1: pos_count += 1 data_count += 1 return best_feature, best_value
def getAvailableActions(self,node): q=node.robot dt= get_time() - self.time new_nodes=[] #instead of this based on current velocity figure out which is acceptable for v_x in np.arange(q.v_x-self.max_accel*dt,q.v_x+self.max_accel*dt,self.step_velocity): for v_y in np.arange(q.v_y-self.max_accel*dt,q.v_y+self.max_accel*dt,self.step_velocity): for v_theta in np.arange(q.w-self.max_accel_yaw*dt,q.w+self.max_accel_yaw*dt,self.step_velocity): x=q.x +v_x*dt+ math.cos(q.theta)*v_theta*dt y=q.y +v_y*dt+ math.sin(q.theta)*v_theta*dt theta=q.theta + v_theta*dt if not (self.collision_checker.collision_check(x,y,theta)): n=Node(Information(x,y,theta, v_x,v_y,v_theta)) node.addChild(n) new_nodes.append(n) #check for collision return new_nodes
def init(): global MyPlayer, myBackground, timeStep, MyHelp, MyIntro, MyGrid, MyInfo #initialisation de la partie timeStep=0.2 MyPlayer = Player.createPlayer(color=5, x=2, y=3, xMax=90, yMax=25, speed=4, direction = None) myBackground = Background.create("image.txt") MyHelp = Help.Create("Help.txt") MyIntro = Introduction.create("message_intro.txt") MyGrid = grille.create("grille_mots_croises_jeu.txt") MyInfo = Information.Create("information.txt") tty.setcbreak(fd) return
def getSnippets(self, folderpath): """Get the google search snippets. Parameters ---------- fullPath : str full path of folder Returns ------- None """ print("Getting snippets for {}".format(folderpath)) # s2q = self.helper.loadJson(os.path.join(folderpath, 'final', # 'subject2svoqueries.json')) queries = self.helper.loadCsv(folderpath + "/final", "candidate_queries.csv") fullPath = os.path.join(self.rootpath, folderpath) relevant = [] for idx, query in enumerate(queries): print("Crawling query {} ...".format(query[1])) googleSnippets = Information.GoogleSnippets( fullPath, query[0], idx, query[1]) res = googleSnippets.start_crawl() relevant.append(res) time.sleep(random.randint(1, 11)) # for topic in s2q: # relevant = [] # for idx, t in enumerate(s2q[topic]): # # print("Searching for topic {} with query {}".format(topic, # # query)) # googleSnippets = Information.GoogleSnippets(fullPath, topic, # idx, t['query']) # res = googleSnippets.start_crawl() # relevant.append(res) # time.sleep(random.randint(1, 11)) output_root = os.path.join(folderpath, 'final') self.helper.dumpJson(output_root, "snippets.json", relevant)
def init(): global MyPlayer, myBackground, timeStep, MyHelp, MyIntro, MyGrid, MyInfo, monMinuteur, MyDefaite #initialisation de la partie timeStep = 0.2 timeIni = time.time() MyPlayer = Player.createPlayer(color=5, x=2, y=3, xMax=90, yMax=25, speed=4, direction=None) myBackground = Background.create("image.txt") MyHelp = Help.Create("Help.txt") MyIntro = Introduction.create("message_intro.txt") MyGrid = grille.create("grille_mots_croises_jeu.txt") MyInfo = Information.Create("information.txt") monMinuteur = timerEG.create(2700, timeIni) MyDefaite = lagrossedefaite.create("lose.txt") tty.setcbreak(fd) return
def main(): #Retrieve Data from Files race_data = open(direct + "\DND Data\RaceInfo.txt", 'r') race_descriptions = open(direct + "\DND Data\RaceDescriptions.txt", 'r') class_data = open(direct + "\DND Data\ClassInfo.txt", 'r') class_descriptions = open(direct + "\DND Data\ClassDescriptions.txt", 'r') #Read Files into Lists race_data_list = [] for line in race_data: stripped_line = line.strip() entry_list = stripped_line.split(',') race_data_list.append(entry_list) class_data_list = [] for line in class_data: stripped_line = line.strip() entry_list = stripped_line.split(',') class_data_list.append(entry_list) race_list = [] for i in range(1, len(race_data_list)): if race_data_list[i][0] not in race_list: race_list.append(race_data_list[i][0]) class_list = [] for i in range(1, len(class_data_list)): class_list.append(class_data_list[i][0]) race_descriptions_list = [] for line in race_descriptions: stripped_line = line.strip() race_descriptions_list.append(stripped_line) class_descriptions_list = [] for line in class_descriptions: stripped_line = line.strip() class_descriptions_list.append(stripped_line) '''''' '''''' ''' Begin Program ''' '''''' '''''' #Restart Option restart = True while restart == True: add_info = Information() for i in range(10): print() print("Welcome to The D&D Character Creation Program!") print() #Opt-In for Tutorial if boolean("Would you like assistance using this program? ") == True: tutorial = True else: tutorial = False print() #Tutorial for More Information if tutorial == True: add_info.general() print() '''''' '''''' ''''' Automatic Generator ''' '''''' '''''' '' if boolean("Use automatic generator? ") == True: auto_stats = Stats() print() #Race & Subrace auto_race = race_list[random.randint(0, len(race_list) - 1)] subrace_list = [] for i in range(len(race_data_list)): if race_data_list[i][0] == auto_race: if race_data_list[i][1] != 'NA': subrace = True subrace_list.append(race_data_list[i][1]) auto_subrace = subrace_list[random.randint( 0, len(subrace_list) - 1)] else: auto_subrace = 'NA' #Auto Class auto_class = class_list[random.randint(0, len(class_list) - 1)] for i in range(len(class_list)): if auto_class == class_list[i]: class_index = i #Auto Roll Stats auto_stats.roll_stats() #Race Indices race_index = 0 for index in range(len(race_data_list)): if race_data_list[index][0] == auto_race and race_data_list[ index][1] == auto_subrace: race_index = index rec_age = int(race_data_list[race_index][10]) speed = race_data_list[race_index][8] #Race Bonuses (Half-Elves Special) if auto_race != 'Half-Elf': for i in range(6): boost = int(race_data_list[race_index][i + 2]) auto_stats.boost_list[i] = boost else: auto_stats.boost_list[5] = 2 #Assigning Class Data main_stat = class_data_list[class_index + 1][1] main_index = '' for i in range(6): if main_stat == auto_stats.ordered_list[i]: main_index = i armor = class_data_list[class_index + 1][5] shield = class_data_list[class_index + 1][6] weapons = class_data_list[class_index + 1][7] base_hp = int(class_data_list[class_index + 1][2]) #Hill Dwarf Extra Health if race_index == 1: base_hp += 1 #Auto Age & Name age = random.randint(18, round(.6 * rec_age)) name_list = ['Jane Doe', 'John Doe'] name = random.choice(name_list) #Auto Stats print("(Your primary stat is ", main_stat, " and your rolled stats are: ", auto_stats.my_stats, ")", sep='') auto_stats.assign_stats_auto(main_stat) print() #Race Bonuses for i in range(6): auto_stats.assigned_list[i] += auto_stats.boost_list[i] #Half-Elf Optimization if auto_race == "Half-Elf": auto_stats.half_elf_auto(main_index) #Print Automated Results auto_stats.results_data(name, auto_race, auto_subrace, speed, age, auto_class, base_hp, armor, shield, weapons) auto_stats.print_results() #Allow Name Change name_change = True while name_change == True: if boolean("Would you like to change your character name? " ) == True: print() name = input("What is the name of your character? ") print() auto_stats.results_data(name, auto_race, auto_subrace, speed, age, auto_class, base_hp, armor, shield, weapons) auto_stats.print_results() else: name_change = False print() final = auto_stats else: '''''' '''''' ''' Manual Builder ''' '''''' '''''' #Choose Your Race print() stat_values = Stats() repeat_race = True while repeat_race == True: print( "We are going to start by choosing a race from the D&D Player's Handbook." ) if tutorial == True: add_info.race() print() for entry in race_descriptions_list: print(entry) print() #Race Options race_chosen = False while race_chosen == False: print("Choose a race from the following list:") for i in range(len(race_list)): if i < len(race_list) - 1: print(race_list[i], ', ', sep='', end='') else: print(race_list[i]) print() my_race = input("My race: ") for race in race_list: if my_race.lower() == race.lower(): my_race = race race_chosen = True if race_chosen == False: print("Try again.") print() #Subrace Options subrace = False subrace_options = [] subrace_bonuses = [] for i in range(len(race_data_list)): if race_data_list[i][0] == my_race: if race_data_list[i][1] != 'NA': subrace = True subrace_options.append(race_data_list[i][1]) subrace_bonuses.append(race_data_list[i][11]) else: my_subrace = 'NA' #Choose Subrace if subrace == True: print() print("The race you chose has additional subrace options!") subrace_chosen = False while subrace_chosen == False: print("Please choose one of the following:") for i in range(len(subrace_options)): print(subrace_options[i], ": ", subrace_bonuses[i], sep='') print() my_subrace = input("My subrace: ") for subrace in subrace_options: if my_subrace[:4].lower() == subrace[:4].lower(): my_subrace = subrace subrace_chosen = True if subrace_chosen == False: print("Try again.") print() #Display Decision print("You have chosen to be a ", my_subrace, " ", my_race, "!", sep='') elif subrace == False: print("You have chosen to be a ", my_race, "!", sep='') print() if boolean("Would you like to choose a different race? " ) == False: repeat_race = False print() #Choose Your Class repeat_class = True while repeat_class == True: print("Next, you will choose a class for your character.") if tutorial == True: add_info.dnd_class() print() for entry in class_descriptions_list: print(entry) print() #Class Options class_chosen = False while class_chosen == False: print("Choose a class from the following list:") for i in range(1, len(class_data_list)): if i < len(class_data_list) - 1: print(class_data_list[i][0], ', ', sep='', end='') else: print(class_data_list[i][0]) print() my_class = input("My class: ") for entry in class_list: if my_class.lower() == entry.lower(): my_class = entry class_index = class_list.index(entry) class_chosen = True if class_chosen == False: print("Try again.") print() #Display Decision print("You have chosen to be a ", my_class, "!", sep='') print() if boolean("Would you like to choose a different class? " ) == False: repeat_class = False print() #Data From Race & Class race_index = 0 for index in range(len(race_data_list)): if race_data_list[index][0] == my_race and race_data_list[ index][1] == my_subrace: race_index = index rec_age = int(race_data_list[race_index][10]) speed = race_data_list[race_index][8] main_stat = class_data_list[class_index + 1][1] armor = class_data_list[class_index + 1][5] shield = class_data_list[class_index + 1][6] weapons = class_data_list[class_index + 1][7] base_hp = int(class_data_list[class_index + 1][2]) #Race Bonuses (Half-Elf Special) if my_race != 'Half-Elf': for i in range(6): boost = int(race_data_list[race_index][i + 2]) stat_values.boost_list[i] = boost else: stat_values.boost_list[5] = 2 #Hill Dwarf Extra Health if race_index == 1: base_hp += 1 #Setting Stats print( "Now we are going to determine your character stats for Strength (STR), Dexterity (DEX)," ) print( "Constitution (CON), Intelligence (INT), Wisdom (WIS), and Charisma (CHA)." ) print() if tutorial == True: add_info.stats() print() #Display Defaults print("The default stats are:") for i in stat_values.my_stats: print(i, '', end='') print() print() #Roll for Stats if boolean("Would you like to roll for your stats? ") == True: stat_values.roll_stats() else: print("You have chosen the default values.") print() #Assigning Stats print("Now, choose which value you want for each stat.") print("Each value can only be used once.") print() print("The most important stat for a ", my_class, " is ", main_stat, ".", sep='') print() stat_values.assign_stats() #Half-Elf Customization if my_race == 'Half-Elf': stat_values.half_elf_manual() #Choose Age print( "Looks good! Now all you need is to set your age and choose a name!" ) print("The average lifespan of a", my_race, "is", rec_age, "years.") print() age_chosen = False while age_chosen == False: try: age = int(input("Your age: ")) if age > rec_age: if boolean( "You have chosen an age past your average lifespan. Are you sure? " ) == True: age_chosen = True elif age > 0: age_chosen = True else: print("Please enter an age above 0.") except: print("Please enter a whole number.") print() #Choose Character Name name = input("What is the name of your character? ") print() #Print Results stat_values.results_data(name, my_race, my_subrace, speed, age, my_class, base_hp, armor, shield, weapons) stat_values.print_results() final = stat_values #Create New File for Bio if boolean("Would you like to write this bio into a file? ") != False: final.print_results_to_file(name, direct) #End of Program print() if boolean( "Thank you for using the Character Creation Program! Would you like to start over? " ) == False: restart = False print() print("Goodbye!") #Close Files race_data.close() race_descriptions.close() class_data.close() class_descriptions.close()
f"{day + 1} 05 {self.year}", '%d %m %Y').weekday() day_check = (calendar.day_name[set_day]) for j in course_detail[ 1]: # course_detail[1] store the week days as number, ex: 0 means monday # we check if the actual date is the week day we need for that course if day_check == week_day[ j]: # if true, then we add class at that time i = int(start) while i < int(end): if (self.may[day][i] == None): self.may[day][ i] = f"{quiz_name}" # come from get_course_code i += 1 # -------------------------------------------------------------------------------------------------------------------# Elie_Calendar = Calendar(2020, 'spring', 21, 13) course1 = Information.Course("Intro to Elec", "ECE110", "AL1") course1.add_quiz([0, 2], [0, 0, 50], "CBTF") course = course1.get_time_and_day() code = course1.get_course_code() Elie_Calendar.fill_calendar_quiz(course1.get_quiz_name(), course1.get_quiz_date(), course1.get_quiz_start_time_and_duration()) print(Elie_Calendar.view_month('january')[26]) print("-----------------------------------------------------------") print(Elie_Calendar.view_month('february')[17]) print('---------------------------------------------------------') print(Elie_Calendar.view_month('march')[22])
import random import Information x_line, y_line = Information.GetXYSize() blockType = list() for types in range(7) : blockType.append(list()) if types == 0 : for y_index in range(4) : blockType[types].append(list()) for x_index in range(1) : blockType[types][y_index].append(0) elif types == 6 : for y_index in range(2) : blockType[types].append(list()) for x_index in range(2) : blockType[types][y_index].append(0) else : for y_index in range(2) : blockType[types].append(list()) for x_index in range(3) : blockType[types][y_index].append(0) nT = 0 blockType[nT][0][0] = 1; blockType[nT][1][0] = 1; blockType[nT][2][0] = 1; blockType[nT][3][0] = 1; nT = nT+1; blockType[nT][1][0] = 1; blockType[nT][1][1] = 1; blockType[nT][1][2] = 1; blockType[nT][0][2] = 1; nT = nT+1; blockType[nT][0][1] = 1; blockType[nT][0][2] = 1; blockType[nT][1][0] = 1; blockType[nT][1][1] = 1; nT = nT+1; blockType[nT][0][0] = 1; blockType[nT][0][1] = 1; blockType[nT][1][1] = 1; blockType[nT][1][2] = 1; nT = nT+1; blockType[nT][0][1] = 1; blockType[nT][1][0] = 1; blockType[nT][1][1] = 1; blockType[nT][1][2] = 1; nT = nT+1; blockType[nT][0][0] = 1; blockType[nT][1][0] = 1; blockType[nT][1][1] = 1; blockType[nT][1][2] = 1; nT = nT+1;
def show_info(self): self.info = Information.Info() self.info.show()
# Save as server.py # Message Receiver import os import pickle import Message as msg import Player as pl import Information as info from socket import * info1 = info.Information() open = True while open: host = "192.168.0.177" port = 87 buf = 2048 addr = (host, port) UDPSock = socket(AF_INET,SOCK_STREAM) UDPSock.bind((host,port)) UDPSock.listen(1) conn, addr = UDPSock.accept() status = True print(f"Waiting to receive messages from {addr}...") while status: data = conn.recv(buf) data_var = pickle.loads(data)
import Information import _Calendar # Create a student Elie = Information.Student("Elie", "Masanka", "*****@*****.**", "23", "Statistics", "spring") # create course MATH347 = Information.Course("Fundamental of Mathematics", "MATH347", "B1") MATH415 = Information.Course("Applied Linear Algebra", "MATH415", "AL3") MATH415_d = Information.Course("Applied Linear Algebra", "MATH415", "AD4") ECE313 = Information.Course("Probability with Engineering Application", "ECE313", "D") CS125 = Information.Course("Intro to Computer Science", "CS125", "AL2") CS125_l = Information.Course("Intro to Computer Science", "CS125", "AYJ") FR156 = Information.Course("Exploring Paris", "FR156", "D") # add those course into the student list Elie.add_course(MATH347.get_course_code()) Elie.add_course(MATH415.get_course_code()) Elie.add_course(MATH415_d.get_course_code()) Elie.add_course(ECE313.get_course_code()) Elie.add_course(CS125.get_course_code()) Elie.add_course(CS125_l.get_course_code()) Elie.add_course(FR156.get_course_code()) # add event like homework, exams for each course MATH347.add_homework([4]) ECE313.add_homework([4]) CS125.add_homework([0, 1, 2, 3, 4]) CS125.add_quiz([2], [15, 0, 50], "CBTF") ECE313.add_quiz([0], [17, 0, 50], "CBTF") # let's add that to the calendar Elie_Calendar = _Calendar.Calendar(2020, 'spring', 21, 13)
def main(): qg = Information.QueryGenerator( "/local/data/haoxu/Rudetect", "Gabapentin_0628_0121/final/clusterData/0") qg.generateQ()
from StateTree import StateTree from Information import * from CollisionChecking import * import time error=0 #new las def new_laser_scan_data(data): #2d pose estimate #figure out best velocity #send out new velocity command pass def new_odometry(data): pass def new_robot_information_data(data): pass def predict_next_move(): pass #rospy.init_node('follower_node') q=Information(1,2,0,1,0) c=CollisionChecking(2,4000) st= StateTree(c) time.sleep(0.01) st.plan()
def getNews(self, folderpath, top=5): event2timeScope = { "Gabapentin_0628_0121": ["2017-06-28T00:00:00Z", "2018-01-21T00:00:00Z"], "SanctuaryCities_0516_0523": ["2018-05-16T00:00:00Z", "2018-05-23T00:00:00Z"], "WhereAreTheChildren_0418_0527": ["2018-04-18T00:00:00Z", "2018-05-27T00:00:00Z"], "Ingraham_0618_0624": ["2018-06-18T00:00:00Z", "2018-06-24T00:00:00Z"], "ItsJustAJacket_0621_0624": ["2018-06-21T00:00:00Z", "2018-06-24T00:00:00Z"], "immigrants_0622_0624": ["2018-06-22T00:00:00Z", "2018-06-24T00:00:00Z"], "JetLi_0519_0523": ["2018-05-19T00:00:00Z", "2018-05-23T00:00:00Z"], "BandyLee_0110_0115": ["2018-01-10T00:00:00Z", "2018-01-15T00:00:00Z"], "JackBreuer_1228_0115": ["2017-12-28T00:00:00Z", "2018-01-15T00:00:00Z"], "SouthwestKey_0620_0624": ["2018-06-20T00:00:00Z", "2018-06-24T00:00:00Z"], "Capriccio_0516_0523_new": ["2018-05-16T00:00:00Z", "2018-05-23T00:00:00Z"] } if not self.getSimilarity: skipthoughts_model = { "name": "skipthoughts", "modelPath": self.rootpath + "/.." + "/skip_thoughts/pretrained/skip_thoughts_uni_2017_02_02/exp_vocab", "checkpointPath": "model.ckpt-501424" } sent2vec_model = { "name": "sent2vec", "modelPath": "/lustre/scratch/haoxu/twitter_bigrams.bin" } self.getSimilarity = Claim.GetSimilarity(self.rootpath, self.folderpath, skipthoughts_model) folderPath = os.path.join(self.folderpath, "final") rankedClusterClaims = self.helper.loadJson( folderPath + "/ranked_cluster_claims.json") count = 0 for index, info in enumerate(rankedClusterClaims): if count >= top: continue count += 1 query = info[0] start = event2timeScope[folderpath][0] end = event2timeScope[folderpath][1] # find similar news alylienNewsAPI = Information.AylienNewsAPI() news = alylienNewsAPI.getNews(query, start, end, 10) if len(news) == 0: print("no news.") print("folder ", folderpath) print("info ", info) continue titles = alylienNewsAPI.getTitles(news) # find final news based the most similar news query = self.getSimilarity.getSimilarNews(query, titles) finalNews = alylienNewsAPI.getNews(query, start, end, 10) self.helper.dumpPickle(folderPath + "/news_bk", str(index) + "_news.pickle", finalNews) finalNewsDict = [i.to_dict() for i in finalNews] self.helper.dumpJson(folderPath + "/news", str(index) + "_news.json", finalNewsDict) print("{}th claim: news has been saved.".format(index))
class Day(Base): __tablename__ = symbol + '_chart' __table_args__ = {'extend_existing': True} id = Column(Integer, primary_key=True) informations = relationship(Information.get_information_class(symbol))