prepare usage of cytoscape API
This commit is contained in:
@@ -1,13 +1,14 @@
|
||||
import typing
|
||||
from typing import cast
|
||||
|
||||
from pandas import DataFrame, Series
|
||||
from pandas import DataFrame
|
||||
|
||||
from lang_main.analysis.graphs import TokenGraph
|
||||
from lang_main.analysis.graphs import Graph, TokenGraph, save_to_GraphML
|
||||
from lang_main.constants import (
|
||||
PATH_TO_DATASET,
|
||||
SAVE_PATH_FOLDER,
|
||||
SKIP_GRAPH_POSTPROCESSING,
|
||||
SKIP_GRAPH_RESCALING,
|
||||
SKIP_PREPROCESSING,
|
||||
SKIP_TIME_ANALYSIS,
|
||||
SKIP_TOKEN_ANALYSIS,
|
||||
@@ -20,6 +21,7 @@ from lang_main.pipelines.predefined import (
|
||||
build_timeline_pipe,
|
||||
build_tk_graph_pipe,
|
||||
build_tk_graph_post_pipe,
|
||||
build_tk_graph_rescaling,
|
||||
)
|
||||
from lang_main.types import (
|
||||
EntryPoints,
|
||||
@@ -34,6 +36,7 @@ pipe_target_feat = build_base_target_feature_pipe()
|
||||
pipe_merge = build_merge_duplicates_pipe()
|
||||
pipe_token_analysis = build_tk_graph_pipe()
|
||||
pipe_graph_postprocessing = build_tk_graph_post_pipe()
|
||||
pipe_graph_rescaling = build_tk_graph_rescaling()
|
||||
pipe_timeline = build_timeline_pipe()
|
||||
|
||||
|
||||
@@ -81,6 +84,24 @@ def run_graph_postprocessing() -> None:
|
||||
)
|
||||
|
||||
|
||||
def run_graph_edge_rescaling() -> None:
|
||||
entry_point_path = get_entry_point(SAVE_PATH_FOLDER, EntryPoints.TK_GRAPH_ANALYSIS)
|
||||
loaded_results = cast(
|
||||
tuple[TokenGraph],
|
||||
load_pickle(entry_point_path),
|
||||
)
|
||||
tk_graph = loaded_results[0]
|
||||
ret = cast(
|
||||
tuple[TokenGraph, Graph], pipe_graph_rescaling.run(starting_values=(tk_graph,))
|
||||
)
|
||||
undirected_rescaled_graph = ret[1]
|
||||
save_to_GraphML(
|
||||
undirected_rescaled_graph,
|
||||
saving_path=SAVE_PATH_FOLDER,
|
||||
filename='TokenGraph-undirected-rescaled',
|
||||
)
|
||||
|
||||
|
||||
# ** time analysis
|
||||
def run_time_analysis() -> None:
|
||||
# load entry point
|
||||
@@ -101,6 +122,7 @@ def build_pipeline_container() -> PipelineContainer:
|
||||
container.add(run_preprocessing, skip=SKIP_PREPROCESSING)
|
||||
container.add(run_token_analysis, skip=SKIP_TOKEN_ANALYSIS)
|
||||
container.add(run_graph_postprocessing, skip=SKIP_GRAPH_POSTPROCESSING)
|
||||
container.add(run_graph_edge_rescaling, skip=SKIP_GRAPH_RESCALING)
|
||||
container.add(run_time_analysis, skip=SKIP_TIME_ANALYSIS)
|
||||
|
||||
return container
|
||||
|
||||
@@ -13,9 +13,10 @@ dataset = '../data/02_202307/Export4.csv'
|
||||
# be fully executed
|
||||
[control]
|
||||
preprocessing_skip = true
|
||||
token_analysis_skip = true
|
||||
graph_postprocessing_skip = true
|
||||
time_analysis_skip = false
|
||||
token_analysis_skip = false
|
||||
graph_postprocessing_skip = false
|
||||
graph_rescaling_skip = false
|
||||
time_analysis_skip = true
|
||||
|
||||
#[export_filenames]
|
||||
#filename_cossim_filter_candidates = 'CosSim-FilterCandidates'
|
||||
|
||||
@@ -1,12 +1 @@
|
||||
from lang_main.analysis.preprocessing import clean_string_slim
|
||||
from lang_main.constants import SAVE_PATH_FOLDER
|
||||
|
||||
print(SAVE_PATH_FOLDER)
|
||||
txt = """
|
||||
Wir feiern den Jahrestag am 23.11.2023, olé!
|
||||
tel:::: !!!!???? +++49 123 456 789
|
||||
|
||||
Doch leben wir länger.
|
||||
"""
|
||||
print(txt)
|
||||
print(clean_string_slim(txt))
|
||||
import py4cytoscape
|
||||
|
||||
Reference in New Issue
Block a user