Skip to main content

Character interaction temporal graph analysis

Project description

license package publish

CharNet: Dynamic Social Network Analysis for TV Series Dialogues

CharNet is a Python package designed for performing graph analysis on dynamic social networks based on dialogues in TV series. It provides tools for loading dialogue data, calculating and creating weighted graphs, and visualizing character interactions over time.

Simple example


import charnet as cn
import pandas as pd

df = pd.read_csv('bigbang_lines_test.csv')
net_test = cn.CharNet(df, ('Season', 'Episode', 'Scene', 'Line'),
                   interactions='Words', speakers='Speaker', listeners='Listener', directed=True)
net_test.get_weights(lambda x: len(x))
net_test.draw(plot='matplotlib')

net_test.get_weights(lambda x: len(x))
net_test.set_min_step('Scene')
subset = net_test.get_interval((1, 1, 1, 1), (1, 2, 1, 1))
subset.normalize_weights()
subset.set_layout('circular')
subset.draw(plot='matplotlib')

from charnet.analysis import simple_degree

degree_results = simple_degree(subset, weighted=True)
degree_results.to_csv('results.csv', index=False)

Install


Install the latest version of CharNet:

$ pip install charnet

Install with all optional dependencies:

$ pip install charnet[all]

To Do

  • Add non-directed graph support
  • Add closeness centrality
  • Add Eigenvector centrality
  • Add Louvain community detection
  • Add temporal visualization
  • Add centrality visualizer (with visualization)

License

Released under the GNU General Public License v3.0.

Copyright (c) 2024 Media Comprehension Lab

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

charnet-0.0.3.tar.gz (20.6 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

charnet-0.0.3-py3-none-any.whl (22.9 kB view details)

Uploaded Python 3

File details

Details for the file charnet-0.0.3.tar.gz.

File metadata

  • Download URL: charnet-0.0.3.tar.gz
  • Upload date:
  • Size: 20.6 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.1.1 CPython/3.10.14

File hashes

Hashes for charnet-0.0.3.tar.gz
Algorithm Hash digest
SHA256 8e3bfc3da98140e185a042ebd5ebd5ca847583e5507c450563016526639a05b8
MD5 a0275d1c9dbc9bf7160c8a77887bebe3
BLAKE2b-256 00f514c8c8cd392271509205aed5bdd41ef9ab92a398a02c228fd09f89bf8d97

See more details on using hashes here.

File details

Details for the file charnet-0.0.3-py3-none-any.whl.

File metadata

  • Download URL: charnet-0.0.3-py3-none-any.whl
  • Upload date:
  • Size: 22.9 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.1.1 CPython/3.10.14

File hashes

Hashes for charnet-0.0.3-py3-none-any.whl
Algorithm Hash digest
SHA256 fe4c985fdee1c40cab362659a1681a9e14dc320191aa8d8f449fa44554861b9f
MD5 459e3b12d75a8f1f5680dd3769ff4daf
BLAKE2b-256 f157fbfb6fbeaf213893d165df4124bf18d5ebdef4828faebde8686e0da130c3

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page