Search icon CANCEL
Subscription
0
Cart icon
Your Cart (0 item)
Close icon
You have no products in your basket yet
Save more on your purchases! discount-offer-chevron-icon
Savings automatically calculated. No voucher code required.
Arrow left icon
All Products
Best Sellers
New Releases
Books
Videos
Audiobooks
Learning Hub
Newsletter Hub
Free Learning
Arrow right icon
timer SALE ENDS IN
0 Days
:
00 Hours
:
00 Minutes
:
00 Seconds
Arrow up icon
GO TO TOP
fastText Quick Start Guide

You're reading from   fastText Quick Start Guide Get started with Facebook's library for text representation and classification

Arrow left icon
Product type Paperback
Published in Jul 2018
Publisher Packt
ISBN-13 9781789130997
Length 194 pages
Edition 1st Edition
Languages
Arrow right icon
Author (1):
Arrow left icon
Joydeep Bhattacharjee Joydeep Bhattacharjee
Author Profile Icon Joydeep Bhattacharjee
Joydeep Bhattacharjee
Arrow right icon
View More author details
Toc

Installing Python dependencies


I recommend that you install Anaconda so that there are no issues with installing Python and using it for fastText. Detailed instructions for installing Anaconda are given on the official documentation page, which can be accessed at https://conda.io/docs/user-guide/install/linux.html. Simply stated, if you are on Windows, then download the Windows installer, double-click on it, and then follow the instructions on the screen. Installing it using a GUI is also possible for macOS.

 

 

In the case of Linux and macOS, download the corresponding bash file and then run the following command in a Terminal:

$ bash downloadedfile.sh

Please take care to download and install it using installers that are tagged for Python 3.x. The Python code snippets that will be shown in this book will be shown for Python 3.x.

Installing fastText on Windows

Currently, official binaries are not provided for fastText on Windows, and hence there is no GUI to install fastText on your machine. To use fastText, you will need to perform the following steps:

  1. Download the latest binary named fasttext-win64-latest-Release.zip from the release page provided by Xua (https://github.com/xiamx/fastText/releases).
  2. This is a ZIP file and hence you will need to extract the contents. You will find the fasttext_pic.lib, fasttext.lib, fasttext.exe, and fasttext.dll files in the extracted folder. This folder will be your working directory for fastText:

 

  1. Create a folder, data where you will keep all your data files. Now, open PowerShell and change directory to the folder.
  2. Type .\fasttext.exe in Powershell and you should be able to see the output.

If you don't see any output at the end, then you probably don't have Visual C++ Redistributable in your machine and will need to install that.

 

 

Installing fastText in Linux and macOS

To install fastText, run the following commands to clone the image and build it in a Terminal:

 $ git clone https://github.com/facebookresearch/fastText.git
 $ cd fastText
 $ mkdir build && cd build && cmake ..
 $ make && make install

In this book, a lot of focus will be on building systems for Python. So, run the following commands as well in the same directory:

$ pip install .

pip is the package manager for Python. fastText assumes UTF-8 encoded text, which is the default in Python 3.x. The Python code examples in this book will be shown using Python 3.x. One of the advantages of fastText is that you can build fastText models for multiple languages and if you are not using Python 3.x, then you will not be able to take advantage of this. If that is not a concern and you are trying to use fastText using Python 2.7, then take a look at the Appendix at the end, which will give you guidelines on how to develop, keeping in mind UTF-8 in Python 2.7.

You have been reading a chapter from
fastText Quick Start Guide
Published in: Jul 2018
Publisher: Packt
ISBN-13: 9781789130997
Register for a free Packt account to unlock a world of extra content!
A free Packt account unlocks extra newsletters, articles, discounted offers, and much more. Start advancing your knowledge today.
Unlock this book and the full library FREE for 7 days
Get unlimited access to 7000+ expert-authored eBooks and videos courses covering every tech area you can think of
Renews at $15.99/month. Cancel anytime
Visually different images