November 2018
Beginner to intermediate
182 pages
4h 48m
English
First, we need to download the subtitles of several TED talks from a public dataset. We will train our fastText embeddings on these as well as the word2vec embeddings for comparison, as follows:
ted_dataset = "https://wit3.fbk.eu/get.php?path=XML_releases/xml/ted_en-20160408.zip&filename=ted_en-20160408.zip"
get_data(ted_dataset, "data/ted_en.zip")Python empowers us to access files inside a .zip file, which is easy to do with the zipfile package. Notice it is the zipfile.zipFile syntax that enables this.
We additionally use the lxml package to parse the XML file inside the ZIP.
Here, we manually opened the file to find the relevant content path and look up text() from it. In this case, we are interested only ...
Read now
Unlock full access