code: def _moses_bleu(
      multi_bleu_script, tgt_test, trans_file, subword_option=None
  ):
      """Compute BLEU scores using Moses multi-bleu.perl script."""
  
      # TODO(thangluong): perform rewrite using python
      # BPE
      if subword_option == "bpe":
          debpe_tgt_test = tgt_test + ".debpe"
          if not os.path.exists(debpe_tgt_test):
              # TODO(thangluong): not use shell=True, can be a security hazard
              cp_cmd = "cp %s %s" % (tgt_test, debpe_tgt_test)
              subprocess.call(cp_cmd.split(), shell=False)
              sed_cmd = "sed s/@@ //g %s" % (debpe_tgt_test)
              subprocess.call(sed_cmd.split(), shell=False)
          tgt_test = debpe_tgt_test
      elif subword_option == "spm":
          despm_tgt_test = tgt_test + ".despm"
          if not os.path.exists(despm_tgt_test):
              subprocess.call("cp %s %s" % (tgt_test, despm_tgt_test))
              subprocess.call("sed s/ //g %s" % (despm_tgt_test))
              subprocess.call("sed s/^\u2581/g %s" % (despm_tgt_test))
              subprocess.call("sed s/\u2581/ /g %s" % (despm_tgt_test))
          tgt_test = despm_tgt_test
      cmd = "%s %s < %s" % (multi_bleu_script, tgt_test, trans_file)
  
      # subprocess
      # TODO(thangluong): not use shell=True, can be a security hazard
      bleu_output = subprocess.check_output(cmd.split(), shell=False)
  
      # extract BLEU score
      m = re.search("BLEU = (.+?),", bleu_output)
      bleu_score = float(m.group(1))
  
      return bleu_score
  
file_path: nlp-architect/examples/sparse_gnmt/gnmt/utils/evaluation_utils.py
imports: import codecs
  import os
  import re
  import subprocess
  import tensorflow
  from .None import rouge, bleu
label_desc: Use image node_id 7 for calling a global function with example usage: _moses_bleu(multi_bleu_script, tgt_test, trans_file, subword_option) and returns: bleu_score