code: def ngram_perplexity(eval_details, logbase=10.0):
      """
      Computes perplexity from a list of individual sentence evaluations.
  
      Arguments
      ---------
      eval_details : list
          List of individual sentence evaluations. As returned by
          `ngram_evaluation_details`
      logbase : float
          The logarithm base to use.
  
      Returns
      -------
      float
          The computed perplexity.
  
      Example
      -------
      >>> eval_details = [
      ...     collections.Counter(neglogprob=5, num_tokens=5),
      ...     collections.Counter(neglogprob=15, num_tokens=15)]
      >>> ngram_perplexity(eval_details)
      10.0
  
      """
      counter = sum(eval_details, collections.Counter())
      exponent = counter["neglogprob"] / counter["num_tokens"]
      perplexity = logbase**exponent
      return perplexity
  
imports: import collections
label_desc: Use image node_id 2 for calling a global function with example usage: ngram_perplexity(eval_details, logbase) and returns: perplexity