1
00:00:00,090 --> 00:00:08,640
In this video, you will learn how to extract text from an audio, so from audio format to text format,

2
00:00:08,820 --> 00:00:17,070
the audio file that we will be using for this example is that this one in here September 11th, 1973

3
00:00:17,130 --> 00:00:23,550
A military coup overthrows the government in Chile, ending the longest democracy, etc. So what we're

4
00:00:23,550 --> 00:00:26,250
doing is basically speech recognition.

5
00:00:26,610 --> 00:00:34,610
And for this, we will be using the Speech Recognition Library.

6
00:00:34,620 --> 00:00:42,780
It's a third party Python library, and the central object of speech recognition is to recognize it.

7
00:00:45,600 --> 00:00:54,960
So recognize there is a class that allows us to create a recognizer instance.

8
00:00:55,350 --> 00:01:02,700
Once we have a recognized object instance, we need to use a with context manager for this and we need

9
00:01:02,700 --> 00:01:07,980
to create an audio file using the audio file class.

10
00:01:07,980 --> 00:01:11,700
So all the file is something that we need to import from speech recognition.

11
00:01:14,070 --> 00:01:21,150
So together with recogniser, we have all the files the audio file gets as inputs.

12
00:01:21,180 --> 00:01:21,930
Guess what?

13
00:01:23,430 --> 00:01:26,040
The actual audio file on disk.

14
00:01:26,070 --> 00:01:32,370
So the file path of that with audio file as audio file.

15
00:01:33,170 --> 00:01:37,980
This is just a variable, and then we use that variable for further here.

16
00:01:37,980 --> 00:01:41,760
But first we create another variable, which is this old you.

17
00:01:42,510 --> 00:01:48,270
And in this variable, so we need to grab that audio from the audio file.

18
00:01:48,660 --> 00:01:50,430
This is the actual audio file.

19
00:01:50,820 --> 00:01:52,170
This will be the audio.

20
00:01:52,200 --> 00:01:55,680
So to fetch the audio, we need to use the recognizer

21
00:01:58,650 --> 00:02:03,360
and the records methods of a recognized object type.

22
00:02:04,350 --> 00:02:14,130
The recording method now gets that audio file as input, so we record the audio of that audio file.

23
00:02:14,850 --> 00:02:15,990
That's the idea here.

24
00:02:16,450 --> 00:02:22,140
When you exit that with bloque and you create another variable.

25
00:02:22,170 --> 00:02:29,280
So let's say a text that is equal to recognize if that's a very nice Google.

26
00:02:29,520 --> 00:02:36,420
So there are various methods that's a recognizer object instance has, and the one we're using is to

27
00:02:36,420 --> 00:02:42,540
recognize Google, which is tied to the Google Speech recognition API.

28
00:02:42,840 --> 00:02:45,540
Other methods use other APIs.

29
00:02:45,540 --> 00:02:49,410
Some of them needed to create an account and have an API key.

30
00:02:49,410 --> 00:02:54,390
But Google does not, so this is the easiest one to use recognized Google.

31
00:02:54,390 --> 00:02:56,400
And guess what we need to input here.

32
00:02:56,910 --> 00:03:00,330
So we need to recognize from audio.

33
00:03:01,110 --> 00:03:01,680
That's one.

34
00:03:02,640 --> 00:03:07,200
And lastly, all we have left to do is print all the text.

35
00:03:07,590 --> 00:03:10,290
So Tex will be a strong data type.

36
00:03:10,800 --> 00:03:11,280
So run.

37
00:03:12,410 --> 00:03:17,330
Make sure speech recognition is installed, yeah, that's the case in my rifle and room.

38
00:03:19,920 --> 00:03:21,630
And that's the output.

39
00:03:22,050 --> 00:03:25,680
So September 11th, 1973 Military Corp.

40
00:03:26,370 --> 00:03:30,360
Let's compare it, I don't expect that to be 100 percent accurate.

41
00:03:30,360 --> 00:03:36,120
So September 11th, 1973 a military coup overthrows the government in Chile.

42
00:03:36,180 --> 00:03:37,350
Quite good, actually.

43
00:03:37,920 --> 00:03:41,380
Well, in Latin America, some errors are bloody, bloody awful.

44
00:03:41,640 --> 00:03:46,560
Chileans who lived through the coup and years of repression reflect on its meaning for us today.

45
00:03:47,220 --> 00:03:54,180
So this is a bit challenging for the algorithm because it does have some music and some other songs

46
00:03:54,180 --> 00:03:55,110
on the background.

47
00:03:55,350 --> 00:04:01,920
But still, I think it's doing a good job and that is how you do speech recognition in by from the basics.

48
00:04:02,130 --> 00:04:07,320
But we will have some interesting apps using speech recognition later on.

49
00:04:07,410 --> 00:04:09,880
So stay tuned and I'll see you in the next videos.

