'Reads the decoder file and initializes self.decoder from it.
Args:
filename: Name of text file mapping codes to utf8 strings.
Raises:
ValueError: if the input file is not parsed correctly.'

def _InitializeDecoder(self, filename):

    line_re = re.compile('(?P<codes>\\d+(,\\d+)*)\\t(?P<utf8>.+)')
    with tf.gfile.GFile(filename) as f:
        for line in f:
            m = line_re.match(line)
            if (m is None):
                raise ValueError('Unmatched    line:', line)
            str_codes = m.groupdict()['codes'].split(',')
            codes = []
            for code in str_codes:
                codes.append(int(code))
            utf8 = m.groupdict()['utf8']
            num_codes = len(codes)
            for (index, code) in enumerate(codes):
                while (code >= len(self.decoder)):
                    self.decoder.append([])
                self.decoder[code].append(Part(utf8, index, num_codes))
