May 2018
Intermediate to advanced
472 pages
11h 27m
English
We will next discuss how we can learn word embeddings for the words found in the captions. First we will preprocess the captions in order to reduce the vocabulary:
def preprocess_caption(capt):
capt = capt.replace('-',' ')
capt = capt.replace(',','')
capt = capt.replace('.','')
capt = capt.replace('"','')
capt = capt.replace('!','')
capt = capt.replace(':','')
capt = capt.replace('/','')
capt = capt.replace('?','')
capt = capt.replace(';','')
capt = capt.replace('\' ',' ')
capt = capt.replace('\n',' ')
return capt.lower()For example, consider the following sentence:
A living room and dining room have two tables, couches, and multiple chairs.
This will be transformed to the following:
a living room and dining room have two ...
Read now
Unlock full access