Search icon CANCEL
Subscription
0
Cart icon
Your Cart (0 item)
Close icon
You have no products in your basket yet
Arrow left icon
Explore Products
Best Sellers
New Releases
Books
Videos
Audiobooks
Learning Hub
Conferences
Free Learning
Arrow right icon
Arrow up icon
GO TO TOP
Network Science with Python

You're reading from   Network Science with Python Explore the networks around us using network science, social network analysis, and machine learning

Arrow left icon
Product type Paperback
Published in Feb 2023
Publisher Packt
ISBN-13 9781801073691
Length 414 pages
Edition 1st Edition
Languages
Tools
Arrow right icon
Author (1):
Arrow left icon
David Knickerbocker David Knickerbocker
Author Profile Icon David Knickerbocker
David Knickerbocker
Arrow right icon
View More author details
Toc

Table of Contents (17) Chapters Close

Preface 1. Part 1: Getting Started with Natural Language Processing and Networks
2. Chapter 1: Introducing Natural Language Processing FREE CHAPTER 3. Chapter 2: Network Analysis 4. Chapter 3: Useful Python Libraries 5. Part 2: Graph Construction and Cleanup
6. Chapter 4: NLP and Network Synergy 7. Chapter 5: Even Easier Scraping! 8. Chapter 6: Graph Construction and Cleaning 9. Part 3: Network Science and Social Network Analysis
10. Chapter 7: Whole Network Analysis 11. Chapter 8: Egocentric Network Analysis 12. Chapter 9: Community Detection 13. Chapter 10: Supervised Machine Learning on Network Data 14. Chapter 11: Unsupervised Machine Learning on Network Data 15. Index 16. Other Books You May Enjoy

Why NLP in a network analysis book?

Most of you probably bought this book in order to learn applied social network analysis using Python. So, why am I explaining NLP? Here’s why: if you know your way around NLP and are comfortable extracting data from text, that can be extremely powerful for creating network data and investigating the relationship between things that are mentioned in text. Here is an example from the book Alice’s Adventures in Wonderland by Lewis Carroll, my favorite book.

“Once upon a time there were three little sisters” the Dormouse began in a great hurry; “and their names were Elsie, Lacie, and Tillie; and they lived at the bottom of a well.”

What can we observe from these words? What characters or places are mentioned? We can see that the Dormouse is telling a story about three sisters named Elsie, Lacie, and Tillie and that they lived at the bottom of a well. If you allow yourself to think in terms of relationships, you will see that these relationships exist:

  • Three sisters -> Dormouse (he either knows them or knows a story about them)
  • Dormouse -> Elsie
  • Dormouse -> Lacie
  • Dormouse -> Tillie
  • Elsie -> bottom of a well
  • Lacie -> bottom of a well
  • Tillie -> bottom of a well

It’s also very likely that the three sisters all know each other, so additional relationships emerge:

  • Elsie -> Lacie
  • Elsie -> Tillie
  • Lacie -> Elsie
  • Lacie -> Tillie
  • Tillie -> Elsie
  • Tillie -> Lacie

Our minds build these relationship maps so effectively that we don’t even realize that we are doing it. The moment I read that the three were sisters, I drew a mental image that the three knew each other.

Let’s try another example from a current news story: Ocasio-Cortez doubles down on Manchin criticism (CNN, June 2021: https://edition.cnn.com/videos/politics/2021/06/13/alexandria-ocasio-cortez-joe-manchin-criticism-sot-sotu-vpx.cnn).

Rep. Alexandria Ocasio-Cortez (D-NY) says that Sen. Joe Manchin (D-WV) not supporting a house voting rights bill is being influenced by the legislation’s sweeping reforms to limit the role of lobbyists and the influence of “dark money” political donations.

Who is mentioned, and what is their relationship? What can we learn from this short text?

  • Rep. Alexandria Ocasio-Cortez is talking about Sen. Joe Manchin
  • Both are Democrats
  • Sen. Joe Manchin does not support a house voting rights bill
  • Rep. Alexandria Ocasio-Cortez claims that Sen. Joe Manchin is being influenced by the legislation’s reforms
  • Rep. Alexandria Ocasio-Cortez claims that Sen. Joe Manchin is being influenced by “dark money” political donations
  • There may be a relationship between Sen. Joe Manchin and “dark money” political donors

We can see that even a small amount of text has a lot of information embedded.

If you are stuck trying to figure out relationships when dealing with text, I learned in college creative writing classes to consider the “W” questions (and How) in order to explain things in a story:

  • Who: Who is involved? Who is telling the story?
  • What: What is being talked about? What is happening?
  • When: When does this take place? What time of the day is it?
  • Where: Where is this taking place? What location is being described?
  • Why: Why is this important?
  • How: How is the thing being done?

If you ask these questions, you will notice relationships between things and other things, which is foundational for building and analyzing networks. If you can do this, you can identify relationships in text. If you can identify relationships in text, you can use that knowledge to build social networks. If you can build social networks, you can analyze relationships, detect importance, detect weaknesses, and use this knowledge to gain a really profound understanding of whatever it is that you are analyzing. You can also use this knowledge to attack dark networks (crime, terrorism, and so on) or protect people, places, and infrastructure. This isn’t just insights. These are actionable insights—the best kind.

That is the point of this book. Marrying NLP with social network analysis and data science is extremely powerful for acquiring a new perspective. If you can scrape or get the data you need, you can really gain deep knowledge of how things relate and why.

That is why this chapter aims to explain very simply what NLP is, how to use it, and what it can be used for. But before that, let’s get into the history for a bit, as that is often left out of NLP books.

You have been reading a chapter from
Network Science with Python
Published in: Feb 2023
Publisher: Packt
ISBN-13: 9781801073691
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 $19.99/month. Cancel anytime
Banner background image