class_docstr: Abstract class for text-based metrics calculated based on
  hypotheses and references. Subclasses must implement `metric_fn`.
  
  Args:
    name: A name for the metric
    separator: A separator used to join predicted tokens. Default to space.
    eos_token: A string token used to find the end of a sequence. Hypotheses
      and references will be slcied until this token is found.
class_docstr_tok: ["Abstract","class","for","text-based","metrics","calculated","based","on","hypotheses","and","references",".","Subclasses","must","implement","`","metric_fn","`",".","Args",":","name",":","A","name","for","the","metric","separator",":","A","separator","used","to","join","predicted","tokens",".","Default","to","space",".","eos_token",":","A","string","token","used","to","find","the","end","of","a","sequence",".","Hypotheses","and","references","will","be","slcied","until","this","token","is","found","."]
docstr: Initializer
docstr_tok: ["Initializer"]
code: def __init__(self, params, name):
      # We don't call the super constructor on purpose
      # pylint: disable=W0231
      """Initializer"""
      Configurable.__init__(
          self, params, tf.contrib.learn.ModeKeys.EVAL
      )
      self._name = name
      self._eos_token = self.params["eos_token"]
      self._sos_token = self.params["sos_token"]
      self._separator = self.params["separator"]
      self._postproc_fn = None
      if self.params["postproc_fn"]:
          self._postproc_fn = locate(self.params["postproc_fn"])
          if self._postproc_fn is None:
              raise ValueError(
                  "postproc_fn not found: {}".format(
                      self.params["postproc_fn"]
                  )
              )
  
imports: from __future__ import absolute_import
  from __future__ import division
  from __future__ import print_function
  from __future__ import unicode_literals
  from pydoc import locate
  import abc
  import numpy
  import six
  import tensorflow
  from tensorflow.contrib import metrics
  from tensorflow.contrib.learn import MetricSpec
  from seq2seq.data import postproc
  from seq2seq.configurable import Configurable
  from seq2seq.metrics import rouge
  from seq2seq.metrics import bleu
label_desc: Use image node_id 1 to create a new TextMetricSpec object from inherited base classes: Configurable, MetricSpec with example: obj = TextMetricSpec(params, name)