Explore Courses Blog Tutorials Interview Questions
0 votes
1 view
in Python by (120 points)
vocab_idx = imdb.get_word_index()
rev_idx = {v+3:k for k,v in vocab_idx.items()}
rev_idx[0] = '<padding_word>'
rev_idx[1] = '<start_word>'
rev_idx[2] = '<oov_word>'
rev_idx[3] = '<unk_word>

'def retrieve_sample(doc_id, rev_idx, X_train): 
 sample_review = ''
 # TODO: implement your solution here 
# End of implementation 
 return sample_review 
answers_out['sample_doc_{}'.format(random_id)] = retrieve_sample(random_id, rev_idx, X_train) 
answers_out['sample_doc_2'] = retrieve_sample(2, rev_idx, X_train)
print (answers_out['sample_doc_{}'.format(random_id)])
print (answers_out['sample_doc_2'])
How can I retrieve original form of training samples so I get this output
<start_word> this movie is one of the most underrated movie of its time when watching this movie your filled with action and when <oov_word> not really <oov_word> the humour is un matched brilliant writing for a movie that was made to give us a bloody mix of a game show where criminals are the <oov_word> and a near future where the general public all have a <oov_word> for blood also arnold doesn't let us down with some of his best one liners i don't want to spoil anything for you but i will tell you when arnold gives his i'll be back line he gets the best response of them all in this movie hope you enjoy this gem as much as i did <start_word> this has to be one of the worst films of the <oov_word> when my friends i were watching this film being the target audience it was aimed at we just sat watched the first half an hour with our jaws touching the floor at how bad it really was the rest of the time everyone else in the theatre just started talking to each other leaving or generally crying into their popcorn that they actually paid money they had <oov_word> working to watch this <oov_word> excuse for a film it must have looked like a great idea on paper but on film it looks like no one in the film has a clue what is going on crap acting crap costumes i can't get across how <oov_word> this is to watch save yourself an hour a bit of your life

Please log in or register to answer this question.

Browse Categories