1
00:00:00,030 --> 00:00:04,770
Hey! Hi again! In the previous video I did
a demonstration of the program so that

2
00:00:04,770 --> 00:00:10,530
you know how the program looks like and
what is the output that the program

3
00:00:10,530 --> 00:00:14,730
generates, and also the interface of the
program which is a command line

4
00:00:14,730 --> 00:00:20,039
interface. So you input the data through
the interfaces, the user inputs the

5
00:00:20,039 --> 00:00:25,769
data through the command line interface
and you get the output again from the

6
00:00:25,769 --> 00:00:32,250
command line. Now I have created a folder
here somewhere and I have given it a name.

7
00:00:32,250 --> 00:00:36,480
You can give it any name that you want.
And inside this folder I'll be putting

8
00:00:36,480 --> 00:00:42,450
all the files of this project so we're
talking about the data files like data

9
00:00:42,450 --> 00:00:47,460
dot JSON, this is a file that contains
the vocabulary where the program will

10
00:00:47,460 --> 00:00:53,969
extract, so will ask for a word and
this file has the definition of that

11
00:00:53,969 --> 00:01:00,239
word. And also the dot py files will be
put in here. So we know the output. Now we

12
00:01:00,239 --> 00:01:04,949
need to figure out the way how to go
to that output and we will take the

13
00:01:04,949 --> 00:01:10,170
approach step by step which means that
first we're going to develop a simple

14
00:01:10,170 --> 00:01:16,020
version of the program, you know just
like give the program a word and the

15
00:01:16,020 --> 00:01:21,990
problem will return the definition of
that word. But this will be very simple

16
00:01:21,990 --> 00:01:27,560
because you know the users sometimes they
may pass a word that doesn't exist and

17
00:01:27,560 --> 00:01:34,829
as a programmer you need to count for
that word, for that not existing word so

18
00:01:34,829 --> 00:01:39,000
instead of breaking, interrupting the
program, showing an error to

19
00:01:39,000 --> 00:01:44,130
the user, you need to show a more
user-friendly message to the user. And we

20
00:01:44,130 --> 00:01:48,000
will do that in the next videos but for
now the very first thing we need to

21
00:01:48,000 --> 00:01:55,170
think about is the data, so I did some
research on the web and I found this

22
00:01:55,170 --> 00:02:03,060
data set of words and definitions. Now
this is around five megabytes of data so

23
00:02:03,060 --> 00:02:08,429
in Atom if it takes a while to open so I
clicked it and I`m still waiting for it to

24
00:02:08,429 --> 00:02:13,500
open. Now it opened, so if you if your Atom
freezes, then you can open this with

25
00:02:13,500 --> 00:02:21,690
more lightweight editor such as Notepad,
or Nano on Mac, or Vim. So anyway this is

26
00:02:21,690 --> 00:02:28,560
a dot JSON file. So what is JSON? JSON is like
a language. some say it's not a

27
00:02:28,560 --> 00:02:35,250
language, is just a set of rules how to
format some data. So JSON follows this

28
00:02:35,250 --> 00:02:42,600
format. It starts with a curly bracket
and then all we have is pairs of keys

29
00:02:42,600 --> 00:02:49,860
and values. So this is like a Python
dictionary, so the key is separated by the

30
00:02:49,860 --> 00:02:56,430
value by a colon. In this particular
case our values are inside square

31
00:02:56,430 --> 00:03:03,209
brackets which suggests that sometimes
you know you may have more than one item

32
00:03:03,209 --> 00:03:13,190
inside the brackets. For instance let me
search for the word ctrl F or command F

33
00:03:13,190 --> 00:03:21,150
rain so that will take us in here.
First let me go to view and Toggle

34
00:03:21,150 --> 00:03:29,610
Soft Wrap. So what that will do is it
will fit the text inside my screen so

35
00:03:29,610 --> 00:03:36,780
at the moment you see precipitation is
outside of the screen bounds, so this

36
00:03:36,780 --> 00:03:41,550
also takes a while because we have
quite a lot of data here. Now the data

37
00:03:41,550 --> 00:03:48,560
looks better so let me search for rain
again. Find and so this is the key rain.

38
00:03:48,560 --> 00:03:55,530
Let's say the word rain and this is the
definition of rain. In this case we have

39
00:03:55,530 --> 00:03:58,769
two definitions because you know for
some words you may have more than one

40
00:03:58,769 --> 00:04:03,850
meaning.
Or you have more than one form for

41
00:04:03,850 --> 00:04:10,270
instance. This is the noun, rain as a
noun so it's a precipitation and this is

42
00:04:10,270 --> 00:04:15,220
the verb for rain.
So when it rains to fall from the clouds

43
00:04:15,220 --> 00:04:22,080
in drops of water. So it's a verb and a
noun and they are separated by a comma.

44
00:04:22,080 --> 00:04:28,420
So this is just like a Python dictionary
And now we need to figure out how to

45
00:04:28,420 --> 00:04:34,720
load this data into Python because you
know to access data from this file you

46
00:04:34,720 --> 00:04:40,330
first need to load it into Python as
a specific Python data type and then

47
00:04:40,330 --> 00:04:44,980
you access data from that data type. So
think for a moment what Python data type

48
00:04:44,980 --> 00:04:50,680
would be more appropriate for this JSON
file. So think about that and I'll show

49
00:04:50,680 --> 00:04:54,000
just that in the next lecture.
See you there!

