code: def _word_accuracy(label_file, pred_file):
      """Compute accuracy on per word basis."""
  
      with codecs.getreader("utf-8")(
          tf.gfile.GFile(label_file, "r")
      ) as label_fh:
          with codecs.getreader("utf-8")(
              tf.gfile.GFile(pred_file, "r")
          ) as pred_fh:
              total_acc, total_count = 0.0, 0.0
              for sentence in label_fh:
                  labels = sentence.strip().split(" ")
                  preds = pred_fh.readline().strip().split(" ")
                  match = 0.0
                  for pos in range(min(len(labels), len(preds))):
                      label = labels[pos]
                      pred = preds[pos]
                      if label == pred:
                          match += 1
                  total_acc += (
                      100 * match / max(len(labels), len(preds))
                  )
                  total_count += 1
      return total_acc / total_count
  
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 6 for calling a global function with example usage: _word_accuracy(label_file, pred_file) and returns: unknown