From the course: Data Science Foundations: Data Mining in Python

Unlock the full course today

Join today to access over 22,400 courses taught by industry experts or purchase this course individually.

Word pairs

Word pairs - Python Tutorial

From the course: Data Science Foundations: Data Mining in Python

Start my 1-month free trial

Word pairs

- [Instructor] So far, our text mining has been looking at one word at a time and specifically whether it's positive or negative, or how positive or how negative, but you could also look at collections of words. And one interesting way to do this is to look at word pairs. And that gives you the connections between words. To do this, we're going to start by installing yet another library, networkx, and you can install it with either this command or this command. But once you have that installed, we'll load our libraries. And networkx is good for installing network graphs, that is, the connections between people or pieces of information and we're going to be doing the exact same thing in this example. Let's start by importing the Iliad, which we've seen before, and we'll tokenize the data, again, like we've done before, and now what we're going to do is we're going to create word pair tokens. Again, previously our tokens…

Contents