cibmangotree.analyzers
¶
Modules:
| Name | Description |
|---|---|
hashtags |
|
ngrams |
|
time_coordination |
|
Modules¶
hashtags
¶
Modules:
| Name | Description |
|---|---|
hashtags_base |
|
Modules¶
hashtags_base
¶
Modules:
| Name | Description |
|---|---|
main |
|
main
¶Functions:
| Name | Description |
|---|---|
gini |
Parameters |
gini(x)
¶Parameters¶
x : pl.Series polars Series containing values for which to compute the Gini coefficient
Returns¶
float Gini coefficient (between 0.0 and 1.0)
Source code in src/cibmangotree/analyzers/hashtags/hashtags_base/main.py
27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 | |
ngrams
¶
Modules:
| Name | Description |
|---|---|
ngrams_base |
|
ngrams_stats |
|
Modules¶
ngrams_base
¶
Modules:
| Name | Description |
|---|---|
main |
|
main
¶Functions:
| Name | Description |
|---|---|
ngrams |
Generate n-grams from list of tokens. |
serialize_ngram |
Generates a string that uniquely represents an ngram |
ngrams(tokens, min, max)
¶Generate n-grams from list of tokens.
Source code in src/cibmangotree/analyzers/ngrams/ngrams_base/main.py
504 505 506 507 508 509 510 | |
serialize_ngram(ngram)
¶Generates a string that uniquely represents an ngram
Source code in src/cibmangotree/analyzers/ngrams/ngrams_base/main.py
513 514 515 | |
time_coordination
¶
Modules:
| Name | Description |
|---|---|
graph_utils |
Weight-based graph cutting helpers. |
time_coordination_base |
|
Modules¶
graph_utils
¶
Weight-based graph cutting helpers.
Ported from cib-time-analysis modules/my_graph.py — pure graph helpers only
(no NiceGUI session / dataset-index wiring).
Functions:
| Name | Description |
|---|---|
cut_graph_by_weight |
Build a small graph of the strongest |
graph_from_edges_df |
Rebuild a NetworkX graph from the primary |
ranked_edges |
Strongest edges first, capped at limit. Does not copy G. |
remember_top_edges |
Store the strongest links on |
cut_graph_by_weight(G, num_top)
¶Build a small graph of the strongest num_top links.
Source code in src/cibmangotree/analyzers/time_coordination/graph_utils.py
41 42 43 44 45 46 47 48 | |
graph_from_edges_df(edges_df)
¶Rebuild a NetworkX graph from the primary edges parquet/table.
Source code in src/cibmangotree/analyzers/time_coordination/graph_utils.py
51 52 53 54 55 56 57 58 59 60 61 | |
ranked_edges(G, limit)
¶Strongest edges first, capped at limit. Does not copy G.
Source code in src/cibmangotree/analyzers/time_coordination/graph_utils.py
16 17 18 19 20 21 22 23 | |
remember_top_edges(G, limit=EXPLORE_MAX_PAIRS, progress=None)
¶Store the strongest links on G for Explore to slice.
Source code in src/cibmangotree/analyzers/time_coordination/graph_utils.py
26 27 28 29 30 31 32 33 34 35 36 37 38 | |
time_coordination_base
¶
Modules:
| Name | Description |
|---|---|
analysis |
Posting-time similarity graphs. |
main |
Primary entry: mapped posts → time-coordination graph → posts + edges parquet. |
analysis
¶Posting-time similarity graphs.
Ported from cib-time-analysis app/time_analysis.py. Dataset-button /
hardcoded CSV path wiring is replaced by PreparedData (mapped input) or
DatasetSpec (path-based, mainly for tests).
Classes:
| Name | Description |
|---|---|
PreparedData |
In-memory posts already sorted with |
Functions:
| Name | Description |
|---|---|
ado_window |
Score each post against the other accounts active in the following window. |
content_for_user |
Extract post text + timestamps for one user from an already-loaded frame. |
get_tvec |
Activity vector for one account. |
overlapping_content_for_users |
Posts from either user that fall within dt of at least one post by the other. |
prepare_dataframe |
Drop incomplete rows, add |
time_overlap |
Connect accounts whose binned activity overlaps. |
PreparedData
¶
Bases: NamedTuple
In-memory posts already sorted with rel_timestamp (mapped analyzer input).
Source code in src/cibmangotree/analyzers/time_coordination/time_coordination_base/analysis.py
40 41 42 43 44 45 46 | |
ado_window(data_set, managed_progress_value, win_size=2, t_step=60, phase=None)
¶Score each post against the other accounts active in the following window.
left and right index the sorted posts. in_window holds how many
posts each account has between those indexes. Edge weight is that count;
norm_weight divides it by the number of posts in the slice.
Source code in src/cibmangotree/analyzers/time_coordination/time_coordination_base/analysis.py
161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 | |
content_for_user(user, df, user_col_name, content_col_name, time_col_name)
¶Extract post text + timestamps for one user from an already-loaded frame.
Source code in src/cibmangotree/analyzers/time_coordination/time_coordination_base/analysis.py
253 254 255 256 257 258 259 | |
get_tvec(user, df, user_col_name, t_step=1)
¶Activity vector for one account.
Marks each second that has a post, then sums those marks into bins of
t_step seconds. time_overlap matches this binning in
_activity_matrix and does not build this per-second vector per account.
Source code in src/cibmangotree/analyzers/time_coordination/time_coordination_base/analysis.py
335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 | |
overlapping_content_for_users(user0, user1, df, user_col_name, content_col_name, time_col_name, dt)
¶Posts from either user that fall within dt of at least one post by the other.
Returns a list of (user, content, display_time) sorted by relative timestamp.
Source code in src/cibmangotree/analyzers/time_coordination/time_coordination_base/analysis.py
282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 | |
prepare_dataframe(df, time_col_name, user_col_name, content_col_name, progress=None)
¶Drop incomplete rows, add rel_timestamp, sort — same prep as read_csv.
Source code in src/cibmangotree/analyzers/time_coordination/time_coordination_base/analysis.py
49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 | |
time_overlap(data_set, managed_progress_value, win_size=2, t_step=60, min_posts=DEFAULT_MIN_POSTS, phase=None)
¶Connect accounts whose binned activity overlaps.
Source code in src/cibmangotree/analyzers/time_coordination/time_coordination_base/analysis.py
399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 | |