How it works...

Let's see how to build this pipeline:

import nltkimport threadingimport queueimport feedparserimport uuid

These five instructions import five Python libraries into the current program:

  • nltk: Natural language toolkit
  • threading: A threading library used to create lightweight tasks within a single program
  • queue: A queue library that can be used in a multi-threaded program
  • feedparser: An RSS feed parsing library
  • uuid: An RFC-4122-based uuid version 1, 3, 4, 5-generating library
threads = []

Creating a new empty list to keep track of all the threads in the program:

queues = [queue.Queue(), queue.Queue()]

This instruction creates a list of two queues in a variable queue?

Why do we need two queues:

  • The first queue is used to store ...

Get Natural Language Processing with Python Cookbook now with O’Reilly online learning.

O’Reilly members experience live online training, plus books, videos, and digital content from 200+ publishers.