original_docstring: extract texts from output of CTC decoder
docstring: extract texts from output of CTC decoder
docstring_tokens: extract texts from output of CTC decoder
code: def decoderOutputToText(self, ctcOutput, batchSize):
          """extract texts from output of CTC decoder"""
  
          # TF decoders: label strings are contained in sparse tensor
          # ctc returns tuple, first element is SparseTensor
          decoded = ctcOutput[0][0]
  
          # contains string of labels for each batch element
          labelStrs = [[] for _ in range(batchSize)]
  
          # go over all indices and save mapping: batch -> values
          for (idx, idx2d) in enumerate(decoded.indices):
              label = decoded.values[idx]
              batchElement = idx2d[0]  # index according to [b,t]
              labelStrs[batchElement].append(label)
  
          # map labels to chars for all batch elements
          return [str().join([self.charList[c] for c in labelStr]) for labelStr in labelStrs]
code_tokens: def decoderOutputToText ( self , ctcOutput , batchSize ) : decoded = ctcOutput [ 0 ] [ 0 ] labelStrs = [ [ ] for _ in range ( batchSize ) ] for ( idx , idx2d ) in enumerate ( decoded . indices ) : label = decoded . values [ idx ] batchElement = idx2d [ 0 ] labelStrs [ batchElement ] . append ( label ) return [ str ( ) . join ( [ self . charList [ c ] for c in labelStr ] ) for labelStr in labelStrs ]
short_docstring: extract texts from output of CTC decoder
short_docstring_tokens: extract texts from output of CTC decoder
comment: """extract texts from output of CTC decoder"""$SEP$# TF decoders: label strings are contained in sparse tensor$SEP$# ctc returns tuple, first element is SparseTensor$SEP$# contains string of labels for each batch element$SEP$# go over all indices and save mapping: batch -> values$SEP$# index according to [b,t]$SEP$# map labels to chars for all batch elements