class_docstr: ABC for Language Models.
  
  Cannot be directly instantiated itself.
docstr: Calculates the perplexity of the given text.
  
  This is simply 2 ** cross-entropy for the text, so the arguments are the same.
docstr_tok: ["Calculates","the","perplexity","of","the","given","text",".","This","is","simply","2","*","*","cross-entropy","for","the","text",",","so","the","arguments","are","the","same","."]
code: def perplexity(self, text_ngrams):
      """Calculates the perplexity of the given text.
  
      This is simply 2 ** cross-entropy for the text, so the arguments are the same.
  
      """
      return pow(2.0, self.entropy(text_ngrams))
  
imports: import random
  import warnings
  from abc import ABCMeta, abstractmethod
  from bisect import bisect
  from itertools import accumulate
  from nltk.lm.counter import NgramCounter
  from nltk.lm.util import log_base2
  from nltk.lm.vocabulary import Vocabulary
label_desc: Use image node_id 8 for calling the LanguageModel obj's underlying member method code with example usage: obj.perplexity(text_ngrams) and returns: pow