I am following a python tutorial referred here (https://www.coursera.org/lecture/ai/autoencoder-understanding-word2vec-SsBB4)
In this tutorial this block of code is successfully executed:
https://drive.google.com/file/d/1-moHOjghmkIMiMApp6lZNjHcRpCGfwhl/view?usp=sharing
But when I try to execute the same block of code
https://drive.google.com/file/d/1YUV-Fk74SESRXZ5bBmdKNvsQOLDaDlfb/view?usp=sharing
I get error
File "<ipython-input-12-d980c3dcfd20>", line 5
if padded_doc[i] <> 0:
^
SyntaxError: invalid syntax
I don't understand whether this " <> " is a symbol ever used in python.
tuples = np.empty((0,2))
for padded_doc in padded_docs:
length = len(padded_doc)
for i in range(length):
if padded_doc[i] <> 0:
if i<length-1 & padded_doc[i+1] <> 0:
tuples = np.append(tuples, [[padded_doc[i],padded_doc[i+1]]], axis=0)
if i<length-2 & padded_doc[i+2] <> 0:
tuples = np.append(tuples, [[padded_doc[i],padded_doc[i-1]]], axis = 0)
if i>0:
tuples = np.append(tuples, [[padded_doc[i],padded_doc[i-1]]], axis = 0)
if i>1:
tuples = np.append(tuples, [[padded_doc[i],padded_doc[i-2]]], axis = 0)
print tuples.shape
tuples
expected result for the code should be (38,2)