class_docstr: Bleu Evaluator. Now, we support metrics `'bleu'`
      
class_docstr_tok: ["Bleu","Evaluator",".","Now",",","we","support","metrics","`","'bleu","'","`"]
code: def __init__(self, config):
      super(BleuEvaluator, self).__init__(config)
      self.bleu_type = config["bleu_type"]
      self.max_ngrams = config["bleu_max_ngrams"]
      self.ngrams = [
          "bleu-{}".format(n) for n in range(1, self.max_ngrams + 1)
      ]
      self.smoothing_function = config["smoothing_function"]
      self.corpus_bleu = config["corpus_bleu"]
      self.sacrebleu_romanian = self.config["sacrebleu_romanian"]
      if (
          self.bleu_type == "nltk"
          and self.smoothing_function > 0
          and config["dataset"] in ["pc", "dd"]
      ):
          nltk_version = version.parse(nltk.__version__)
          if nltk_version != version.parse("3.5"):
              warnings.warn(
                  "The version of `NLTK` should be 3.5 to reproduce results."
              )
      self._generate_weights()
  
file_path: TextBox/textbox/evaluator/bleu_evaluator.py
imports: import os
  import subprocess
  import nltk
  import tempfile
  import warnings
  import traceback
  from itertools import zip_longest
  from packaging import version
  from .abstract_evaluator import AbstractEvaluator
label_desc: Use image node_id 1 to create a new BleuEvaluator object from inherited base classes: AbstractEvaluator with example: obj = BleuEvaluator(config)