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

set sentence max length automatically #28

Open
pexmar opened this issue Jan 31, 2017 · 1 comment
Open

set sentence max length automatically #28

pexmar opened this issue Jan 31, 2017 · 1 comment

Comments

@pexmar
Copy link

pexmar commented Jan 31, 2017

If you are using a dataset with sentences longer than 65 words, you have to set the the max_l variable manually. You can fix this little issue by replacing the second last line in process_data.py with:

cPickle.dump([revs, W, W2, word_idx_map, vocab, max_l], open("mr.p", "wb"))

and in conv_net_sentence.py after loading the pickled file:

revs, W, W2, word_idx_map, vocab, max_l = x[0], x[1], x[2], x[3], x[4], x[5]

Now you only have to replace the make_idx_data_cv function call by:
make_idx_data_cv(revs, word_idx_map, i, max_l=max_l, k=300, filter_h=5)

It drove me crazy finding that the max sentence length limitation was the problem for the error

ValueError: setting an array element with a sequence.

@yoonkim
Copy link
Owner

yoonkim commented Feb 9, 2017

cool, feel free to send a pull request!

This was referenced Mar 9, 2017
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