 Hey everyone, welcome back to some more Python programming still looking at the pie and shant module just in chance when we actually import the module and Last video we were looking at how we can install the module first of all super easy on Linux just pip install and then Creating and using dictionary objects. We may have got into creating in the last tutorial I got I had idle open up We were looking at different dictionaries that we could use and now we'll actually go ahead and use them So this function check when we've got our dictionary object. We'll actually test if a word is in that dictionary So if I were to D dot check if I can check for the word Python It is in there now if I check for the word pie PY referring to Python false That's not a word. Okay, so what else can we do with it another another function? They mentioned over here is a D dot suggest and what that will do is it will actually Get a suggestions for a misspelled word like if you were typing in Google or something and you realize it Google realize you had a typo it'll try and recommend is this what you meant this kind of has a similar functionality So if I do a D dot suggest for the word pie or PY for Python It'll say oh PT. Did you mean PY or spy or pay pry ply lots of these other? Suggestions that it might have you might have meant and it'll just try and guess there So other functions that I want to show off in this quick and easy tutorial are add remove add to session Store replacement and a bunch of other stuff So once a correction is made to a misspelled word It's often useful to store this correction in some way for later use now The dictionary objects provide several methods to be able to do this so add it'll store Unrecognized word in the user's personal dictionary so it is recognized as correct correct in the future So if I were to D dot add You can see it adds a word to the user's personal word list if I say pie Cool. Nothing is returned to us, but now if I check Does pie exist? Oh, yeah, it totally does of course. No worries. You're not insane. Don't worry about it Now if I were to remove that of course, it'll store that word and it's personal exclude list So that is identified as an error in the future like D dot remove pie now if I D dot check pi Hey, it's gone. Now. It's saying that this stores a recognized word in the user's personal Exclude list so if we had a word that oh, yeah, we obviously know exists like Subscribe and if we remove that now if I check That No, it doesn't it doesn't exist Now if I try and remove it again We still don't get any errors So that works just fine for us It doesn't matter when or how many times you actually remove a word as long as it's out of the list That's okay now. Here's an interesting thing. What if I restart what if I control f6 my python shell import and chance and Let's say take a look here D is going to equal our Enchant dot dict object not going to supply a tag. I can check does our subscribe word exist I know it does not How about pie? We actually okay, did we did we remove that one? Yeah, we did remove pie. So I'll do that one more time D dot add Pie So we're gonna visualize it Now pie does exist in the dictionary and if I restart do it all over again D dot check Pie it still exists Normally it wouldn't have existed. How do we not add it to the dictionary? But since it's part of my users include words list or personal word list now. It's okay. Cool So this is an interesting thing Because add and remove are kind of permanent in that dictionary object in that dictionary Add to session This one is only a temporary thing so we can store and unrecognize words that will be recognized as correct While this dictionary object is still in use so during this session While we are working with enchant in the dictionary at this time. So let's D dot remove our pie word Now of course D dot check it's not there, but if I D add to session pie D dot check does pie exist Yes, it does now if I restart do it all over again import enchant magic goodness beautiful magnificent gorgeous D enchant dicks Sorry All right, and then now if we check Does pie exist? It'll tell me no because Pie when we added it we only added it to that last previous session So now when we go back to our dictionary, it still does not exist What did we do a subscribe how a subscribe do to subscribe school exist? No, it doesn't let's add it back in because I know that is obviously a real word All right cool And here's another function store replacement note that one word was used to replace another Meaning that will be a peer hire in the list of suggestions in the future. Okay, so that works with our suggest function Again, if you have any misspelled words, it'll return a Possible option for what you could have meant it'll try and guess. What did you really mean to type in here? Okay, I think there's another one. I'll actually yeah, there is of course a remove from session I'm surprised I didn't include that in the documentation here, but Since we added Let's add to session pie D dot check for sorry Now pie does exist in this session only temporarily But of course we can remove it if we want to with our remove session And now it's gone. Okay, so super simple super easy Really the core functions that you want to be using here our check to see if you actually have a word in the dictionary So this is kind of interesting for if you're trying to check for real English words like obviously this is not a real English word, but something like Apple Maybe or something like a pole may not be you may have had a typo you may have Incorrectly done through your spell track stuff. So, okay That's all that I really wanted to show you in this tutorial simple functions for checking if you've got a word and you're in your English language dictionary Suggesting other suggestions and then adding words to sessions and stuff like that. So thank you guys for watching Hope you enjoyed this you're probably already at the core of this language of this module Sorry, so you don't have to do a whole lot more the rest of the learning is just for interesting stuff And what more can you do with this module? But I think check and suggest are probably the most Probably most useful functions that this that this module will allow and give to you Thanks again for watching though. I'll see you later