Applied Text Analysis with Python by Benjamin Bengfort

Applied Text Analysis with Python by Benjamin Bengfort

Author:Benjamin Bengfort
Language: eng
Format: epub
Publisher: O'Reilly Media
Published: 2018-06-25T16:00:00+00:00


Figure 8-2. Force-directed ego graph for the Wizard of Oz

Note

The construction and utility of property graphs as well as NetworkX’s add_edge, ego_graph and draw methods will be discussed in greater detail in Chapter 9.

Co-occurrence plots

Co-occurrence is another way to quickly understand relationships between entities or other n-grams, in terms of the frequency with which they appear together. In this section we’ll use Matplotlib to plot character co-occurrences in The Wizard of Oz.

First, we create a function matrix that will take in the text of the book and the list of characters. We initialize a multidimensional array that will be a list that contains a list for every character with the count of its co-occurrences with every other character:



Download



Copyright Disclaimer:
This site does not store any files on its server. We only index and link to content provided by other sites. Please contact the content providers to delete copyright contents if any and email us, we'll remove relevant links or contents immediately.