Open demetrii opened 6 years ago
This error is because the .index() method is supported by Python 2, but unsupported by Python 3. I am currently trying to find a way around. Feel free to share (potential) solutions
Rewrote:
[self._word_to_id.keys()[self._word_to_id.values().index(data_x[index])] for index in range(len(puncts) - 1, len(data_x))]
to the following:
[self._word_to_id.keys()[list(self._word_to_id.values()).index(data_x[index])] for index in range(len(puncts) - 1, len(data_x))]
However, the error that I get is 'dict_keys' object does not support indexing
. Any suggested solution?
Did you try this:- [list(self._word_to_id.keys())[list(self._word_to_id.values()).index(data_x[index])]
I guess this can unblock you.
Upon running
for s in sources: source, predicted = predictor.predict(s) print('\n---SOURCE----\n' + source) print('---PREDICTED----\n' + predicted)
I get the following error: INFO:tensorflow:Restoring parameters from /content/lab/datalab/punctuation/model/punctuation-5796
AttributeError Traceback (most recent call last)