keyword-extraction
keyword-extraction copied to clipboard
Can't get things working.
At this line output_evaluation(inp)
I get error:
inp = "Little gray mouse fears big brown cat."
output_evaluation(inp)
inp = "Little gray mouse fears big brown cat."
output_evaluation(inp) Traceback (most recent call last):
File "
File "
File "
File "
File "
File "
KeyError: 'Little'
This looks like some compability issue maybe. It's not said the torch
library can be installed as PyTorch
- in my case I'm unable to install anything else so use Pytorch
.
Not sure it's the case.
Found that in the code is many unhandled exceptions. In this situation in:
def indexes_from_sentence(lang, sentence): #lang=input_lang; sentence=pair[0]
sent_spl = sentence.split(' ')
return [lang.word2index[word] for word in sent_spl **if word in lang.word2index**]
If word is not in the lang.word2index
it throws an error. This condition works but don't know whether it's properly set and won't cause errors further on.
Anyway, I have many other errors like:
IndexError: invalid index of a 0-dim tensor. Use tensor.item() to convert a 0-dim tensor to a Python number at line
encoder_output, encoder_hidden = encoder(input_variable[ei], encoder_hidden)
ofevaluate
functions and many others.
Is it because you are using a period at the end of your sentence? I have never tested that condition, so you can try removing the period and see if that resolves the issue. All punctuation/special characters need to be removed I think.