defcrawl_course(self, courseid): coursewares = self.get_coursewares(courseid) data = [] for url in coursewares: info = self.get_video_info(url) data.append(info) self.store_data(data)
asyncdefcrawl(self): workers = [ asyncio.Task(self.work(), loop=self.loop) for _ in range(self.max_task) ] self.t0 = time.time() await self.q.join() self.t1 = time.time() for w in workers: w.cancel()
with open('stuq.json') as fp: data = json.load(fp)
for filename, vid in data: filename += '.flv' crawler.add_task((filename, vid)) try: loop.run_until_complete(crawler.crawl()) finally: crawler.report() crawler.close()
r = sr.Recognizer() with sr.AudioFile('test.wav') as source: audio = r.record(source)
r.recognize_sphinx(audio)
输出如下:
this series is going to cover competition and i think we should begin by just laying out the topics are going to mention along the way so we have a sense of where we’re going the first of those topics is the radical simplicity of computation it turns out that all the complexity of our computers and programming languages and operating systems is comp complexity that we have added it is not fundamental to computation and to see that we’re going to look both at the turn machine and abby lana calculus which are the two most well known models of computation were these the two most well known abstract models both of these are normally talk with the very mathematical kind of terminology indication lot of greek letters and so on but we’re just going to use python code because python is aline was any programmer can understand pretty easily and that wall hours to get at least a high level understanding of what’s going on inside of the systems the next topic that we’re going to talk about is the limits of computation specifically be holding problem which is an example of an undesirable problem at the computer science be holding problems as they did really quickly is the problem of writing a function let’s call a halt it takes another function of scott after the decides whether half will terminate we’re not itself will terminate eventually then hold your return troops itself wolford sample would forever than a halt to return faults and it’s easy to state that problem as i just did it but you cannot write this launch and no programming language can express this function no computational system can express his function at the highly non obvious result but there are rigorous mathematical proof so this going back to the nineteen thirty’s and they have held up for a year’s both in theory and practice so will see why that’s true are these the high level sketch of why that’s true and some of the implications of it for the rest of computation we’re also going to see the structure of computation specifically the idea of trying equivalents which tells us that the turing machine and amanda calculus are both capable of answering the same questions any question that one of them can answer the other cancer and it turns out to this is true of our real world computers as well including the laptop and i’m recording this on if my laptop unanswered question and so could turn machine and this is extremely surprising given how simple turn machines are exactly first look at them you’re not going to believe that their actual general purpose computer system but it turns out that in fact they are because of turner problems which once again as a rigorous mathematical proof is going back to the nineteen eighties excuse me hit eighty years ago the nineteen thirty’s a related idea that will talk about is the chon ski hierarchy of computational systems and it turns out that this turn of quo blood type of system is only the most powerful type of computation there are four levels and as hierarchy and they began with the weakest which is a bullet to what we called regular depressions the next level is what you would need if you wanted to recognize python code mi you want to decide whether as spring is valid python or is not about python the next levels which would need if you wanted to recognize as c. plus plus code and this distinction is very important in fact python was intentionally designed to require less complexity in the top additional system that recognizes that most programming languages have this level of complex including for example a job as script and one of the reasons the python is so we see the lord and revisit potentially was designed to require less complexity finally the last level in this hierarchy is the turner problem level which contains trainers shane solana calculus my laptop and so on and this hierarchy is first of all amazing just as relates these things that seem unrelated if you haven’t learned as yet but that’s not even the most amazing thing about it the most amazing thing is it known tom speed created this hierarchy when he was studying linguistics he was studying natural languages like english and he establishes different levels of linguistic complexity which computer scientists then took the news for all kinds of things including programming languages but also categorizing finite state machines which fall into these different categories in different ways and will see all of these things are more detail as we go that’s all i want to say about this introduction next time we’re going to pick up trade machines were gonna ride that simulator that could be wrapped hemlines a code and take about ten minutes of soul be quite easy to write so i’ll see you next time for training sheets