title: Tensorflow - String processing in Dataset API
body: <p>I have <code>.txt</code> files in a directory of format <code>&lt;text&gt;\t&lt;label&gt;</code>. I am using the <code>TextLineDataset</code> API to consume these text records:</p>
  
  <pre><code>filenames = ["/var/data/file1.txt", "/var/data/file2.txt"]
  
  dataset = tf.contrib.data.Dataset.from_tensor_slices(filenames)
  
  dataset = dataset.flat_map(
      lambda filename: (
          tf.contrib.data.TextLineDataset(filename)
          .map(_parse_data)))
  
  def _parse_data(line):   
      line_split = tf.string_split([line], '\t')
      features = {"raw_text": tf.string(line_split.values[0].strip().lower()),
                  "label": tf.string_to_number(line_split.values[1], 
                      out_type=tf.int32)}
      parsed_features = tf.parse_single_example(line, features)
      return parsed_features["raw_text"], raw_features["label"]
  </code></pre>
  
  <p>I would like to do some string cleaning/processing on the raw_text feature. When I try to run  <code>line_split.values[0].strip().lower()</code>, I get the following error:</p>
  
  <blockquote>
    <p>AttributeError: 'Tensor' object has no attribute 'strip'</p>
  </blockquote>