KeyError: 'i' and  Error I am implementing the codes for https://www.kaggle.com/eray1yildiz/using-lstms-with-attention-for-emotion-recognition
which is an emotion analysis from the text. I am having some errors when I am Encoding my samples with corresponding integer values. The following codes are: 

X = [[word2id[word] for word in sentence] for sentence in input_sentences]

Error: 
Traceback (most recent call last):
  File "&lt;pyshell#32&gt;", line 1, in &lt;module&gt;
    X = [[word2id[word] for word in sentence] for sentence in input_sentences]
  File "&lt;pyshell#32&gt;", line 1, in &lt;listcomp&gt;
    X = [[word2id[word] for word in sentence] for sentence in input_sentences]
  File "&lt;pyshell#32&gt;", line 1, in &lt;listcomp&gt;
    X = [[word2id[word] for word in sentence] for sentence in input_sentences]
KeyError: 'i'



can someone please help me. thanks
The dictionary word2id does not contain the word "i". I can run the Kaggle Kernel and do not get the error. 
When I run the code my word2id dictionary looks like this:

{'i': 0,
 'feel': 1,
 'awful': 2,
 'about': 3,
 'it': 4,
 'too': 5,
 'because': 6,...}


The word "i" is definitely in there, I think you did not run the code to create the word2id dictionary properly. Make sure to run all the cells of the kernel.