# ---
# jupyter:
#   jupytext:
#     text_representation:
#       extension: .py
#       format_name: light
#       format_version: '1.5'
#       jupytext_version: 1.14.4
#   kernelspec:
#     display_name: Python 3
#     language: python
#     name: python3
# ---

import coordination_network_toolkit as coord_net_tk
import networkx as nx

# ## Data parameters

csv_filename = "sample_data.csv"
db_name = "example.db"

# ## Process data

# +
# Preprocess CSV data into database
coord_net_tk.preprocess.preprocess_csv_files(db_name, [csv_filename])

# Calculate similarity network
coord_net_tk.compute_networks.compute_co_similar_tweet(db_name, 60)
# -

# ## Load data as a networkx graph

similarity_graph = coord_net_tk.graph.load_networkx_graph(db_name, "co_similar_tweet")

# ## Play with the graph!

similarity_graph.nodes()

similarity_graph.edges()

for g in nx.connected_components(similarity_graph):
    print(g)

# ## Clean up database

import os
os.remove(db_name)

StarcoderdataJupyterScriptsDedupFiltered