Skip to content

Commit

Permalink
Add type checking for np arrays
Browse files Browse the repository at this point in the history
:
  • Loading branch information
zeynepakkalyoncu committed Dec 19, 2018
1 parent 3cccfaf commit fde81b3
Showing 1 changed file with 1 addition and 0 deletions.
1 change: 1 addition & 0 deletions lib/data/util.py
Expand Up @@ -99,6 +99,7 @@ def reverse_index(indexed_data, vocab, ravel=False):
reversed_data = list()
indexed_data = np.argmax(indexed_data, axis=-1)
word_idx = {id: word for word, id in vocab.items()}
if isinstance(indexed_data, np.ndarray): indexed_data = indexed_data.tolist()
for indexed_line in indexed_data:
if ravel:
reversed_data.append([' '.join((word_idx[x] for x in indexed_line[1:len(indexed_line)-1]))])
Expand Down

0 comments on commit fde81b3

Please sign in to comment.