First understand that what is the meaning of the perplexity formula Perplexity = P(w1,w2,…,wN)−1 N P e r p l e x i t y = P (w 1, w 2,…, w N) − 1 N Where N N is the number of words in the testing corpus. Assume that you have developed a language model, where each word has some probability of occurring.
https://stats.stackexchange.com/questions/242847/perplexity-of-the-following-example

