Search icon CANCEL
Subscription
0
Cart icon
Cart
Close icon
You have no products in your basket yet
Save more on your purchases!
Savings automatically calculated. No voucher code required
Arrow left icon
All Products
Best Sellers
New Releases
Books
Videos
Audiobooks
Learning Hub
Newsletters
Free Learning
Arrow right icon
Arrow up icon
GO TO TOP
Python Data Science Essentials

You're reading from  Python Data Science Essentials

Product type Book
Published in Apr 2015
Publisher Packt
ISBN-13 9781785280429
Pages 258 pages
Edition 1st Edition
Languages
Toc

A peek into Natural Language Processing (NLP)


This section is not strictly related to machine learning, but it contains some machine learning results in the area of Natural Language Processing. Python has many toolkits to process text data, but the most powerful and complete toolkit is NLTK, the Natural Language Tool Kit.

In the following sections, we'll explore its core functionalities. We will work on the English language; for other languages, you will first need to download the language corpora (note that sometimes, languages have no free open source corpora for NLTK).

Word tokenization

Tokenization is the action of splitting the text in words. Chunking the whitespace seems very easy, but it's not, because text contains punctuation and contractions. Let's start with an example:

In: my_text = "The coolest job in the next 10 years will be statisticians. People think I'm joking, but who would've guessed that computer engineers would've been the coolest job of the 1990s?"
simple_tokens = my_text...
lock icon The rest of the chapter is locked
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}