当前位置:网站首页>I just did it! Visualization of character relationships in Douluo continent
I just did it! Visualization of character relationships in Douluo continent
2022-06-24 11:02:00 【Python researcher】
Today, brother Chen came to teach you from a novel / In the classics Extract names , Also on The relationship between names Make statistics ( In the same paragraph, names appear in pairs ), According to the relationship between names Drawing diagrams --gephi
Core knowledge points :
- Extracting names from text
- Statistics of the relationship between the characters in the text
- Draw a network diagram
Have a look first effect :
01 jieba Small example
At the beginning of the analysis 《 Doulo land 》 Before the novel , Let's start with a small example jieba The use of the library has an impression .
explain :
You can see the text content results jieba After the library participle , You can get every part of speech . We need names here , Just pick out nr Part of speech of , And count the number of times each word .
Here is a demonstration for you jieba Small examples of extracting names from text , The following is a novel 《 Doulo land 》 For example , Explain how to extract the names of the characters in it , And create a digraph , Finally, draw a figure diagram .
02 Extracting character relationships
1. Make a name dictionary
Some of the results are shown in the figure above , By extracting all the names in the novel , Before removal 100 And write from high to low frequency txt. But some of them are incomplete 、 It's useless 、 One character, more than one, etc . After sorting out the following .
2. Build character relationships
Through the construction of the character name in each paragraph appear in pairs of statistics . Finally, it's set up , The connection between character nodes and characters .
3. Save to csv
give the result as follows :
03 Network of people
What we use here is gephi Drawing ,gephi The download address is as follows :
https://gephi.org/
After downloading and installing , Start importing the just saved node.csv and edge.csv Data to draw a network of people
1. New project & Import data
New project -> choice Data and data tab, Click on Enter the number table , Adding nodes and edges csv data .
2. Adjust the relevant styles
3. Change the font , Display the corresponding label
4. Choose a way to automate the layout , preview , Then adjust the relevant parameters
5. Finally, click on the lower left corner to export the image
04 Summary
This paper explains how to extract the names of people in the text and count the relationship between people in the text , Finally, draw a network diagram , What you don't understand can be in Message below , Communicate together .
边栏推荐
- Thread operation principle
- Charles packet capturing tool tutorial
- Investing in a good navigation framework from the beginning of the jetpack compose tutorial will help you save a lot of migration work later
- math_等比数列求和推导&等幂和差推导/两个n次方数之差/
- 脚本之美│VBS 入门交互实战
- What is the resource search platform and how resource search works
- The record of 1300+ times of listing and the pursuit of ultimate happiness
- Canvas pipe animation JS special effect
- Self service troubleshooting guide for redis connection login problems
- Tencent geek challenge small - endless!
猜你喜欢

P5.js paper crane animation background JS special effect

機械臂速成小指南(二):機械臂的應用

Process and multithreading
![[activities this Saturday] NET Day in China](/img/33/c0e8eeb8f673232a7c27bbaf5e713f.jpg)
[activities this Saturday] NET Day in China

23. opencv - image mosaic project

MYSQL_精讲数据库数据类型

Appium automation test foundation - mobile end test environment construction (I)
![[IEEE publication] International Conference on natural language processing and information retrieval in 2022 (ecnlpir 2022)](/img/d6/8c20944ce354c9619a61a73f2c72b1.png)
[IEEE publication] International Conference on natural language processing and information retrieval in 2022 (ecnlpir 2022)

Quick completion guide for manipulator (III): mechanical structure of manipulator

服乔布斯不服库克,苹果传奇设计团队解散内幕曝光
随机推荐
Pycharm shortcut keys
使用Process Monitor工具监测进程对注册表和文件的操作
The nodejs service global timeout callback failed to get process Domain problem
数组怎么转对象,对象怎么转数组
Centripetalnet: more reasonable corner matching, improved cornernet | CVPR 2020 in many aspects
进程与多线程
Four methods of object merging and four methods of object merging in JS
机械臂速成小指南(二):机械臂的应用
Cookie 、Session、localstorage、Sessionstorage的区别
Step 3: access the API interface for inquiry of SF express doc No. [express 100api interface]
Does the depth system work?
Maui的学习之路 -- 开篇
JMeter interface test tool foundation - sampler (II)
09. Tencent cloud IOT device side learning -- RRPC and behavior
First acquaintance with string+ simple usage (I)
机械臂速成小指南(三):机械臂的机械结构
Attribute observer didset and willset in swift of swiftui swift internal skill
图片的可视化呈现有效增强大屏吸引力
math_等比数列求和推导&等幂和差推导/两个n次方数之差/
What characteristics should a good design website have?