Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

KeyError:Something #31

Open
rkolaf opened this issue Oct 24, 2019 · 4 comments
Open

KeyError:Something #31

rkolaf opened this issue Oct 24, 2019 · 4 comments

Comments

@rkolaf
Copy link

rkolaf commented Oct 24, 2019

can you please explain why this error is occurring?
Traceback (most recent call last):
File "conversation.py", line 215, in
Q = tokenize(query)
File "conversation.py", line 117, in tokenize
X = np.asarray([word_to_index[w] for w in tokenized_sentences])
File "conversation.py", line 117, in
X = np.asarray([word_to_index[w] for w in tokenized_sentences])
KeyError: 'something'

@oswaldoludwig
Copy link
Owner

It looks like your dictionary doesn't have the key "something". You must use a preprocessing function that exists somewhere in my code that replaces all non-dictionary words with a special token, such as UNK.

@rkolaf
Copy link
Author

rkolaf commented Oct 24, 2019

But the words that I used were present in the vocab file. (custom data)

@rkolaf
Copy link
Author

rkolaf commented Oct 24, 2019

could you please explain?

@oswaldoludwig
Copy link
Owner

I don't have time now to help you with this, but if you describe your code modifications here, maybe another user can help you debug it. I will leave this issue open.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants