So now let's see, implementing the dictionary file.
Let us return to our English Dot Birame and set up the dictionary file here.
Now the dictionary defines search on the user's hard drive, but unless we load the text in this file
as a string value of a python code, can't use it.
OK.
Hence, we have created this lord, the helper function to do this.
OK, so here we are seeing the dictionary file.
SDR is equal to open in this in quotation marks.
We have given dictionary.
Then we have created English words, SDR as a blank dictionary.
So first we get the dictionary file object by calling the open method and passing the string of the
filename dictionary, not the.
Then we named the dictionary variable English word is the answer to to an empty dictionary initially
now will store all the votes in the dictionary file.
That is a file that stored the English dictionary value.
The Python data or the similar names are unfortunate, but the two are completely different.
So dictionary still is different than English.
Orestiada is totally different right now.
Even though we would have used a list to store the string values of each word in the dictionary file,
we are using a dictionary instead because the interpreter volks faster on dictionaries, then normal
list.
OK, now next we will learn about the split string method which will be used in our OR to split our
dictionary file into substring.
So let us understand the split matter first.
Now the split string method takes one string and returns a list of several strings by splitting the
past string at each space.
Now gives you an example for this.
We will go forward to the interactive shell and try to split some votes and get the output.
So let's go back to interactive shall here and we will type see.
This is python hacking, intermediate level goes OK and dot and then we use a split method of it, OK?
Now it has at every word after the space.
Right.
So this is the oldest of a string that we have got here.
Now it is one string for each of the wall in the original string spaces are dropped from the items in
the list, even if there is more than one space.
If you have given, you can just pass an optional argument or split to split it on a different string
other than a space.
OK, now, for example, if we try to enter something like, say, this is or this, then we separate
it with A is C Biton hacking intermediate level course.
OK, and again, here we see split, but this time we give eight in the bracket.
So now with the splitting, wherever it is finding it, that is a separate word for it.
OK, this is how we have used this for another way in which you can split it.
So notice that the string doesn't have any spaces on this using a split and passing double it split
the original string wherever it occurs, resulting in the list of again, seven different part of the
string.
OK, now using the splitting the dictionary file into individual words.
So let us return to our code that we have created here, OK, and where we have used the split function
here for everyone in the dictionary file Estado three dot split on a new line.
OK, so let's break down the particular code.
The dictionary file is still variable that stored the file object of the open file.
We are using that really matter which calls, read the entire file and returns it as a large string
value.
We then call the split method on this long string and split it on a new line character because dictionary
file that we have has one word borderline.
So splitting on a new line character returns a list of values made up of each word in the dictionary.
Right now they use a for loop at the beginning of the line, which I tripped over each word of the store,
one each in a key, but don't need values associated with the key since we are using dictionary database.
So we'll just store the non-value for each.
Hence, we have stories non-value for every key now.
None is a type of value that you can assign to a variable to represent the lack of a value, whereas
the boolean data depends on little values.
None type has only one value, that is.
It's always returned without goods and with a capital end like we have written here.
OK, so for example, you say you had a variable named C answer which holds a user answer to a true
or false pop quiz question.
And if the user skips a question and doesn't answer it, it makes the most sense to assign the answer
variable to none as a default value rather than true or false.
Otherwise, it might look like the user answered the question when they did so.
Likewise, we have the function calls that exist by reaching the end of the function and not from the
return statement which evaluate to null because they don't return anything.
OK, so over here, the word that is being traded over Azuki in the English word restaurant stoltmann
as a value for that particular key.
We have gone inside for loop now coming to returning the dictionary better now after default finishes
the English word astar dictionary should have different types of or whatever votes you are having as
the key in it.
OK, so at this point we close the file object by saying dictionary file is still not close because
we are done reading it and then return the value of the English word SDR from the function.
OK, we then call basically our Lord and store the dictionary value.
It returns in a variable that is named English Word Asgeir, which is also a constant.
So we want to call the Lord before the rest of the code in the English module.
But Python must execute the statement for Lord the Rockets.
So before we call the function.
This is the reason we have assignment for the word English.
Forestier comes after the law dictionary function has been written the first we have defined the function
and then we are storing that value of the function in the given constant.
Now let's move on to counting the number of English words in the message so we go ahead with the next
definition.
That is get English word, count, method, definition.
So here we have written the program code that defines the good English count, but English word count
function, which takes a string argument and returns a flow to value, indicating the ratio of recognized
English words to total of the votes now will represent the racialize of value between zero point zero
and one point zero.
Now, nowhere a value of zero point zero means none of the words in English or in the message string
are English words, and 1.0 means all of the words in the past parameter are English words.
So most likely to get the English word count will return of value between zero point zero and one point
zero.
And the IS English function uses this return value to determine whether to evaluate it as true or false.
OK, so when we use this, we created, as I suggested, is equal to start up.
Then we have removed the noun letters which we have created below and then possible.
What a start.
We get messages.
Gardot split.