How to use BERT for identify words unrelated to the content of a sentence and replace them with suitable words?

For this question we can see below example:

A: Jack continues to pray well. B: Jack continues to play well.

In the first sentence, the word “pray” is written in a typographical error and the word “play” should have been written instead. 1- How can we recognize such words in a sentence? 2- How can we replace these recognized words with suitable words.(If we can consider a factor that the proposed word can be written similar to the word in the first sentence, the result will probably be more accurate.)

We also have this challenge in Farsi(Persian) language, which I will explain below in an example:

A: قیمت بابا میرود. B: قیمت بالا میرود.

In the example above, the word “father (بابا)” is written incorrectly, and the intended word was the word “َup (بالا)”. In Persian, the first sentence has no meaning, but the second sentence is completely meaningful and understandable.

Do you have any solution or guide that I can solve this issue using the BERT language model?

We can use the [Mask] feature to predict the replacement word for a word that is written incorrectly, but I have no idea how to determine whether a word is written incorrectly or not in terms of the meaning of the whole sentence.