当前位置:网站首页>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 .
边栏推荐
- Extremenet: target detection through poles, more detailed target area | CVPR 2019
- Charles packet capturing tool tutorial
- Tencent geek challenge small - endless!
- Quick completion guide for mechanical arm (II): application of mechanical arm
- Cool interactive animation JS special effects implemented by p5.js
- Canvas falling ball gravity JS special effect animation
- Smart energy: scenario application of intelligent security monitoring technology easycvr in the petroleum energy industry
- Cloud vendor secondary virtualization restrictions
- [technical tutorial] national standard protocol platform easygbs cascading supports customized national standard channels
- Many of my friends asked me what books and online classes I recommended. This time, I contributed all the materials that I had been hiding for a long time (Part 1)
猜你喜欢

【IEEE出版】2022年自然语言处理与信息检索国际会议(ECNLPIR 2022)

Window function row in SQL Server_ number()rank()dense_ rank()

把腾讯搬到云上,治愈了他们的技术焦虑

腾讯开源项目「应龙」成Apache顶级项目:前身长期服务微信支付,能hold住百万亿级数据流处理...

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

Quick completion guide for mechanical arm (I): development overview of mechanical arm

Canvas falling ball gravity JS special effect animation

Maui's way of learning -- Opening

历史上的今天:图灵诞生日;互联网奠基人出生;Reddit 上线

First acquaintance with string+ simple usage (I)
随机推荐
Why should we make the best use of the external chain in SEO?
Besides technology, programmers also need to master a skill - self marketing ability
A method of generating non repeated numbers in nodejs
H5 video conference, camera monitoring, web streaming and live broadcast integration scheme
脚本之美│VBS 入门交互实战
计组_cpu的结构和工作流程
System design: key features of distributed systems
Thread operation principle
Stack Title: exclusive time of function
喜歡就去行動
What does ERP system mean
"One good programmer is worth five ordinary programmers!"
Functions of document management what functions does the document management software have
Shape change loader loads jsjs special effect code
Fais ce que tu veux.
Apple's legendary design team disbanded after jobs refused to obey cook
Can text pictures be converted to word? How to extract text from pictures
Cloud vendor secondary virtualization restrictions
Distribute proofs of manuscripts by scanning
今日睡眠质量记录76分