risk-network 0.0.9b17__py3-none-any.whl → 0.0.9b18__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- risk/__init__.py +1 -1
- risk/network/plot/labels.py +30 -36
- {risk_network-0.0.9b17.dist-info → risk_network-0.0.9b18.dist-info}/METADATA +1 -1
- {risk_network-0.0.9b17.dist-info → risk_network-0.0.9b18.dist-info}/RECORD +7 -7
- {risk_network-0.0.9b17.dist-info → risk_network-0.0.9b18.dist-info}/LICENSE +0 -0
- {risk_network-0.0.9b17.dist-info → risk_network-0.0.9b18.dist-info}/WHEEL +0 -0
- {risk_network-0.0.9b17.dist-info → risk_network-0.0.9b18.dist-info}/top_level.txt +0 -0
risk/__init__.py
CHANGED
risk/network/plot/labels.py
CHANGED
@@ -564,39 +564,39 @@ class Labels:
|
|
564
564
|
|
565
565
|
Returns:
|
566
566
|
bool: True if the domain is valid and added to the filtered dictionaries, False otherwise.
|
567
|
-
|
568
|
-
Note:
|
569
|
-
The `filtered_domain_centroids`, `filtered_domain_terms`, and `valid_indices` are modified in-place.
|
570
567
|
"""
|
571
|
-
|
572
|
-
|
573
|
-
|
574
|
-
|
575
|
-
|
576
|
-
|
577
|
-
|
578
|
-
|
579
|
-
|
580
|
-
|
581
|
-
|
582
|
-
|
583
|
-
|
584
|
-
|
585
|
-
|
586
|
-
|
587
|
-
|
588
|
-
|
589
|
-
|
590
|
-
|
591
|
-
|
592
|
-
|
593
|
-
|
594
|
-
|
568
|
+
if ids_to_labels and domain in ids_to_labels:
|
569
|
+
# Directly use custom labels without filtering
|
570
|
+
domain_terms = ids_to_labels[domain]
|
571
|
+
else:
|
572
|
+
# Process the domain terms automatically
|
573
|
+
domain_terms = self._process_terms(
|
574
|
+
domain=domain,
|
575
|
+
words_to_omit=words_to_omit,
|
576
|
+
max_label_lines=max_label_lines,
|
577
|
+
min_chars_per_line=min_chars_per_line,
|
578
|
+
max_chars_per_line=max_chars_per_line,
|
579
|
+
)
|
580
|
+
# If no valid terms are generated, skip further processing
|
581
|
+
if not domain_terms:
|
582
|
+
return False
|
583
|
+
|
584
|
+
# Split the terms by TERM_DELIMITER and count the number of lines
|
585
|
+
num_domain_lines = len(domain_terms.split(TERM_DELIMITER))
|
586
|
+
# Check if the number of lines meets the minimum requirement
|
587
|
+
if num_domain_lines < min_label_lines:
|
588
|
+
return False
|
589
|
+
|
590
|
+
# Store the valid terms and centroids
|
591
|
+
filtered_domain_centroids[domain] = domain_centroid
|
592
|
+
filtered_domain_terms[domain] = domain_terms
|
593
|
+
valid_indices.append(list(domain_id_to_centroid_map.keys()).index(domain))
|
594
|
+
|
595
|
+
return True
|
595
596
|
|
596
597
|
def _process_terms(
|
597
598
|
self,
|
598
599
|
domain: str,
|
599
|
-
ids_to_labels: Union[Dict[int, str], None],
|
600
600
|
words_to_omit: Union[List[str], None],
|
601
601
|
max_label_lines: int,
|
602
602
|
min_chars_per_line: int,
|
@@ -606,7 +606,6 @@ class Labels:
|
|
606
606
|
|
607
607
|
Args:
|
608
608
|
domain (str): The domain being processed.
|
609
|
-
ids_to_labels (Dict[int, str], None): Dictionary mapping domain IDs to custom labels.
|
610
609
|
words_to_omit (List[str], None): List of words to omit from the labels.
|
611
610
|
max_label_lines (int): Maximum number of lines in a label.
|
612
611
|
min_chars_per_line (int): Minimum number of characters in a line to display.
|
@@ -615,13 +614,8 @@ class Labels:
|
|
615
614
|
Returns:
|
616
615
|
str: Processed terms separated by TERM_DELIMITER, with words combined if necessary to fit within constraints.
|
617
616
|
"""
|
618
|
-
#
|
619
|
-
|
620
|
-
return ids_to_labels[domain]
|
621
|
-
|
622
|
-
else:
|
623
|
-
terms = self.graph.domain_id_to_domain_terms_map[domain].split(" ")
|
624
|
-
|
617
|
+
# Set custom labels from significant terms
|
618
|
+
terms = self.graph.domain_id_to_domain_terms_map[domain].split(" ")
|
625
619
|
# Apply words_to_omit and word length constraints
|
626
620
|
if words_to_omit:
|
627
621
|
terms = [
|
@@ -1,4 +1,4 @@
|
|
1
|
-
risk/__init__.py,sha256=
|
1
|
+
risk/__init__.py,sha256=9v2jfoqP2gtVfXHiTuxLNyDIkjAfdwBx1dv421Qem_w,127
|
2
2
|
risk/constants.py,sha256=XInRaH78Slnw_sWgAsBFbUHkyA0h0jL0DKGuQNbOvjM,550
|
3
3
|
risk/risk.py,sha256=nodTixy31O3VK7ld-g74Fb9YEiyvKs_Vbor2lE2ADJ8,23632
|
4
4
|
risk/annotations/__init__.py,sha256=kXgadEXaCh0z8OyhOhTj7c3qXGmWgOhaSZ4gSzSb59U,147
|
@@ -20,7 +20,7 @@ risk/network/graph/summary.py,sha256=7w5gNYNspv02SscDAfHxdx-D1CWKmelSonyBnB9hbrE
|
|
20
20
|
risk/network/plot/__init__.py,sha256=MfmaXJgAZJgXZ2wrhK8pXwzETlcMaLChhWXKAozniAo,98
|
21
21
|
risk/network/plot/canvas.py,sha256=W8dFv4XYTzCWXBchgsc0esOQRn4usM4LkwNGPSDMobE,13357
|
22
22
|
risk/network/plot/contour.py,sha256=zM2oRbiGbKHi9fWL7QNcwnTRkxCuQYEwH2mm6TaN_hw,15499
|
23
|
-
risk/network/plot/labels.py,sha256=
|
23
|
+
risk/network/plot/labels.py,sha256=fqBxQ1FoWI-la_7fEWAXWf0eaMWB01AeSasHYccf0gA,45452
|
24
24
|
risk/network/plot/network.py,sha256=0j7pAZgt9PBfFCnOz4QwXnYWTlnLjTrtMm-50I_1G8o,14028
|
25
25
|
risk/network/plot/plotter.py,sha256=eS1vHqvOA2O001Rq7WiDcgqcehJ3fg4OPfvkezH4erw,5771
|
26
26
|
risk/network/plot/utils/colors.py,sha256=9zuU2O-Nkpljb1yVGUR_IjqD1y-wH6Bf6Vm1MMVB0Lo,18718
|
@@ -32,8 +32,8 @@ risk/stats/stats.py,sha256=z8NrhiVj4BzJ250bVLfytpmfC7RzYu7mBuIZD_l0aCA,7222
|
|
32
32
|
risk/stats/permutation/__init__.py,sha256=neJp7FENC-zg_CGOXqv-iIvz1r5XUKI9Ruxhmq7kDOI,105
|
33
33
|
risk/stats/permutation/permutation.py,sha256=jfo7J7bjXTHH-k6_WuZ_5eB31JVynlI6SYMC_7icYyM,10320
|
34
34
|
risk/stats/permutation/test_functions.py,sha256=lftOude6hee0pyR80HlBD32522JkDoN5hrKQ9VEbuoY,2345
|
35
|
-
risk_network-0.0.
|
36
|
-
risk_network-0.0.
|
37
|
-
risk_network-0.0.
|
38
|
-
risk_network-0.0.
|
39
|
-
risk_network-0.0.
|
35
|
+
risk_network-0.0.9b18.dist-info/LICENSE,sha256=jOtLnuWt7d5Hsx6XXB2QxzrSe2sWWh3NgMfFRetluQM,35147
|
36
|
+
risk_network-0.0.9b18.dist-info/METADATA,sha256=p5vaR2ISJ8R2K6HG6IBH_MzKf2MVyFrnV3Q7o55TfnQ,47627
|
37
|
+
risk_network-0.0.9b18.dist-info/WHEEL,sha256=In9FTNxeP60KnTkGw7wk6mJPYd_dQSjEZmXdBdMCI-8,91
|
38
|
+
risk_network-0.0.9b18.dist-info/top_level.txt,sha256=NX7C2PFKTvC1JhVKv14DFlFAIFnKc6Lpsu1ZfxvQwVw,5
|
39
|
+
risk_network-0.0.9b18.dist-info/RECORD,,
|
File without changes
|
File without changes
|
File without changes
|