def get_grade(filename): grades = reader(filename) total = 0 for grade in grades: subgrade = grade[2] / grade[3] * grade[4] * 100 total += subgrade return total
def get_allrundles(season): info = reader(u"https://learnedleague.com/allrundles.php?%d" % (season)) if info.startswith("Season not yet underway."): return {} parsev = AllRundleParse(season) parsev.feed(info) return parsev.ret_value()
def __init__(self, args): self.shell = args self.publicsubs = [] self.privatesubs = [] self.t = Template() self.file = self.shell ireader = reader() self.load_file = ireader.loader(self.file)
def check_match_info(game_no): """ game_no: game number extracted from the LL site. returns False if this is not a twin game (most cases) returns a string consisting of player names separated by "v." and an LL score. """ info = reader(u"http://learnedleague.com/match.php?id=%d" % (game_no)) parsev = MatchParse() parsev.feed(info) return parsev.ret_value()
from Reader import reader, make_arrays from visualization import plot_graphics from scr.algorithms import correlation_function, normalization if __name__ == '__main__': data = reader("../data/21022518.txt") arr1, arr2, arr3, arr4, arr5, arr6, arr7, arr8, arr9, arr10, arr11, arr12 = make_arrays( data) plot_graphics(arr9, arr12, 'plasma_pos', 't, мс', 'plasma_pos') plot_graphics(arr9, arr8, 'neutron_glob14', 't, мс', 'neutron_glob14') plot_graphics(arr9, arr10, 'neutron_glob12', 't, мс', 'neutron_glob12') tau, corr = correlation_function(arr8, arr12) plot_graphics(tau, corr, 'corr_func', 'tau', 'corr_14') corr = normalization(corr) plot_graphics(tau, corr, 'norm_corr_func', 'tau', 'n_corr_14') tau, corr = correlation_function(arr10, arr12) plot_graphics(tau, corr, 'corr_func', 'tau', 'corr_12') corr = normalization(corr) plot_graphics(tau, corr, 'norm_corr_func', 'tau', 'n_corr_12') tau, corr = correlation_function(arr8, arr10)
return ids def filter_sent_label(sent, label): return len(sent) < MAX_LENGTH and len(label) < MAX_LENGTH def filter_sents_labels(sents, labels): return [[sents[i], labels[i]] for i in range(len(sents)) if filter_sent_label(sents[i], labels[i])] if __name__ == '__main__': config_path = 'D:\PyCharm\pycharm_workshop\seq2seq_based_on_attention_pytorch\config.cfg' config = configer(config_path) Reader = reader(config.corpus_path, needFresh=True, language='eng') text_sent_list, label_sent_list = Reader.getData() label_sent_list, text_sent_list = text_sent_list, label_sent_list # sent_label_list = filter_sents_labels(text_sent_list, label_sent_list) ''' create dictionary ''' # print(text_sent_list) text_word_state = {'SOS': 1, 'EOS': 1, PAD: 1} label_word_state = {'SOS': 1, 'EOS': 1, PAD: 1} for line in text_sent_list: for word in line: if word not in text_word_state: text_word_state[word] = 1 else: text_word_state[word] += 1
return ids def filter_sent_label(sent, label): return len(sent) < MAX_LENGTH and len(label) < MAX_LENGTH def filter_sents_labels(sents, labels): return [[sents[i], labels[i]] for i in range(len(sents)) if filter_sent_label(sents[i], labels[i])] if __name__ == '__main__': config_path = 'config.cfg' config = configer(config_path) txt_reader = reader(config.text_train_path, needFresh=True, language='chn') tgt_reader = reader(config.tgt_train_path, needFresh=True, language='chn') text_sent_list = txt_reader.getData() label_sent_list = tgt_reader.getData() txt_test_reader = reader(config.text_test_path, needFresh=True, language='chn') tgt_test_reader = reader(config.tgt_test_path, needFresh=True, language='chn') txt_test_sent_list = txt_test_reader.getData() tgr_test_sent_list = tgt_test_reader.getData() # print(text_sent_list[:1]) # print(label_sent_list[:1]) # sent_label_list = filter_sents_labels(text_sent_list, label_sent_list) '''
def get_matches_for_rundle_day(season, rday, rundle): info = reader(u"https://learnedleague.com/match.php?%d&%d&%s" % (season, rday, rundle)) parsev = RundleDayParse() parsev.feed(info) return parsev.ret_value()
def __init__(self, train, test): train = Trainer(train) self.instructions = train.main() self.dic = reader(test) self.root = Node(self.dic[0], 'Root', '', 0.5)
from typing import Tuple, List, Union, Dict import numpy from math import floor from Reader import reader from random import uniform from math import pi settings: Union[Dict[str, bool], Dict[str, None]] = reader('Settings.txt') FPS: int = 60 RESOLUTION: Tuple[float, float] = 1280., 720. CRT: bool if 'CRT EFFECT' in settings and settings['CRT EFFECT'] is not None: CRT = settings['CRT EFFECT'] else: CRT = False SCANLINES: bool if 'SCANLINES' in settings and settings['SCANLINES'] is not None: SCANLINES = settings['SCANLINES'] else: SCANLINES = CRT WINDOWED: bool if 'FULLSCREEN' in settings and settings['FULLSCREEN'] is not None: WINDOWED = not settings['FULLSCREEN'] else: WINDOWED = False BLOOM: bool if 'BLOOM' in settings and settings['FULLSCREEN'] is not None:
def __init__(self, fil): self.dic = reader(fil) self.instructions = []