aditya1503 / Siamese-LSTM

Siamese Recurrent Neural network with LSTM for evaluating semantic similarity between sentences.
200 stars 68 forks source link

Error while running example3 #22

Open mvvardhan opened 6 years ago

mvvardhan commented 6 years ago

I get the following error when I run python examples/example3.py by uncommenting the line "training=True # Set to false to load weights". Epoch 65 Epoch 65 Update 22840 Cost 0.030776206 Epoch 65 Update 22880 Cost 0.032375146 Epoch 65 Update 22920 Cost 0.024936032 Epoch 65 Update 22960 Cost 0.030370418 Epoch 65 Update 23000 Cost 0.03584883 Epoch 65 Update 23040 Cost 0.042079 Epoch 65 Update 23080 Cost 0.033460055 Epoch 65 Update 23120 Cost 0.023712454 Epoch 65 Update 23160 Cost 0.038346637 epoch took: 45.9180030823 Pre-training done Traceback (most recent call last): File "examples/example3.py", line 14, in train=expand(train) File "/home/projects/Siamese-LSTM/sentences.py", line 146, in expand sa,cnt1=chsyn(i[0],data) File "/home/projects/Siamese-LSTM/sentences.py", line 93, in chsyn if q in cachedStopWords or q.title() in cachedStopWords or q.lower() in cachedStopWords: NameError: global name 'cachedStopWords' is not defined

aimaaonline commented 6 years ago

add this line of code in sentences.py

from nltk.corpus import stopwords and in the function def chsyn(s,trn): ----ADD THIS LINE: cachedStopWords=stopwords.words("english")