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.4.tar.gz (25.4 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.4-py3-none-any.whl (27.7 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: charnet-0.0.4.tar.gz
  • Upload date:
  • Size: 25.4 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.4.tar.gz
Algorithm Hash digest
SHA256 bcf16635bd0f694d417e50923b737a37b701feacf03655740c415d498df64169
MD5 aa01fa42a9d83c3db3548ddf38b2b443
BLAKE2b-256 5ef9dff009c7bbe59e124af1a6b28a7ccc3dc09731c4f3dafca2511c3f86769d

See more details on using hashes here.

File details

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

File metadata

  • Download URL: charnet-0.0.4-py3-none-any.whl
  • Upload date:
  • Size: 27.7 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.4-py3-none-any.whl
Algorithm Hash digest
SHA256 4811de9faa8640f8652f2664dee1f8df7a5e02aa64949e82dc880df78e2574ac
MD5 6a107299a15c534315dedf82028bd895
BLAKE2b-256 4d89546e0a6709998225e8ffa64be547f9e8525aa30b26f133f6d93eaf996c5f

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