1
00:00:01,790 --> 00:00:08,069
Great, we have this program now that
returns a value from a word that we put,

2
00:00:08,069 --> 00:00:12,870
so it returns the definition of that
word and it also counts for non existing

3
00:00:12,870 --> 00:00:21,930
words in our dataset which is data.json.
To count for different cases of

4
00:00:21,930 --> 00:00:35,130
letters that these are my input you may
look at the dir(stsr)should show you the

5
00:00:35,130 --> 00:00:42,690
methods that you can apply to a string.
Here there's the lower method. What

6
00:00:42,690 --> 00:00:49,739
that does is you know if you put
rain there� So the method should be applied

7
00:00:49,739 --> 00:00:56,520
with brackets. You get to rain so the
lowercase version of the letter so since

8
00:00:56,520 --> 00:01:04,439
our data are only in lowercase in our
data dot JSON file, then what you do is

9
00:01:04,439 --> 00:01:11,820
as soon as you get the input here, the
string you can convert it to lowercase

10
00:01:11,820 --> 00:01:18,570
and then you pass that version to the
dictionary access expression in here. So

11
00:01:18,570 --> 00:01:26,490
that would be something like you know W
equals to W dot lower. So we are updating

12
00:01:26,490 --> 00:01:31,710
the W value here, the string that user
inputs and the W here will be

13
00:01:31,710 --> 00:01:46,140
passed as a lowercase. So as easy as that.
Let me do a quick test. Rain and you

14
00:01:46,140 --> 00:01:53,549
get the correct definition of rain so
let's think about more

15
00:01:53,549 --> 00:01:59,510
possible values that the user my input.
Let me

16
00:01:59,510 --> 00:02:08,500
clear the command line so you see better.
Let me call the program again. Weather.

17
00:02:08,500 --> 00:02:20,240
Works fine, but how about how about
instead of putting rain the user types

18
00:02:20,240 --> 00:02:26,030
in an extra N there and the program
says the word doesn't exist which is

19
00:02:26,030 --> 00:02:32,540
true, but as a programmer you want to
make your program as more intelligent as

20
00:02:32,540 --> 00:02:39,290
you can, so in that case you may want to
consider checking for strings that

21
00:02:39,290 --> 00:02:44,600
are similar to what the user input, you
know rain, you need to check if there is

22
00:02:44,600 --> 00:02:49,940
a string and that is similar to
this word and instead of saying the word

23
00:02:49,940 --> 00:02:55,280
doesn't exist you want to suggest the user
that oh well maybe you meant this word.

24
00:02:55,280 --> 00:03:01,220
You know, similarly as you do a
search on Google. So that's a bit

25
00:03:01,220 --> 00:03:05,570
complex, but not that much and I'll show
you how to implement that in the next

26
00:03:05,570 --> 00:03:10,000
lecture step-by-step. So see you there!

