Hey, everyone, and welcome back to this class natural language processing in Python.
In this section of the course, we are going to look at a very unique project, one that you don't normally
see in natural language processing.
This project will teach you about multiple important NLP topics such as probabilistic modeling and genetic
algorithms.
The problem we're going to solve is that of decrypting coded messages or ciphers.
Ciphers are very interesting because they are immediately applicable in the real world.
For example, in warfare and espionage.
In this lecture, we're going to outline what we will cover in the rest of this section.
First, we're going to look at what is a cipher in the first place.
This is the code that will allow us to encrypt our message.
We'll do an example to see how we can encode and decode a message.
Next, we'll look at language modeling.
Here will build a probabilistic model of the English language.
This allows us to ask questions like What is the probability of this sentence in more advanced sections
and courses?
You'll see how such language models can be used to generate new sentences.
For example, you can generate poetry or do something like article spinning.
Next, we'll look at the algorithm we're going to use to find the encryption code, which is called
the genetic algorithm or an evolutionary algorithm.
It's an algorithm that's based on the principles of genetic evolution.
While that may sound complicated, it's actually nice because it's pretty intuitive and it doesn't involve
any complicated math like some other machine learning algorithms do.
So these are the three main concepts we need that all come together to form our solution to this problem.
Number one, we have to understand a basic cipher and how to implement that in code.
Number two, we have to understand probabilistic language models.
And number three, we have to understand that genetic algorithms, which is what will allow our prediction
of the encryption code to evolve and match our model of the English language.
In other words, our translated message should have the highest likelihood since it is assumed to be
in real English.
Any other translation, meaning one that does not match the English language, should not have as high
a likelihood.
So this is a maximum likelihood problem.
Once we've discussed all the theory we need for this section, we'll go ahead and implement everything
in code.
The code will be split up into multiple parts and I would recommend that you code as much of it as possible
by yourself at every step of the way.
I want you to ask yourself, can I finish this code without watching the rest of the videos?
I hope that the answer is yes as soon as possible.
Ideally, you would be able to code the entire thing yourself, or at least attempt to without looking
at any of my code first.
That's always the ideal approach in these courses.
You'll also notice that this section follows the basic pattern I talked about earlier, going from theory
to code in that order.
So first, we discuss the theory and concepts behind our solution.
Then we implement that theory in code only.
The theory part contains new information.
The coding part does not contain any new information and only serves to be an example of how to translate
that theory into an actual computer program.
I want to make a note that this section is entirely optional.
Let me explain why.
First, I think that this example will be more challenging than the rest of the examples in this course.
A few students have told me they wanted a few more challenging examples, even though I originally designed
this course for beginners.
So this is a nice, challenging example for you to go through.
I also think this is a nice example because it doesn't require specialized knowledge of machine learning,
whereas the rest of this course kind of does.
In this example, it requires knowledge of programming and probability and statistics, but it doesn't
require you to understand an algorithm like naive Bayes or decision trees or a.
Therefore, while this example will require you to work hard, it won't require specialized knowledge
of machine learning.
So it's not challenging because it requires all new theory.
It's just challenging due to the fact that it's a lot of work to put all the pieces together.
Since it's optional, you can feel free to skip this section for now and come back to a later.