Spaces:
Runtime error
Runtime error
Fixed bug in frontend when ordering list of PLL scores in module_customPllLabel.py
Browse files
modules/module_customPllLabel.py
CHANGED
@@ -98,13 +98,14 @@ class CustomPllLabel:
|
|
98 |
pll_dict: Dict[str, float]
|
99 |
) -> str:
|
100 |
|
101 |
-
sorted_pll_dict =
|
102 |
-
|
103 |
-
sents =
|
|
|
|
|
104 |
# Scape < and > marks from hightlight word/s
|
105 |
-
sents = [s.replace("<","<").replace(">",">")for s in sents]
|
106 |
|
107 |
-
scores = list(sorted_pll_dict.values())
|
108 |
ratios = self.__getProportions(scores)
|
109 |
-
|
110 |
-
return self.__render(sents, scores, ratios)
|
|
|
98 |
pll_dict: Dict[str, float]
|
99 |
) -> str:
|
100 |
|
101 |
+
sorted_pll_dict = sorted(pll_dict.items(), key=lambda x: x[1], reverse=True)
|
102 |
+
|
103 |
+
sents = [k for k,_ in sorted_pll_dict]
|
104 |
+
scores = [v for _,v in sorted_pll_dict]
|
105 |
+
|
106 |
# Scape < and > marks from hightlight word/s
|
107 |
+
sents = [s.replace("<","<").replace(">",">") for s in sents]
|
108 |
|
|
|
109 |
ratios = self.__getProportions(scores)
|
110 |
+
|
111 |
+
return self.__render(sents, scores, ratios)
|