November 2019
Intermediate to advanced
346 pages
9h 36m
English
In the following steps, we provide a recipe for training a Recurrent Neural Network (RNN) using a corpus of reviews:
with open("airport_reviews_short.csv", encoding="utf-8") as fp: reviews_text = fp.read()
chars_list = sorted(list(set(reviews_text)))char_to_index_dict = { character: chars_list.index(character) for character in chars_list}
The dictionary might look like so, depending on which characters your corpus contains:
{' ': 0, '!': 1, "'": 2, '(': 3, ')': 4, ',': 5, '-': 6, '.': 7, '/': 8, '2': 9, '5': 10, '<': 11, '>': 12, 'A': 13, 'B': ...