title: How can I one hot encode a list of strings with Keras?
body: <p>I have a list:</p>
  
  <pre><code>code = ['&lt;s&gt;', 'are', 'defined', 'in', 'the', '"editable', 'parameters"', '\n', 'section.', '\n', 'A', 'larger', '`tsteps`', 'value', 'means', 'that', 'the', 'LSTM', 'will', 'need', 'more', 'memory', '\n', 'to', 'figure', 'out']
  </code></pre>
  
  <p>And I want to convert to one hot encoding. I tried:</p>
  
  <pre><code>to_categorical(code)
  </code></pre>
  
  <p>And I get an error: <code>ValueError: invalid literal for int() with base 10: '&lt;s&gt;'</code></p>
  
  <p>What am I doing wrong?</p>