-
Notifications
You must be signed in to change notification settings - Fork 0
/
video_summarizer.py
122 lines (103 loc) · 63.5 KB
/
video_summarizer.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
import time
import json
import re
import google.generativeai as genai
from google.generativeai.types.generation_types import BlockedPromptException
from sep_2 import sep
def count_words(text):
cnt = 0
for idx, x in enumerate(text):
words = len(x.split())
cnt += words
return cnt
def extract_numbers(input_string):
# Define the pattern to match numbers with optional decimal points
pattern = r'\d+\.\d+'
# Find all matches in the input string
matches = re.findall(pattern, input_string)
# Extract the first and second numbers from the matches
if len(matches) >= 2:
first_number = float(matches[0])
second_number = float(matches[1])
return first_number, second_number
else:
return None, None
def sec_to_min(time):
if time < 60:
return f"Second {round(time, 2)}"
else:
return f"min {round(time/60, 2)}"
def summarize_video(youtube_link, GOOGLE_API_KEY):
segment_dict = {}
summary = ""
video_script = get_whisper(youtube_link)
# print("vidoe Script ====", video_script)
video_script ="[0.00s -> 6.80s] All you need to learn machine learning in 2024 is a laptop and a list of the steps you need to take.[6.80s -> 14.40s] I'm a student researcher working for an X-Meta professor and have had interviews with Google DeepMind, Amazon and other cool companies,[14.40s -> 17.60s] but it took me over three years to get to this point.[17.60s -> 25.20s] So today I will share how I would learn machine learning if I could start over by revealing the six key steps you need to take.[25.20s -> 26.40s] Let's get going![26.40s -> 31.20s] In general, all these steps don't have to be strictly completed in any particular order,[31.20s -> 35.20s] but I would not start with a final and arguably most important step.[35.20s -> 40.56s] That said, what I do highly recommend is to start with learning the basics of Python.[40.56s -> 45.20s] Python is the programming language used by pretty much everyone to work on machine learning,[45.20s -> 48.40s] and every other step on this list builds on top of it.[48.40s -> 52.96s] This mainly applies to beginners that don't know what a list or a dictionary are,[52.96s -> 57.28s] and that don't know how to write a simple if-else statement or a for loop.[57.28s -> 62.24s] I would even go as far as saying you need to learn what a list comprehension and what class[62.24s -> 63.36s] enterantons are.[63.36s -> 66.24s] And honestly, I don't know what else to say,[66.24s -> 71.84s] than just type in Python tutorial or course on YouTube or Google and get started.[71.84s -> 74.56s] There's so much amazing free content out there,[74.56s -> 78.56s] but you should always keep in mind to actively code along the tutorial.[78.56s -> 82.72s] Enjoy getting into machine learning with Python, but don't go too in-depth.[82.80s -> 88.80s] This lets you start with a fun experience because at some point you will also have to learn math.[89.52s -> 94.32s] Now you could argue that you don't need math because so much is already automated and[94.32s -> 98.40s] taken care of by cool Python libraries, which is true,[98.40s -> 102.64s] but you will need to know all the fundamentals of calculus, linear algebra,[102.64s -> 107.12s] and probability theory to understand pretty much any machine learning approach.[107.12s -> 109.92s] That said, you really don't need complex math.[109.92s -> 113.44s] Most of the math is high school or entry level college maths.[113.44s -> 118.32s] Like you just need to understand what the derivative of a function is and how to compute it.[118.32s -> 122.08s] You need to know what a matrix is and how the dot product works.[122.08s -> 125.12s] There again are amazing resources out there that are free,[125.12s -> 128.80s] like these courses right here, or a website called Khan Academy.[128.80s -> 132.32s] I mean, you can even learn most of what you need on brilliant.org.[132.32s -> 133.92s] Sadly not sponsored.[133.92s -> 138.80s] Or you just go to college and take the mandatory math classes for any engineering major.[138.80s -> 142.16s] I'll tell you about my absolute favorite resource for learning the[142.16s -> 146.40s] fundamental math for new networks after we cover the next important steps.[146.40s -> 150.48s] This already shows you that you don't need to hustle through all the math courses[150.48s -> 151.68s] they are in the beginning.[151.68s -> 156.96s] In fact, I wouldn't even recommend that because it can be very frustrating and just not fun.[156.96s -> 159.68s] Whenever you don't understand some maths later on,[159.68s -> 162.56s] you can always revisit it by just googling.[162.56s -> 166.16s] Learn the basics and then continue on to the next fun step.[166.16s -> 168.48s] Learning about the ML developer stack.[168.56s -> 170.72s] So now you know the basics of Python.[170.72s -> 172.32s] And if you haven't already,[172.32s -> 176.96s] can learn some basic tools like Jupyter notebooks and libraries like pandas,[176.96s -> 178.80s] lumpi, and matplotlib.[178.80s -> 182.32s] Lumpi is a library for doing maths with matrices or arrays.[182.32s -> 186.96s] It's a great starting point because you can now implement the maths that you just learned about[186.96s -> 190.88s] and see how simple it is to compute a dot product between two matrices.[190.88s -> 194.32s] Matplotlib is a tool for visualizing data and graphs[194.32s -> 196.56s] and just seeing what maths you are doing.[196.64s -> 201.44s] And in my opinion, at least, visualizing stuff is fun and just very useful.[201.44s -> 205.92s] Finally, pandas is a great tool for dealing with data that is in tabular format.[205.92s -> 208.72s] A lot of machine-knowing problems deal with tabular data[208.72s -> 211.12s] and pandas lets you, again, very easily,[211.12s -> 213.92s] manipulate those and visualize the tables.[213.92s -> 217.04s] All those libraries also work very well with Jupyter notebooks[217.04s -> 219.68s] and are an essential part of learning machine learning.[219.68s -> 222.16s] As you'll see by getting to know those frameworks,[222.16s -> 226.40s] you will automatically improve your overall practical Python and ML skills.[226.72s -> 231.44s] But again, only focus on the basics by following a few tutorials.[231.44s -> 235.20s] Later, when working on projects, you'll really get to know the libraries.[235.20s -> 241.04s] So now, let's get back to some theory and finally actually learn about machine learning and deep learning.[241.04s -> 244.96s] Okay, up until now, everything should honestly not take too long.[244.96s -> 249.92s] Perhaps a few weeks, depending on how much time you put in and at what level you already are.[249.92s -> 253.36s] But the ML courses I will now recommend do take some time.[253.36s -> 258.24s] The best and probably most famous machine learning course or collection of courses[258.24s -> 261.28s] is the machine learning specialization by Andrew Nunn.[261.28s -> 265.28s] The cool thing is that you hear already gets to know some machine learning frameworks[265.28s -> 267.28s] like CycatLearn and TensorFlow.[267.28s -> 271.92s] Well, I do have to admit I personally prefer and would recommend PyTorch[271.92s -> 276.56s] but learning one framework pretty much lets you already quickly adapt to the other one.[276.56s -> 280.00s] This course is absolute gold and it's free.[280.00s -> 283.76s] Although this is the beginner course, it is still very important.[283.76s -> 289.12s] They here teach a lot of classical ML concepts and those are the things you need to be able to answer[289.12s -> 291.12s] quite easily in ML interviews.[291.12s -> 295.92s] Now, remember when I teased my favorite resource for learning maths in neural networks?[295.92s -> 302.40s] Well, after learning about those in Andrew's course, I would watch Andrei Carpathi's neural network series.[302.40s -> 308.16s] He here implements a simple NLP model from the ground up and goes all the way up to a transform model.[308.16s -> 311.68s] He also goes through all the maths of backpropagation and so on.[311.68s -> 314.00s] I cannot recommend this series enough.[314.00s -> 318.96s] Since in Andrew Nunn and Andrei Carpathi's courses, you already get some practical experience[318.96s -> 325.28s] with the taught ML concepts, I would then continue on to the next more advanced and practical course,[325.28s -> 327.36s] the deep learning specialization.[327.36s -> 333.20s] This course focuses more on implementing and training neural nets and the absolutely amazing thing here[333.20s -> 338.64s] is that they also include hugging face, which is a library that you pretty much cannot avoid.[338.64s -> 339.92s] It's really amazing.[339.92s -> 343.12s] And if you feel like this course doesn't teach you enough about hugging face,[343.12s -> 346.56s] you can also just go through the hugging face NLP course directly.[346.56s -> 350.00s] They also learn even more advanced concepts in NLP.[350.00s -> 352.48s] Well, if you are interested in NLP, that is.[352.48s -> 357.52s] So, yeah, those are the two or perhaps even three courses I would take and recommend.[357.52s -> 362.64s] By now you have learned a lot and worked on several smaller projects or rather tutorials.[362.64s -> 366.56s] Now it's time to actually get your hands dirty and work on real projects.[366.56s -> 370.80s] I honestly think you heal on the most and there are two things I would work on.[370.80s -> 374.08s] First, I would go to Kaggle and just work on challenges.[374.08s -> 376.80s] They are many available for any level.[376.80s -> 380.56s] Try not to underestimate the complexity and start with simpler challenges[380.56s -> 383.36s] so you don't get frustrated and demotivated.[383.36s -> 387.68s] And if you do take on more difficult ones that also come with prize money,[387.68s -> 389.52s] don't expect to win one.[389.52s -> 393.92s] It's really difficult to get to that point and you also need a lot of compute.[393.92s -> 400.08s] So, okay, after working on Kaggle challenges comes my final and favorite type of project to work on.[400.08s -> 403.20s] Reimplementing a paper and recreating the results.[403.20s -> 405.76s] This is challenging and you will learn a lot.[405.76s -> 410.56s] And most importantly, this type of project will definitely help you stand out on your ML application.[410.56s -> 415.44s] That said, there are a few other simpler ways to stand out that you can already get started[415.44s -> 416.88s] during your learning process.[416.88s -> 419.68s] So, I'm sure you might want to watch this video right here[419.68s -> 422.08s] where I reveal those techniques and tips.[423.20s -> 424.48s] Bye-bye!"
#video_script = "[4.30s -> 10.44s] Hello 大家好,欢迎你们来到Chinese Podcast with 盛岸。 [10.86s -> 21.56s] 在这个播客频道里的所有内容都是为学习中文的外国学生制作的。 [21.56s -> 33.12s] 通常情况下来说,如果你的中文水平达到了HSK 4G 5G的程度, [33.72s -> 39.34s] 那么这些播客的难度会比较适合你。 [40.26s -> 48.88s] 你可以比较轻松的听懂这个频道当中大多数播客的内容。 [48.88s -> 59.40s] 不过大家在听的时候也许会感觉到在这个播客频道里面有几期的内容, [59.64s -> 63.66s] 它相对来说难度会比较大。 [64.44s -> 77.46s] 那这个主要是因为可能在这几期播客里面我介绍的主题或者内容对于大家来说会比较陌生, [77.46s -> 83.48s] 或者说里面有稍微多一些的这个生词。 [83.86s -> 93.48s] 那么在这个情况下,如果你们发现某一期播客特别难听懂, [94.12s -> 98.78s] 那么我会建议大家先去读文字稿, [99.38s -> 106.18s] 然后学习一下这个播客当中出现的相关的生词。 [106.18s -> 117.28s] 那做完这个之后,你们再把文字稿放到一边去尝试听一听看看能不能听懂。 [117.90s -> 124.28s] 所有的文字稿我都会在patreon上及时更新。 [124.98s -> 133.98s] 那如果你加入我的patreon会员之后,你不仅可以获得这些文字稿, [133.98s -> 140.36s] 你还可以听到现在有100多期的mini播客。 [140.72s -> 147.34s] 就是我基本上每天会在patreon上更新一期, [147.84s -> 151.60s] 长度大概是10分钟左右的播客。 [152.28s -> 157.38s] 那如果我某一天发布了其他的内容对吧, [157.68s -> 162.96s] 如果我发布了视频播客,发布了这种长篇的播客的话, [162.96s -> 169.28s] 那当天我可能就不会在patreon上更新mini播客。 [170.12s -> 182.00s] 那么在patreon上的那些mini播客和这个频道里面公开的免费的这些播客最大的区别就是, [182.48s -> 188.14s] 在那里我更多的是没有提前准备稿子, [188.14s -> 197.24s] 去给大家介绍一些这种中国的文化社会语言学习相关的一些内容, [197.36s -> 201.86s] 那些内容会更加的细,更加的小。 [203.08s -> 212.36s] 然后如果大家感兴趣,可以在下面的节目详情当中找到我的patreon的链接。 [213.42s -> 222.38s] 在正式开始今天我们的话题之前,我想提醒大家一下, [223.06s -> 231.66s] 我想大家应该有注意到就是,这一期播客他的内容非常的长。 [232.60s -> 238.52s] 我写这个文字稿就写了差不多8000个字, [238.52s -> 246.32s] 那我在录的过程中也许还会自由发挥一下,去表达更多的内容, [246.56s -> 251.94s] 所以这一期的内容其实挺长的,时间很长,内容很多。 [252.86s -> 261.52s] 那或许在听播客的大家,你们没有足够的注意力, [261.52s -> 266.64s] 一次性听完这期节目所有的内容, [266.98s -> 275.98s] 或者说这个播客他的难度对于你来说也许有一点大,不是那么容易理解。 [276.64s -> 283.32s] 也许你会觉得一次性听完所有的内容会非常的有挑战。 [283.94s -> 290.26s] 那么在这个情况下我建议大家可以一次先听一部分。 [290.26s -> 298.12s] 通常来说如果你听到了背景音乐,那这就意味着, [298.70s -> 303.08s] 上一部分的内容我已经基本介绍完了, [303.82s -> 308.84s] 接下来我会开始介绍新的一个部分的内容。 [309.66s -> 316.48s] 好,那这个时候我觉得你可以考虑暂停休息一下再听, [316.48s -> 321.56s] 或者 说下次再继续听后面的内容。 [322.08s -> 328.38s] 好的,那我所有要啰嗦的话呢,已经说完了。 [329.02s -> 334.88s] 下面我们就正式开始今天这期播客的话题吧。 [336.62s -> 340.46s] 在今天这期播客节目当中, [340.46s -> 350.58s] 我想跟大家介绍的是一个在中国的社会当中关注度很高的事情。 [351.10s -> 360.78s] 好,在我刚刚说的这个句子里面我用到了这样一个表达,叫做关注度很高。 [360.78s -> 369.04s] 他的意思呢,就是说很多人都在关注讨论某件事情。 [370.40s -> 375.76s] 好,那除了这个表达我们还可以说,热度很高。 [376.56s -> 379.28s] 举个例子让大家来理解一下。 [379.92s -> 387.92s] 比如说最近在网上很多人都在讨论某一个新闻。 [387.92s -> 396.26s] 那这个情况我们就可以说,这个新闻他的关注度很高, [396.70s -> 401.92s] 或者这个新闻他的热度很高。 [402.44s -> 414.36s] 那我们今天在这期播客当中要讨论的是近期在中国关注度很高的一个问题。 [414.36s -> 419.34s] 这个问题是中国人口下降的问题。 [420.56s -> 426.18s] 我们先简单的来看一下人口这个词。 [427.02s -> 431.38s] 这个词不难,它里面有一个口字。 [432.12s -> 436.86s] 那相信大家在刚刚开始学习中文的时候, [437.52s -> 440.70s] 如果你们是跟着教材学习的话, [440.70s -> 449.74s] 那我相信大家一定有学过这样一个句 子,也就是你家有几口人。 [450.28s -> 456.44s] 我们知道在这个句子里面口,它是一个谅词。 [457.18s -> 463.24s] 那不知道大家有没有产生过这样的疑问,有没有过这样的问题, [463.50s -> 466.04s] 也就是,哎,你们有没有想过, [466.04s -> 474.10s] 为什么只有在介绍一个家庭里面有几个成员的时候, [474.60s -> 478.56s] 我们才会用到这个谅词口呢? [479.24s -> 485.90s] 那如果我们要说这个房间里面有几个人,有多少人的时候, [486.38s -> 493.94s] 为什么我们就不用口这个谅词而是用个这个谅词呢? [494.94s -> 502.56s] 那要回答这个问题,我们首先得理解一下人口这个词的意思。 [503.20s -> 507.70s] 那人口就是英文当中的population, [508.26s -> 517.16s] 那他们指的就是在一个国家,一个 城市,或者一片区域当中, [517.62s -> 521.68s] 有多少人住在这里,在这里生活。 [522.68s -> 527.88s] 那当我们描述在一个房间里面有多少人的时候, [528.26s -> 539.56s] 在相似的情况当中,我们指的只是说这个人暂时的停留在这个空间, [540.16s -> 543.52s] 而不是长期的住在这儿。 [543.78s -> 550.34s] 所以啊,这种暂时的情况,我们得要用个这个谅词, [550.34s -> 562.30s] 那如果是长期,稳定的情况,我们可以用口这个谅词作为人的一个谅词。 [571.08s -> 577.20s] 好,那上面语法的内容呢,我们就不多说了。 [577.20s -> 580.80s] 现在我们回到我们的主题。 [581.86s -> 590.26s] 关于中国的人口问题呢,我之前有做过一期比较长的播客, [590.84s -> 599.50s] 那在那期播客当中,我跟大家介绍了中国的一项非常有特色的人口制度, [600.08s -> 604.36s] 叫做计划生育制度,或者它有别的名字, [604.36s -> 608.74s] 比如说依海政策啊,独生子女政策啊等等。 [609.56s -> 618.28s] 好,那如果你还没有听过那期播客的话,我非常建议,非常推荐你可以去听一下。 [619.02s -> 624.56s] 那这个链接大家可以在下面的节目详情当中找到。 [625.14s -> 632.30s] 在这里呢,我就先简单的向那些没有听过那期播客的听众, [632.30s -> 640.54s] 或者说不太了解独生子女政策的听众,简单的介绍一下这个政策, [640.86s -> 650.98s] 它的 内容是什么,因为它和我们今天要讨论的问题有非常密切的关系。 [652.04s -> 662.52s] 在1980年代的时候,当时中国的经济还没有经历那个快速发展的过程, [663.52s -> 673.10s] 那么整个国家非常的穷,而与此同时呢,我们的人口数量又超级的多。 [673.10s -> 685.14s] 那对于当时的那个中国来说,我们最大的一个问题可以说是人太多了,而我们的资源不够 。 [685.68s -> 692.38s] 所以这个对于国家的发展来说是非常大的阻碍。 [693.00s -> 701.58s] 于是当时的政府为了控制我们人口的增长,就颁布了一个这样的政策, [701.58s -> 711.38s] 叫做独生子女政策。这个政策在不同的地区它实行的时候有一些区别, [711.52s -> 718.80s] 但是总而言之,它主要的内容就是,每个家庭只能生育一个孩子。 [719.82s -> 730.28s] 这样一个一孩政策,独生子女政策一直到前几年,2016年的时候,才正式结束。 [731.28s -> 741.46s] 那么对于这个独生子女政策,在中国国内和国外有完全不一样的评价 。 [742.08s -> 747.02s] 在国外,我们非常主流的一个观点是这样子的。 [747.76s -> 759.92s] 我们认为这个政策实现了最初的那个目标,也就是说它成功的控制了中国人口数量的增长,对吧。 [759.92s -> 769.48s] 但是在国外,更普遍,更流行的,更主流的一个评价是这样子的。 [769.66s -> 774.70s] 很多人认为这个政策根本就没有必要实行, [775.42s -> 785.98s] 因为我们从这个离中国很近的国家,日本,韩国,新加坡这些亚洲国家的经验来看, [785.98s -> 795.10s] 一个国家随着它的经济的发展,自然就会出现出生率的降低, [795.86s -> 801.48s] 也就是说大家自然而然的会生更少的孩子。 [802.62s -> 810.98s] 那在这里,我想具体的来谈一下,我个人对于上面所说的第二个观点, [810.98s -> 818.94s] 就是在国外很主流的对于独生子女的批评的这个观点的一个看法。 [819.38s -> 824.06s] 首先,我确实是觉得这个观点有一定的道理, [824.74s -> 832.38s] 因为如果我们现在就是分析目前中国所遇到的这个人口问题, [832.38s -> 840.36s] 那独生子女制度确实是造成这个问题的一个重要原因。 [840.82s -> 851.24s] 为什么我这么说呢?是因为这个政策它是从1983年左右开始正式的实行的。 [851.24s -> 863.76s] 那么受到这个政策直接影响的就是中国的80后、90后、00后以及10后这几代人, [864.24s -> 870.90s] 那在这个政策的影响下,从80年到现在,对吧, [871.26s -> 875.68s] 这段时间出生的人口减少了很多。 [876.68s -> 882.80s] 而现在呢,在这些人当中,就是这段时间出生的人当中, [883.20s -> 889.56s] 很多人到了生孩子的年龄,比如说我们的80后、90后, [890.14s -> 899.58s] 到今天已经到了生孩子的年龄,那这就意味着生孩子的人变少了。 [899.58s -> 906.14s] 所以这个影响了出生率,这个解释的就是为什么, [906.58s -> 911.26s] 计划生育制度和我们今天人口问题有关系。 [911.98s -> 916.72s] 那除此之外呢,我们的这些80后、90后, [917.12s -> 926.46s] 因为都是独生子女,对吧,也就是说他们很多都是家里唯一的一个孩子。 [926.46s -> 931.20s] 那么当他们长大结婚之后, [931.58s -> 936.78s] 我们可以想象到一对这种80后、90后的夫妻, [937.52s -> 941.64s] 他们两个人就是要养育四个父母。 [942.40s -> 945.50s] 那如果再加上他们生的孩子的话, [946.14s -> 951.02s] 他们这个生存的经济 压力是不是就特别的大。 [951.02s -> 957.34s] 于是他们生育的愿望比较低,这个是比较好理解的。 [957.70s -> 963.88s] 那很多这种80、90后,他们只愿意生一个孩子, [964.28s -> 966.38s] 或者说完全不生。 [967.32s -> 970.06s] 好,那上面我所说的是, [970.42s -> 975.14s] 在国外对于这个计划生育制度的一些批判, [975.36s -> 977.42s] 它有道理的地方, [977.42s -> 983.30s] 但是我觉得它当中这种批判也有很大的问题。 [983.94s -> 989.66s] 那我下面要解释的这个有一点点难理解, [989.92s -> 991.62s] 请大家认真听。 [992.44s -> 997.76s] 好,那我觉得这个批判或者批判的原因有问题。 [998.28s -> 1001.94s] 这个问题在于那样一种批判呢, [1002.04s -> 1004.88s] 它更多的是站在今天, [1004.88s -> 1010.68s] 就是我们今天已经看到这个政策带来问题的基础上, [1010.90s -> 1014.62s] 去讨论,去批判这个政策, [1015.04s -> 1018.42s] 去说我们当初不应该制定 这个政策。 [1019.12s -> 1022.78s] 好,但是我觉得这样一个批判的观点, [1022.92s -> 1030.58s] 它有一点忽略掉了当时我们为什么要制定这个政策, [1030.72s -> 1033.48s] 制定独身子女政策的背景。 [1034.36s -> 1042.48s] 现在啊,如果我们稍微看一下西方媒体对于中国的一个新闻的报道, [1043.04s -> 1047.28s] 那么我相信大家应该很容易能够发现, [1048.10s -> 1052.80s] 这些新闻报道,西方媒体对于中国的新闻报道, [1052.98s -> 1060.10s] 基本上都是一些非常负面的信息,非常负面的消息。 [1060.10s -> 1063.40s] 那举一些我所看到的例子吧, [1063.78s -> 1069.18s] 我就是经常看到比如说在这个经济学人啊, [1069.70s -> 1075.04s] 什么在英国的微报啊,或者是美国的纽约时报啊等等, [1075.36s -> 1078.54s] 这些主流的西方媒体当中, [1078.90s -> 1085.58s] 他们会经常报道,比如疫情期间中国的情况有多糟糕啊, [1085.58s -> 1090.68s] 然后中国现在的经济有 多危险啊, [1090.78s -> 1096.34s] 然后中国政府有多么不尊重人权啊等等。 [1097.20s -> 1101.52s] 首先我想说这样一些新闻报道, [1101.52s -> 1104.90s] 它的内容也许是有一些道理的, [1105.42s -> 1112.66s] 但是我所不能接受的就是他们只选择一些坏的事情, [1112.66s -> 1118.00s] 一些非常负面的内容去报道。 [1118.00s -> 1122.62s] 好,那 这样一个问题其实在上个世纪八十年代, [1122.84s -> 1129.06s] 就是1980年代那个时候也是有的,也是存在的。 [1129.34s -> 1133.56s] 那在计划生育时形的那个年代对吧, [1133.76s -> 1138.26s] 开始时形的那个年代,别说是西方媒体了吧, [1138.26s -> 1146.14s] 就连中国自己也没有预测到在往后的三四十年时间当中, [1146.42s -> 1150.88s] 中国的经济会迎来如此之快的一个发展。 [1151.38s -> 1156.10s] 那相反,当时十分困扰中国的一件事情, [1156.66s -> 1160.38s] 就是我们刚刚提过的人口太多了, [1161.04s -> 1164.48s] 而经济发展的状况当时特别糟糕。 [1165.36s -> 1170.82s] 于是在西方媒体的报道上也有很多这样的内容, [1171.08s -> 1176.96s] 他们说中国当时非常快速的这个人口增长率, [1177.32s -> 1180.82s] 就是出生率很高,这样一些问题, [1181.22s -> 1186.16s] 它可能给中国以及世界带来很多的问题。 [1186.76s -> 1192.34s] 比如说首先在经济上,快速增长的这个人口, [1192.34s -> 1196.24s] 首先就会对资源造成压力。 [1196.80s -> 1201.00s] 比如说很可能会有这种粮食不足, [1201.84s -> 1205.52s] 就是很多人吃不上饭,没有饭吃, [1205.72s -> 1207.88s] 没有足够的食物吃这种问题。 [1208.54s -> 1211.28s] 另外呢,在政治上, [1211.80s -> 1220.52s] 如果这个人口过多,也有可能造成这个社 会动乱的风险增大, [1220.52s -> 1229.02s] 那从而就会导致说这个政府它会加强对民众的一个控制。 [1229.70s -> 1236.60s] 还有就是说我们过多的人口也会对环境造成压力,对吧。 [1237.12s -> 1242.56s] 所以总结来说,当时我们的这个独生子女政策, [1242.92s -> 1247.78s] 它之所以会出现,它有一个非常非常重要的背景, [1247.78s -> 1254.98s] 就是当时中国面临着特别大的人口的压力。 [1255.90s -> 1260.18s] 而至于未来经济会有一个什么样的发展, [1260.74s -> 1263.80s] 这个在当时是没有办法预见的, [1264.04s -> 1267.72s] 当时的人是不知道未来发生的事情的。 [1268.16s -> 1272.56s] 我们可以说这个是一个未知数,在当时来说。 [1275.00s -> 1277.40s] 好,那这样一个背景, [1277.78s -> 1286.14s] 我觉得很多国外的人在批判中国的这个独生子女政策的时候, [1286.54s -> 1288.54s] 并没有考虑到这一点。 [1289.06s -> 1291.72s] 所以站在我的角度来说, [1291.90s -> 1294.70s] 我觉得不是特别的公正。 [1297.22s -> 1299.80s] 好的,那说到这里呢, [1299.80s -> 1303.92s] 我还想跟大家分享这样一个问题, [1304.32s -> 1310.50s] 就是在我发布完那期介绍独生子女政策的播客之后, [1311.00s -> 1315.20s] 我和一些学生就这个话题做了一些讨论。 [1315.76s -> 1317.74s] 那在讨论的过程当中, [1318.20s -> 1319.70s] 我们发现, [1319.84s -> 1325.18s] 哎,就其实当时中国政府之所以要实施这个政策, [1325.18s -> 1330.02s] 它的原因,我们比较好理解,比较容易理解。 [1330.36s -> 1333.70s] 但是我们不太能理解的就是, [1334.24s -> 1337.24s] 为什么他们拖了那么久, [1337.46s -> 1342.90s] 一直到2016年才改变这个政策呢? [1343.38s -> 1348.16s] 也就是为什么他们没有早一点结束这个政策。 [1350.80s -> 1354.92s] 那这样一个问题,我自己想了很久, [1355.36s -> 1362.10s] 直到我看了一些这个2012年,2013年, [1362.10s -> 1364.34s] 还有2015年的, [1364.80s -> 1368.82s] 几期讨论计划生育政策的视频之后, [1369.46s -> 1371.20s] 哎,我有一些答案。 [1371.70s -> 1376.10s] 我会把这几期 访谈节目的链接, [1376.10s -> 1379.30s] 放在下面的节目详情当中, [1379.58s -> 1383.10s] 那如果大家感兴趣的话,可以去看一看。 [1383.84s -> 1385.98s] 这个访谈节目, [1386.12s -> 1387.90s] 刚刚提到的这个节目, [1388.00s -> 1390.44s] 它的名字叫做, [1391.14s -> 1392.56s] 枪枪三人形, [1393.16s -> 1395.00s] 那它的内容主要就是, [1395.52s -> 1399.92s] 一位主持人和两个节目的嘉宾, [1400.36s -> 1402.88s] 他们一起讨论当下, [1402.88s -> 1408.78s] 在中国比较受关注的一些新闻还有事件。 [1408.82s -> 1410.72s] 那么通过这个节目, [1411.06s -> 1413.34s] 我们可以大概的了解到, [1413.58s -> 1418.42s] 当年对吧,就是节目制作的那些年, [1419.92s -> 1423.76s] 在中国大众对于某一个事件, [1424.12s -> 1426.06s] 他们的看法有哪些? [1426.78s -> 1429.54s] 好,那在上面那几期, [1429.54s -> 1430.74s] 我说过的, [1431.20s -> 1434.54s] 讨 论计划生育政策的这个节目当中, [1434.90s -> 1436.96s] 我有一点震惊的发现, [1437.48s -> 1439.26s] 独生子女政策呢, [1439.48s -> 1442.16s] 这个东西它其实是比较有正 义的, [1442.62s -> 1443.66s] 也就是说, [1444.30s -> 1446.50s] 大家对于这个东西, [1446.60s -> 1447.62s] 对于这个政策, [1448.00s -> 1450.54s] 有不同的看法,不同的 评价。 [1451.08s -> 1452.08s] 那么在中国, [1452.92s -> 1455.52s] 我们对于独生子女政策, [1455.74s -> 1458.18s] 最主流的一个看法是这样子的, [1458.18s -> 1462.02s] 就是我们虽然也承认说, [1462.22s -> 1465.38s] 它在具体的实行过程当中, [1465.66s -> 1467.16s] 造成了一些问题, [1467.70s -> 1470.82s] 比如一些人权问题,对吧, [1471.32s -> 1475.10s] 那样一些已经怀孕的女性, [1475.44s -> 1477.84s] 他们被迫要去墮胎, [1478.64s -> 1481.02s] 要去放弃他们的孩子, [1481.52s -> 1482.30s] 那这一点, [1482.30s -> 1487.68s] 确实就是损害了女性的生育权利。 [1488.78s -> 1491.04s] 虽然我们认识到这一点, [1491.52s -> 1492.44s] 但同时, [1492.70s -> 1493.76s] 很多人都觉得, [1494.28s -> 1496.06s] 主流的观点觉得, [1496.54s -> 1498.10s] 它这个政策, [1498.50s -> 1500.90s] 确实达到了它的目的, [1501.46s -> 1504.80s] 也就是控制中国人口的增长。 [1505.70s -> 1506.76s] 而至于说, [1506.90s -> 1509.96s] 我们现在所广泛讨论的, [1509.96s -> 1512.70s] 这种中国人口下降的问题, [1513.06s -> 1517.14s] 这种出生率下降的这种现象, [1517.14s -> 1520.42s] 在很长一段时间以来, [1520.94s -> 1526.02s] 它其实都是被看作是独生子女政策, [1526.42s -> 1531.64s] 有效的发挥了作用的一个验证。 [1532.24s -> 1534.14s] 这句话有点难理解, [1534.28s -> 1537.44s] 它就是说,很久以来, [1537.44s -> 1538.94s] 我们会觉得, [1539.44s -> 1543.16s] 出生率的下降是一件好事。 [1543.88s -> 1545.20s] 出生率的下降, [1545.22s -> 1546.48s] 它说明了, [1546.72s -> 1551.22s] 它证明了我们当初的计划生育政策, [1551.44s -> 1552.58s] 是有用的。 [1553.30s -> 1555.24s] 好,那像是这些现象, [1555.60s -> 1557.20s] 出生率下降的现象, [1557.64s -> 1559.62s] 人口下降的现象, [1560.08s -> 1562.56s] 它变成一个问题, [1562.92s -> 1564.66s] 被大家所关注, [1564.66s -> 1570.52s] 这个过程是在很短的时间内发生的。 [1570.52s -> 1571.52s] 那我觉得, [1572.18s -> 1575.44s] 它发生的原因和疫情, [1575.82s -> 1577.60s] 其实是有很大的关系。 [1577.92s -> 1581.06s] 比如说,在这个疫情的影响之下, [1581.74s -> 1586.20s] 我们的出 生率下降的速度就更快了。 [1587.74s -> 1589.32s] 好,与此同时, [1589.74s -> 1591.76s] 我最后还要补充的一点, [1591.76s -> 1594.48s] 就是在中国来说, [1595.02s -> 1599.30s] 人口问题真的是一个非常复杂的问题。 [1600.40s -> 1601.96s] 因为在中国, [1602.50s -> 1607.32s] 我们除了现在大家所讨论的这种出生率低, [1607.54s -> 1608.80s] 人口减少, [1609.18s -> 1612.32s] 可能会带来的经济发展的风险, [1612.88s -> 1614.14s] 这种问题之外, [1614.60s -> 1616.80s] 同样我们还面临着, [1617.36s -> 1618.64s] 人口太多, [1619.20s -> 1620.70s] 社会竞争太大, [1620.70s -> 1623.92s] 大家生存的压力大的问题, [1625.04s -> 1627.36s] 只是多年以来, [1627.42s -> 1628.58s] 长期以来, [1628.74s -> 1634.14s] 我们更多的关注的是人口过多给我们带来的问题。 [1634.82s -> 1635.88s] 直到最近, [1636.54s -> 1638.96s] 我们慢慢开始关注, [1639.18s -> 1641.76s] 中国人口下降出生率低, [1642.28s -> 1644.16s] 可能会给我们带来的问题。 [1645.56s -> 1647.10s] 好的,到这里, [1647.10s -> 1655.14s] 所以我们这一期播客的前半部分的内容就已经结束了, [1655.14s -> 1657.16s] 我在录的过程中, [1657.46s -> 1659.52s] 就临时决定说, [1659.90s -> 1664.58s] 我会把今天的这个播客分成两个部 分, [1665.18s -> 1667.78s] 我会先发布第一部分的内容, [1668.28s -> 1671.02s] 然后再发布第二部分的内容, [1671.06s -> 1675.72s] 是因为两个部分加在一起实在是太长了, [1675.72s -> 1678.30s] 我估计得有一个小时, [1678.62s -> 1680.58s] 那对于大家来说, [1681.12s -> 1684.72s] 应该很难一次性听完这么多内容, [1685.12s -> 1687.22s] 所以你们可以分开听。 [1688.16s -> 1692.18s] 那我们今天这期播客的内容暂时先到这里, [1692.78s -> 1700.58s] 欢迎大家关注我们马上会发布的这个的下一部分的内容。 [1700.86s -> 1702.18s] 在下一部分当中, [1702.18s -> 1705.16s] 我们会具体的来谈一谈, [1705.18s -> 1706.04s] 在中国, [1706.62s -> 1708.74s] 为什么很多的年轻人, [1708.88s -> 1711.26s] 他们不那么愿意生孩子, [1712.06s -> 1715.66s] 以及这个人口下降的问题, [1716.30s -> 1718.08s] 为什么在我看来, [1718.32s -> 1721.52s] 其实他也不是一个问题, [1721.94s -> 1723.88s] 他可以不是一个问题, [1724.36s -> 1726.92s] 他可以是一件好的事情。 [1727.80s -> 1731.08s] 好,那我们今天暂时先到这, [1731.08s -> 1733.00s] 下期见,拜拜。"
# video_script = " [7.58s -> 15.02s] अजके विडियो सेरीज में जो दियाईपी का जो विडियो सेरीज हैं विस में देखने जारे हैं, हीट और मिस ट्रन्फाम. [15.48s -> 20.60s] तो इसके पहले में दा ाईलेश्य, इरोजन, अपनिं, ख्लोजन इसिं पर विडियो बनाच चुका हूं, [21.78s -> 30.28s] अपनिं अपनिं आपने विडियो नहने देखने हैं, तो सब नेरे लग लोग देखरे और उसके बाग हीट औ र मिस ट्रन्फाम हैं आएगा बनाच नहीं तो आपको विडियो ख्लोग नहीं देखने हैं, [46.26s -> 48.36s] अपनिं आएगा बनाच नहीं तो आपको लग देखने हैं, [76.10s -> 78.34s] तो देखने है, तो हम लोग य यह देखने है, [83.64s -> 85.74s] यह आए खिला़ दोन, [85.74s -> 86.58s] ता होद ा़खने है, [99.52s -> 107.44s] ह foresee it ंहीं, [107.44s -> 108.14s] चारंग, [108.1 14s -> 108.24s] भाशा उस ख़ा, [112.64s -> 138.22s] अपको अपको यह थब आपको यह थब आपको यह आपको यह आपको यह आपको यह आपको यह आपको यह आपको यह आपको यह आपको यह आपको यह आपपको यह आपको यह आपको यह आपको यह आपको यह आपको यह आपको यह आपको यह आपको यह आपको यह आपको यह आ [138.22s -> 148.30s] ममें थब इसेप डर्शट मत्ट्रीकस फोट्डनिरी मह तोऊए रपको ो भगा क तने है सलasti तown�무�e and [152.18s -> 164.44s] उस्र ही नींटलगा है sensea'. [164.44s -> 167.62s] परको building the image that бегa. [167.62s -> 168.20 0s] ःात्टिंचा ऐसे यहँे आपको यह अपको पसे हो तःत्टि में Vo that [168.20s -> 168.20s] [184.14s -> 198.18s] अपने लिए बागी तो बी आपने लिए लिए लिए लिए लिए लिए लिए ल लिए लिए लिए लिए लिए लिए लिए लिए लिए लिए लिए लिए लिए लिए लिए लिए लिए लिए लिए लिए लिए लिए लिए लिए लिए लिए लिए लिए लिए लिए लिए लि� [208.92s -> 220.56s] वल्रे लिए ल लिए लिए लिए लिए लिए लिए लिए लिए लिए लिए लिए लिए [220.56s -> 225.38s] लिए लिए लिए लिए लिए लिए लिए लिए लिए लिए लिए [225.38s -> 228.16s] लिए लोँ स奶 तीया फाल यए ललिए ळीस ठाomie प toss [228.16s -> 252.02s] अगर सबोज में ये ये स्ट्रूटरिंग येलिमेंट येपने लगाताग तो येपने लगाताग तो येपने लगाताग तो येपने लगाताग तो येपने लगाताग तो येपने लगाताग तो येपने लगाताग तो येपने लगाताग तो येपने लगाताग तो येपने [259.02s -> 280.30s] शबबषब 就 to both the points in the page. [280.30s -> 282.00s] तो ो येपने लगात केटिख, ओरि थुन पही धआद्यास, है?? [305.86s -> 311.98s] अप दोड़ मिलजा यह आप यह दोड़ मिलजा यह आप यह आप यह आप यह आप यह आप यह आप यह आप यह आप यह आप यह आप प यह आप यह आप यह आप यह आप यह आप यह आप यह आप यह आप यह आप यह आप यह आप यह आप यह आप यह आप यह आप यह आ� य [318.30s -> 341.96s] बसको डोक इ450 नफ pushed 2 होग कर loses pass Sow za [341.96s -> 343.74s] ये नहीं तब पीचे लिखा है [343.74s -> 345.18s] तो देखो क्या होगें? [345.36s -> 346.84s] ये वि परफार्म न एरोजन [346.84s -> 348. .24s] ये एरोजन भी [377.64s -> 378.22s] बी बी बी बी बी बी बी बी बी बी बी बी बी बी बी बी बी बी बी बी बी बी बी बी बी बी बी बी बी बी बी बी बी बी बी बी बी बी बी बी बी बी बी बी बी बी बी बी बी बी बी बी बी बी बी बी बी बी बी बी बी बी बी बी बी बी बी बी बी बी बी बी बी बी � [378.22s -> 379.78s] इिंटर रहा स्तृरीभ की नैत. [384.30s s -> 390.76s] औरिए बी बी भी बी बी बी बी बी बी बी बी बी बी बी बी बी बी सां非常िक। [390.76s -> 392.90s] एक बी बी बी बी बी बी हमेद करमेंठादा देर् साकते कि लिए hal lfway [401.24s -> 404.52s] सब不過र म resultados of the konnte [407.86s -> 422.88s] ये नब र कर नब छैईकी लेँक बाशा으니까 दो फ़डह कर� [440.06s -> 452.86s] अगर बद द्वाँ बद्वाँ बद्वाँ बद्वाँ बद्वाँ बद्वाँ बद्वाँ बद्वाँ बद्वाँ बद्वाँ बद्वाँ बद्वाँ बद्वाँ बद्वाँ बद्वाँ बद्वाँ बद्वाँ बद्वाँ बद्वाँ बद्वाँ बद्वाँ बद्वा [458.78s -> 464.64s] बद्वाँ बद्वाँ कि बद्वाँ मोग�ENA Pronounce [464.64s -> 465.74s] थो इक तो सेनoton [468.62s -> 479.28s] मेंदोitional प्रापराछळ बरई मैच हो तीब Wahish ha [479.28s -> 482.74s] और अगर चुलहांक मट्�透 सस्मप फ्रसर आपुप । [482.74s -> 482.82s] जर बींक रो साँ यावाega lagin diesi cora [482.82s -> 491.76s] मह्मे के यक आप यावाप करेया। hurricane this will have center will have center. [491.76s -> 495.64s] यैवलाा स्वंटा हाना को्रफताँ अरिय调ंता है कुईस स्त्तीझपाँ कात पाँ थावा in nclusive this is an image of this. [495.64s -> 512.50s] स्सनक्सनक्सनक्सनसंट्चिकनता है। l нап correctiven l that I went for compliment the 有 any compliment anyt thing you want Top compliment correct abdomen [508.74s -> 510.74s] तोFI guilt India [520.58s -> 542.48s] अब आप योंगे तो बी नहीं तो बी नहीं तो बी नहीं तो बी नही ीं तो बी नहीं तो बी नहीं तो बी नहीं तो बी नहीं तो बी नहीं तो बी नहीं तो बी नहीं तो बी नहीं तो बी नहीं तो बी नहीं तो बी नहीं तो बी नहीं तो बी नहीं तो बी नहीं तो ब बी नही [542.48s -> 545.44s] तो बी आपको सहीं फ्ये उत्वित मिलते लका फ्यरे [545.44s -> 546.14s] तो बी अपको सहीं दाना कि इअ भी इप मिल academia [546.14s -> 547.00s] ] टर्वादिए या फ़ी technical [547.00s -> 548.54s] द लिईग और सहीं ता मेही [548.54s -> 555.70s] नहीं एक दोंई और ओर भाके यप मेंगे टीने डीग collections [559.54s -> 5 बजहात condemnult pissinger point [599.22s -> 602.90s] अखर म blijक�shers Yoga [604.54s -> 612.26s] ग़ार �спार्सचंद [614.48s -> 644.46s] अगर अगर अगर अगर अगर अअगर अगर अगर अगर अगर अगर अगर अगर अगर अगर अगर अगर अगर अगर अगर अगर अगर अगर अगर अगर अगर अगर अगर अगर अगर अगर अगर अगर अगर अगर अगर अगर अगर अगर अगर अगर अगर अगर अगर अ� [649.44s -> 653.36s] makers einge of othe [653.36s -> 657.52s] कर हो दोनोंगा काँ् इआगर उँट्गå因为 [664.74s -> 669.14s] सेा ए�eeeeeeeeeee [669.14s -> 672.32s] ल लगबक ना आप दे को। [677.52s -> 699.26s] अपाँ तो लग आप यह तुट आप पर यह देखने कि लोग आप यह विडियो भना सकेंगे [727.62s -> 729.24s] अपको बज़ आप बज़ आप बज़ बज़ बज़ ब ज़ बज़ बज़ बज़ बज़ बज़ बज़ बज़ बज़ बज़ बज़ बज़ बज़ बज़ बज़ बज़ बज़ बज़ बज़ बज़ बज़ बज़ बज़ बज़ बज़ बज़ बज़ बज़ बज़ बज़ बज़ बज़ बज़ बज़ बज़ बज़ बज़ बज़ बज़ बज़ बज़ बज़ बज� [773.00s -> 789.20s] बज़ बज़ बबज़ बज़ बज़ बज़ बज़ बज़ बज़ बज़ बज़ बज़ बज़ बज़ बज़ बज़ बज़ बज़ बज़ बज़ बज़ बज़ बज़ बज़ बज़ बज़ बज़ बज़ बज़ बज़ बज़ बज़ बज़ बज़ बज़ बज़ बज� [792.80s -> 799.38s] बज़ बज़ बज़ बज़ बज़ बज़ बज़ बज़ बज़ बज़ बज़ बज़ बज़ बज़ बज़ बज़ बज़ बज़ बज़ बज़ बज़ बज़ बज़ बज़ बज़ बज़ बज़ बज़ बज़ बज़ बज़ बज़ बज़ बज़ बज़ बज़ बज� [799.36s -> > 799.36s]"
#video_script = "[0.00s -> 5.48s] Today we are going to talk about different types of NLP tasks. In past [5.48s -> 10.04s] videos we have covered some of it but today we will cover more of these tasks [10.04s -> 15.28s] with some technical details. The first one which is a classic task is text [15.28s -> 21.40s] classification. Let me give you one real-life use case. I use a software [21.40s -> 27.28s] called Camtasia Studio to record and to post process my videos. [27.28s -> 36.04s] They have this support forum where you can go and report a bug or an issue with this [36.04s -> 37.04s] software. [37.04s -> 46.36s] Now there are so many complaints coming up and for Camtasia, TechSmith which is a [43.44s -> 49.24s] company behind Camtasia software they [46.36s -> 53.12s] need to prioritize these complaints into [49.24s -> 56.00s] either high or low or you know like [53.12s -> 60.28s] medium severity. Now the way you can do [56.00s -> 62.24s] that is you can maybe look at the text so [60.28s -> 64.68s] let's say this is some example where [62.24s -> 66.96s] you are saying Camtasia 10 won't import [64.68s -> 66.88s] mp4 file. Now it's a pretty bad So let's say this is some example where you are saying camtasia 10 won't [64.32s -> 69.68s] import mp4 file. Now it's a pretty bad [66.88s -> 72.64s] thing so it's a high severity complaint. [69.68s -> 74.80s] You can have a human [72.64s -> 77.12s] looking at this complaint and [74.80s -> 78.64s] manually classifying it but if you have [77.12s -> 81.44s] too many complaints [78.64s -> 83.28s] hiring humans is probably costly and [81.44s -> 84.00s] you can use natural language processing [83.28s -> 86.80s] here. [84.00s -> 90.56s] So what you can do is you can convert [86.80s -> 94.32s] this text into some kind of a vector [90.56s -> 96.48s] and you can use a method such as tf-idf. [94.32s -> 97.68s] Now you'll be like what is this jargon [96.48s -> 100.64s] tf-idf? [97.68s -> 103.20s] I don't like to use jargons that much [100.64s -> 103.92s] but in this video I'm going to throw you [103.20s -> 106.96s] some [103.92s -> 105.16s] throw at you some jargon so that it much but in this video I am going to [102.40s -> 107.76s] throw you some throw at you some [105.16s -> 110.48s] jargon so that it arouses this [107.76s -> 113.12s] curiosity in the mind and in the future [110.48s -> 115.84s] video we will cover technical details of [113.12s -> 119.20s] these jargons. So don't worry about what [115.84s -> 123.40s] is TF-IDF just think it is some way of [119.20s -> 128.68s] converting text into a vector or a set of numbers. [124.28s -> 131.16s] Once you have these numbers representing this [128.68s -> 135.96s] text you can also call these features. [131.16s -> 138.72s] You can then use a classifier such as [135.96s -> 142.32s] naive Bayes classifier to classify the [138.72s -> 145.92s] complaints as high medium or low. Here [142.32s -> 148.16s] this particular complaint [144.08s -> 150.72s] is a high complaint because [148.16s -> 151.76s] you know not being able to import mp4 [150.72s -> 154.48s] file is [151.76s -> 156.00s] a big deal. So then what will happen is [154.48s -> 158.16s] the way [156.00s -> 159.60s] TechSmith guys would have designed the [158.16s -> 162.88s] system is [159.60s -> 164.80s] if the complaint is higher you have [162.88s -> 167.52s] integration with a software [164.80s -> 165.28s] such as Sentry which is basically a the complaint is higher you have [162.84s -> 168.28s] integration with a software such as [165.28s -> 171.76s] Sentry which is basically a monitoring [168.28s -> 175.32s] tool and then that can route a call to your [171.76s -> 178.92s] call center and some customer care [175.32s -> 181.92s] representative can assist you with that [178.92s -> 183.84s] ticket. You can also have a different type [181.92s -> 185.92s] of complaint where you are saying okay I'm [183.84s -> 186.24s] not able to find a video tutorial. Now you can also have a different type of complaint where you are saying okay I'm [183.92s -> 188.80s] not able to find a video tutorial. Now [186.24s -> 190.64s] this is not a high severity complaint. It's [188.80s -> 193.28s] a very low severity. [190.64s -> 195.12s] In this case maybe your workflow will [193.28s -> 197.28s] be to create a jira ticket with [195.12s -> 198.08s] low priority and maybe someone will [197.28s -> 202.00s] look at it [198.08s -> 205.20s] after a week or so. So this is how [202.00s -> 207.12s] big organization [204.40s -> 209.04s] design the system where [207.12s -> 210.16s] just to summarize you have incoming [209.04s -> 213.60s] complaint [210.16s -> 218.24s] you can use some form of [213.60s -> 220.88s] vectorized vectorizer here I'm using tf-idf [218.24s -> 222.16s] and you can convert it to set of numbers [220.88s -> 223.76s] and by the way these numbers don't mean [222.16s -> 225.28s] anything I just put some random [223.76s -> 225.60s] numbers this is just to give you an these numbers don't mean anything I just put some [223.36s -> 228.08s] random numbers this is just to give you [225.60s -> 231.12s] an idea so don't think too much about [228.08s -> 233.44s] why it is 0.12 and 0.5 and so on. [231.12s -> 235.04s] Then you can use classifier if you've [233.44s -> 237.60s] seen my machine learning tutorials you [235.04s -> 239.60s] might know about some classifiers [237.60s -> 242.08s] and these classifiers can actually [239.60s -> 246.08s] classify complain into [242.08s -> 247.04s] one of the categories. [243.84s -> 249.52s] Now you will of course do machine [247.04s -> 251.80s] learning training. You will have lot of your [249.52s -> 254.56s] old complaints which will all already be [251.80s -> 257.32s] marked as high medium or low and using [254.56s -> 260.36s] that label data set you will train this [257.32s -> 263.00s] machine learning model. So this was [260.36s -> 265.16s] first use case of text classification [263.00s -> 265.92s] where you take the complaint and you was first use case of text classification where [263.68s -> 267.60s] you take the complaint and you categorize [265.92s -> 269.68s] it into [267.60s -> 272.48s] one of these three categories. The other [269.68s -> 275.36s] use case is [272.48s -> 277.12s] in healthcare domain you have all these [275.36s -> 278.96s] health documents. [277.12s -> 280.96s] So on the left hand side I have a [278.96s -> 282.80s] prescription which is you know you go to [280.96s -> 283.84s] a doctor they will prescribe you some [282.80s -> 286.48s] medicine. [283.84s -> 286.56s] On the right hand side I have a patient which is you know you go to a doctor they will prescribe you some medicine. [283.84s -> 288.16s] On the right hand side I have a patient [286.56s -> 291.36s] record. [288.16s -> 293.68s] Now these are scan documents which [291.36s -> 295.52s] you know hospitals or doctors [293.68s -> 298.00s] facility would scan it [295.52s -> 299.44s] they would upload it to a cloud [298.00s -> 302.96s] location [299.44s -> 304.48s] and now one of the use cases in [302.96s -> 309.60s] healthcare industry is to classify these documents. [309.60s -> 315.60s] By classification I mean whether it's a prescription or patient medical record. [315.60s -> 319.24s] This staff will have hundreds of such papers. [319.24s -> 324.92s] They will just scan them very fast and put it on a drive and they don't have time to [324.92s -> 325.52s] classify these documents. them very fast and put it on a drive and [323.36s -> 327.76s] they don't have time to classify these [325.52s -> 330.24s] documents and here is where [327.76s -> 332.80s] machine learning system can help you. [330.24s -> 335.20s] So as a first step you can use maybe [332.80s -> 337.92s] Google's OCR [335.20s -> 340.88s] which is Tesseract to convert [337.92s -> 344.16s] image data into text data and then you [340.88s -> 347.28s] you can use an approach like doc2vec [344.16s -> 346.64s] which is document to vector to convert and then you can use an approach like [342.96s -> 350.48s] doc2vec which is document to vector [346.64s -> 352.64s] to convert text into a vector and then [350.48s -> 355.28s] similar approach as the previous one which [352.64s -> 357.60s] is logistic regression classifier [355.28s -> 360.32s] which can tell you whether it's [357.60s -> 363.44s] a prescription or patient medical record. [360.32s -> 365.44s] Again don't worry about doc2vec [363.44s -> 369.54s] or tesseract. I'm just throwing some jargons at you so that you know that we are going to cover all of [369.54s -> 373.32s] these amazing technology in the future. [373.32s -> 377.12s] But you just get an overall idea. [377.12s -> 387.96s] The third use case of text classification is hate speech detection by Facebook. We [385.76s -> 391.60s] all know that Facebook have many groups [387.96s -> 395.00s] which are either racist group or terrorist [391.60s -> 399.40s] groups or generally some people put a lot [395.00s -> 402.36s] of hate speech on Facebook and they [399.40s -> 404.80s] build this classification algorithms [402.36s -> 405.12s] where the [403.24s -> 408.40s] algorithm can read the text and it can [405.12s -> 411.04s] tell you whether this is a hate speech or [408.40s -> 415.64s] not and you can see in the bar chart in [411.04s -> 418.32s] 2020 Q1 they reported more than 8 [415.64s -> 420.48s] million hate speeches. So around this [418.32s -> 423.60s] time they upgraded their algorithm they [420.48s -> 425.20s] made it more smarter and they [422.84s -> 428.80s] benefited from that. So now they can [425.20s -> 433.64s] automatically delete those hate speech [428.80s -> 436.16s] post from Facebook. LinkedIn also have a [433.64s -> 439.40s] similar issue where people make fake [436.16s -> 444.12s] profiles and based on some keywords and [439.40s -> 445.04s] some past knowledge [441.36s -> 448.72s] they build an algorithm using [445.04s -> 450.40s] NLP which can classify a profile as a [448.72s -> 453.28s] fake or not fake [450.40s -> 456.48s] and based on that they can block [453.28s -> 456.48s] that particular profile. [457.60s -> 461.68s] So there there is this article I'm going [459.60s -> 465.36s] to link this article in the [461.68s -> 465.28s] video description [462.40s -> 468.16s] below you can check that. [465.28s -> 469.36s] The second use case is text similarity [468.16s -> 472.56s] so we have seen [469.36s -> 475.84s] in our demo of hugging face where [472.56s -> 477.20s] you can let's say you have this use case of [475.84s -> 480.64s] matching [477.20s -> 482.64s] resume with the given job skill. [480.64s -> 484.48s] Nowadays recruiters get so many [482.64s -> 486.88s] resumes let's say you have one data scientist [484.48s -> 486.64s] position open you get 1000 resume Nowadays, recruiters get so many resume. Let's say you have one data scientist [484.56s -> 489.44s] position open you get 1000 resume. [486.64s -> 492.64s] You might not have time to scan read [489.44s -> 495.88s] through all of them so you can use text [492.64s -> 501.20s] similarity here to figure out which [495.88s -> 504.80s] resume is matching the job position. Let me [501.20s -> 506.72s] just show you. So here in Google I search for [504.80s -> 505.92s] hugging face sentence transformer. If you So let me just show you. So here in [503.72s -> 507.84s] Google I search for hugging face sentence [505.92s -> 512.72s] transformer. If you click on this you will [507.84s -> 517.12s] get this sentence transformer. If you [512.72s -> 521.60s] short by most likes and click on this [517.12s -> 523.56s] one and here see this is doing sentence [521.60s -> 525.84s] similarity. So if you have this that is a [523.56s -> 526.56s] happy person that is a happy dog and if you compute [527.36s -> 530.32s] It will say that is a happy person. That is a happy dog [530.32s -> 537.54s] They are similar, but that is a very happy person is more similar. See point one means exactly same point 93 means [537.70s -> 539.70s] that kind of [540.14s -> 542.14s] similar I [548.12s -> 545.36s] similar. I can say I just ate vada pav. [554.48s -> 548.12s] By the way I am not lying I just ate a [562.28s -> 554.48s] big cheese vada pav. So now it's doing the [569.84s -> 565.84s] sentence similarity. You can see that sentence is not very [571.68s -> 569.84s] similar to this. Well in a way it is [575.72s -> 571.68s] similar because if you ate vada pav you [582.04s -> 575.72s] will be very happy person. I can say I [584.60s -> 591.00s] love eating. I'm just experimenting. So see now when I [587.68s -> 593.44s] do this I just ate what up has the [591.00s -> 596.92s] maximum similarity because it's about [593.44s -> 600.56s] eating. Okay so this sentence transformers [596.92s -> 603.20s] can find out these similarities. There is [600.56s -> 605.28s] also this resume screener that I want [603.20s -> 609.12s] to show you. so if you right [604.32s -> 612.84s] click here and see this is matching a [609.12s -> 617.40s] resume with the job description. So let [612.84s -> 621.36s] me open one resume. So I have this [617.40s -> 626.56s] particular resume here and you can [621.36s -> 628.16s] see okay this is a data [624.88s -> 632.64s] scientist resume. Okay so their work [628.16s -> 636.52s] experience and so on and I have a job [632.64s -> 639.68s] description for a data scientist job. So [636.52s -> 639.68s] if I [639.68s -> 646.16s] open that. Okay so this job description [644.40s -> 646.20s] looks something like this where they open that. Okay so this job description [644.44s -> 648.88s] looks something like this where they [646.20s -> 650.60s] need data scientists with all this [648.88s -> 655.92s] particular skills and all this [650.60s -> 659.92s] qualification. Now let us try our [655.92s -> 663.04s] resume screener. So here I am going to [659.92s -> 670.16s] upload that particular resume and here I am going to upload [664.72s -> 673.92s] the job description and when I say submit [670.16s -> 677.44s] it said 47 percent similarity. See? [673.92s -> 679.92s] So there are these are sophisticated [677.44s -> 681.04s] tools that can compare a job description [679.92s -> 683.92s] with your resume. [681.04s -> 686.00s] So now if you are a recruiter HR person [683.92s -> 686.08s] you have a recruiter HR person [684.00s -> 688.16s] you have a job position open for one [686.08s -> 690.56s] position you got 100 resume [688.16s -> 691.44s] you can just simply use this tool and [690.56s -> 693.76s] this tool [691.44s -> 695.44s] you can say okay if it is more than 50 [693.76s -> 698.88s] match then only [695.44s -> 701.92s] select the resume for phone interview [698.88s -> 714.52s] so it saves you a lot of time and afford. The way this [712.60s -> 717.00s] works is you have a job description [714.52s -> 720.28s] which is a bunch of text and resume [717.00s -> 722.52s] using sentence encoder you convert [720.28s -> 725.88s] text into a vector. So far you have seen [722.52s -> 725.52s] this common method where pretty much for text into a vector. So so far you have [722.40s -> 728.56s] seen this common method where pretty [725.52s -> 732.52s] much for any NLP task first thing that [728.56s -> 734.76s] you do is convert the text into vector. I [732.52s -> 737.20s] mean you do pre-processing and all of [734.76s -> 739.92s] that but I'm saying first thing that you [737.20s -> 742.92s] do before feeding your data to [739.92s -> 745.80s] machine learning model is converting [742.92s -> 745.12s] into it into a vector and we will cover sentence encoder and all that in the machine learning model is [745.12s -> 749.12s] "
time_stamps, preprocessed_script = sep(video_script)
genai.configure(api_key=GOOGLE_API_KEY)
model = genai.GenerativeModel('gemini-pro')
# get the segment length
script_word_count = count_words(preprocessed_script)
if script_word_count <= 500:
segment_length = script_word_count
elif script_word_count >= 5000:
segment_length = 1500
else:
segment_length = 500
start = 0
end = 0
temp_str = ""
count = 0
global_count = 0
chat = model.start_chat(history=[])
list_of_answers = []
for idx, sentence in enumerate(preprocessed_script):
temp_str+= " " + sentence
count += len(sentence.split(' '))
global_count += len(sentence.split(' '))
if count == 0:
first, second = extract_numbers(time_stamps[idx])
start = first
if count >= segment_length or global_count == script_word_count:
first, second = extract_numbers(time_stamps[idx])
end = second
# call model
# print(f"Seconds {sec_to_min(start)} to {sec_to_min(end)}:")
try:
response = chat.send_message(
"segment this preprocessed_transcript by topics and give a summary for each segment. no need to provide the segment text, summarization is enough, give summary in the same language as the input, here's the preprocessed_transcript: " + temp_str)
list_of_answers.append(response.text)
# print(response.text)
except BlockedPromptException:
print("Skipping segment due to BlockedPromptException.")
list_of_answers.append("segment has been skipped")
except Exception as e:
time.sleep(1)
response = chat.send_message(
"segment this preprocessed_transcript by topics and give a summary for each segment. no need to provide the segment text, summarization is enough, give summary in the same language as the input, here's the preprocessed_transcript: " + temp_str)
list_of_answers.append(response.text)
# print(response.text)
# resetting params
segment_dict[f"{sec_to_min(start)} to {sec_to_min(end)}"] = response.text
summary += f"{sec_to_min(start)} to {sec_to_min(end)}\n\n" + response.text + "\n\n\n"
temp_str = ""
count = 0
start = end
#print(f"{list_of_answers=}")
#print("_" * 20)
temp_str = ""
start = end
# Convert list of segment dictionaries to JSON
output_json = json.dumps(segment_dict, indent=4)
# Save JSON to a file
with open('output.json', 'w') as json_file:
json_file.write(output_json)
print("JSON file saved successfully!")
#print(response.text)
print(summary)
return summary
if __name__ =="__main__":
summarize_video("https://www.youtube.com/watch?v=In7jB8TUGPA",'AIzaSyCGVRysglCGzJF1JXKspXtxaE7u5aIPPHw')