Update app.py
Browse files
app.py
CHANGED
@@ -53,82 +53,138 @@ tone_categories = {
|
|
53 |
# Expanded Frame Categories for Better Categorization
|
54 |
frame_categories = {
|
55 |
"Human Rights & Justice": {
|
56 |
-
"Legal Rights & Reforms": [
|
57 |
-
|
58 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
59 |
},
|
60 |
"Political & State Accountability": {
|
61 |
-
"Corruption & Governance": [
|
62 |
-
|
63 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
64 |
},
|
65 |
"Gender & Patriarchy": {
|
66 |
-
"Gender-Based Violence": [
|
67 |
-
|
68 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
69 |
},
|
70 |
"Religious Freedom & Persecution": {
|
71 |
-
"Religious Discrimination": [
|
72 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
73 |
},
|
74 |
"Grassroots Mobilization": {
|
75 |
-
"Community Activism": [
|
76 |
-
|
77 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
78 |
},
|
79 |
"Environmental Crisis & Activism": {
|
80 |
-
"Climate Change Awareness": [
|
81 |
-
|
82 |
-
|
83 |
-
|
84 |
-
|
85 |
-
|
86 |
-
"
|
87 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
88 |
},
|
89 |
"Social Inequality & Economic Disparities": {
|
90 |
-
"Class Privilege & Labor Rights": [
|
91 |
-
|
92 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
93 |
},
|
94 |
"Activism & Advocacy": {
|
95 |
-
"Policy Advocacy & Legal Reforms": [
|
96 |
-
|
97 |
-
|
98 |
-
|
99 |
-
|
100 |
-
|
101 |
-
|
102 |
-
|
103 |
-
|
104 |
-
|
105 |
-
|
106 |
-
|
107 |
-
|
108 |
-
},
|
109 |
-
"Call to Action": {
|
110 |
-
"Petitions & Direct Action": ["sign petition", "protest", "boycott", "demonstrate", "advocate"],
|
111 |
-
"Fundraising & Support": ["donate", "crowdfunding", "aid support", "mutual aid funds", "relief efforts"],
|
112 |
-
"Policy & Legislative Action": ["policy change", "demand action", "write to lawmakers", "call your representative"]
|
113 |
-
},
|
114 |
-
"Empowerment & Resistance": {
|
115 |
-
"Grassroots Organizing": ["community empowerment", "leadership training", "civil resistance", "community building"],
|
116 |
-
"Revolutionary Movements": ["resistance", "revolt", "revolutionary change", "radical change", "freedom fighters"],
|
117 |
-
"Inspiration & Motivational Messaging": ["hope", "courage", "overcoming struggles", "empowerment", "transformative justice"]
|
118 |
-
},
|
119 |
-
"Climate Justice": {
|
120 |
-
"Indigenous Environmental Activism": ["land rights", "indigenous climate leadership", "tribal land protection", "environmental sovereignty"],
|
121 |
-
"Corporate Accountability": ["big oil", "corporate greed", "environmental negligence", "corporate responsibility"],
|
122 |
-
"Sustainable Development": ["eco-friendly", "renewable energy", "circular economy", "climate resilience"]
|
123 |
-
},
|
124 |
-
"Human Rights Advocacy": {
|
125 |
-
"Criminal Justice Reform": ["police brutality", "wrongful convictions", "prison reform", "mass incarceration"],
|
126 |
-
"Workplace Discrimination & Labor Rights": ["workplace bias", "equal pay", "unions", "workplace harassment"],
|
127 |
-
"International Human Rights": ["humanitarian law", "UN declarations", "international treaties", "human rights violations"]
|
128 |
}
|
129 |
}
|
130 |
|
131 |
|
|
|
132 |
# Detect language
|
133 |
def detect_language(text):
|
134 |
try:
|
|
|
53 |
# Expanded Frame Categories for Better Categorization
|
54 |
frame_categories = {
|
55 |
"Human Rights & Justice": {
|
56 |
+
"Legal Rights & Reforms": [
|
57 |
+
"law", "justice", "legal", "reforms", "legislation", "rights",
|
58 |
+
"human rights", "court", "trial", "lawsuit", "due process"
|
59 |
+
],
|
60 |
+
"Humanitarian Issues": [
|
61 |
+
"humanitarian", "aid", "refugees", "asylum", "crisis response",
|
62 |
+
"displacement", "famine", "disaster relief", "war victims", "NGO support"
|
63 |
+
],
|
64 |
+
"Civil Liberties": [
|
65 |
+
"freedom", "expression", "privacy", "rights violations", "censorship",
|
66 |
+
"surveillance", "press freedom", "free speech", "whistleblower",
|
67 |
+
"journalist safety", "Aurat March censorship", "suppression of student unions"
|
68 |
+
]
|
69 |
},
|
70 |
"Political & State Accountability": {
|
71 |
+
"Corruption & Governance": [
|
72 |
+
"corruption", "government", "policy", "accountability", "transparency",
|
73 |
+
"bribery", "misuse of power", "scandal", "nepotism", "tax fraud",
|
74 |
+
"state repression", "enforced disappearances", "Sindh police brutality",
|
75 |
+
"Baloch missing persons", "PTM protests"
|
76 |
+
],
|
77 |
+
"Political Oppression": [
|
78 |
+
"authoritarianism", "censorship", "state control", "dissent", "crackdown",
|
79 |
+
"political prisoners", "martial law", "dictatorship", "state violence",
|
80 |
+
"student protests", "Aurat March arrests", "crackdown on civil society",
|
81 |
+
"arbitrary arrests"
|
82 |
+
],
|
83 |
+
"Elections & Political Representation": [
|
84 |
+
"voting", "elections", "political participation", "democracy",
|
85 |
+
"voter suppression", "fraud", "ballot", "electoral reform",
|
86 |
+
"reserved seats for minorities", "proportional representation"
|
87 |
+
]
|
88 |
},
|
89 |
"Gender & Patriarchy": {
|
90 |
+
"Gender-Based Violence": [
|
91 |
+
"violence", "domestic abuse", "sexual harassment", "femicide",
|
92 |
+
"sexual assault", "stalking", "forced marriage", "gender violence",
|
93 |
+
"honor killing", "karo kari", "Afshan Jamali", "Sindh Punjab gender violence"
|
94 |
+
],
|
95 |
+
"Women's Rights & Equality": [
|
96 |
+
"gender equality", "feminism", "reproductive rights", "patriarchy",
|
97 |
+
"pay gap", "maternal health", "women's leadership", "workplace discrimination",
|
98 |
+
"gynecological healthcare access", "medical discrimination", "maternal mortality"
|
99 |
+
],
|
100 |
+
"LGBTQ+ Rights": [
|
101 |
+
"queer rights", "LGBTQ+", "gender identity", "trans rights",
|
102 |
+
"homophobia", "pride", "same-sex marriage", "conversion therapy",
|
103 |
+
"non-binary", "Moorat March", "Khwajasira activism",
|
104 |
+
"transgender employment rights", "inheritance rights"
|
105 |
+
]
|
106 |
},
|
107 |
"Religious Freedom & Persecution": {
|
108 |
+
"Religious Discrimination": [
|
109 |
+
"persecution", "intolerance", "sectarianism", "faith-based violence",
|
110 |
+
"hate crime", "blasphemy", "religious hate speech", "sectarian violence",
|
111 |
+
"Shia persecution", "Kurram massacre", "false accusations of blasphemy",
|
112 |
+
"minority safety"
|
113 |
+
],
|
114 |
+
"Religious Minorities' Rights": [
|
115 |
+
"minorities", "blasphemy laws", "religious freedom", "forced conversion",
|
116 |
+
"places of worship", "religious refugee", "interfaith dialogue",
|
117 |
+
"Hindu abductions", "Christian forced conversions", "job discrimination",
|
118 |
+
"sectarian attacks", "church attacks"
|
119 |
+
]
|
120 |
},
|
121 |
"Grassroots Mobilization": {
|
122 |
+
"Community Activism": [
|
123 |
+
"activism", "grassroots", "volunteering", "local organizing",
|
124 |
+
"community engagement", "mutual aid", "citizen action"
|
125 |
+
],
|
126 |
+
"Protests & Demonstrations": [
|
127 |
+
"march", "strike", "rally", "sit-in", "boycott", "mass mobilization",
|
128 |
+
"civil disobedience", "public gathering"
|
129 |
+
],
|
130 |
+
"Coalition Building": [
|
131 |
+
"solidarity", "collaboration", "alliances", "mutual aid", "networking",
|
132 |
+
"joint statement", "collective movement"
|
133 |
+
]
|
134 |
},
|
135 |
"Environmental Crisis & Activism": {
|
136 |
+
"Climate Change Awareness": [
|
137 |
+
"climate crisis", "global warming", "carbon emissions", "fossil fuels",
|
138 |
+
"sea level rise", "heatwaves", "melting ice caps", "mining protests",
|
139 |
+
"natural resource exploitation", "Indus River", "water rights",
|
140 |
+
"deforestation protests"
|
141 |
+
],
|
142 |
+
"Conservation & Sustainability": [
|
143 |
+
"deforestation", "wildlife protection", "biodiversity", "reforestation",
|
144 |
+
"green energy", "sustainable agriculture", "plastic pollution"
|
145 |
+
],
|
146 |
+
"Environmental Justice": [
|
147 |
+
"pollution", "water crisis", "land rights", "indigenous rights",
|
148 |
+
"eco-activism", "environmental racism", "waste management",
|
149 |
+
"Karoonjhar Mountain", "Indus canal project", "farmer displacement",
|
150 |
+
"eco-resistance", "local activism"
|
151 |
+
]
|
152 |
},
|
153 |
"Social Inequality & Economic Disparities": {
|
154 |
+
"Class Privilege & Labor Rights": [
|
155 |
+
"classism", "labor rights", "unions", "wage gap", "worker exploitation",
|
156 |
+
"fair wages", "labor strikes", "sanitation worker discrimination",
|
157 |
+
"labor exploitation", "economic justice for minorities"
|
158 |
+
],
|
159 |
+
"Poverty & Economic Justice": [
|
160 |
+
"poverty", "inequality", "economic disparity", "wealth gap",
|
161 |
+
"unemployment", "food insecurity"
|
162 |
+
],
|
163 |
+
"Housing & Healthcare": [
|
164 |
+
"housing crisis", "healthcare access", "social safety nets",
|
165 |
+
"homelessness", "medicaid", "affordable housing",
|
166 |
+
"gynecological healthcare access", "medical discrimination", "maternal mortality"
|
167 |
+
]
|
168 |
},
|
169 |
"Activism & Advocacy": {
|
170 |
+
"Policy Advocacy & Legal Reforms": [
|
171 |
+
"campaign", "policy change", "legal advocacy", "legislative reform",
|
172 |
+
"policy shift", "lobbying"
|
173 |
+
],
|
174 |
+
"Social Media Activism": [
|
175 |
+
"hashtags", "digital activism", "awareness campaign",
|
176 |
+
"viral movement", "online protest", "cyber activism",
|
177 |
+
"online organizing", "Twitter Spaces", "digital protest movements"
|
178 |
+
],
|
179 |
+
"Freedom of Expression & Press": [
|
180 |
+
"press freedom", "censorship", "media rights", "journalist safety",
|
181 |
+
"fake news", "whistleblowing"
|
182 |
+
]
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
183 |
}
|
184 |
}
|
185 |
|
186 |
|
187 |
+
|
188 |
# Detect language
|
189 |
def detect_language(text):
|
190 |
try:
|