ahm14 commited on
Commit
5a05bef
·
verified ·
1 Parent(s): c3614ab

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +114 -58
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": ["law", "justice", "legal", "reforms", "legislation", "rights", "human rights", "court", "trial", "lawsuit", "due process"],
57
- "Humanitarian Issues": ["humanitarian", "aid", "refugees", "asylum", "crisis response", "displacement", "famine", "disaster relief", "war victims", "NGO support"],
58
- "Civil Liberties": ["freedom", "expression", "privacy", "rights violations", "censorship", "surveillance", "press freedom", "free speech", "whistleblower"]
 
 
 
 
 
 
 
 
 
 
59
  },
60
  "Political & State Accountability": {
61
- "Corruption & Governance": ["corruption", "government", "policy", "accountability", "transparency", "bribery", "misuse of power", "scandal", "nepotism", "tax fraud"],
62
- "Political Oppression": ["authoritarianism", "censorship", "state control", "dissent", "crackdown", "political prisoners", "martial law", "dictatorship", "state violence"],
63
- "Elections & Political Representation": ["voting", "elections", "political participation", "democracy", "voter suppression", "fraud", "ballot", "electoral reform"]
 
 
 
 
 
 
 
 
 
 
 
 
 
 
64
  },
65
  "Gender & Patriarchy": {
66
- "Gender-Based Violence": ["violence", "domestic abuse", "sexual harassment", "femicide", "sexual assault", "stalking", "forced marriage", "gender violence"],
67
- "Women's Rights & Equality": ["gender equality", "feminism", "reproductive rights", "patriarchy", "pay gap", "maternal health", "women's leadership", "workplace discrimination"],
68
- "LGBTQ+ Rights": ["queer rights", "LGBTQ+", "gender identity", "trans rights", "homophobia", "pride", "same-sex marriage", "conversion therapy", "non-binary"]
 
 
 
 
 
 
 
 
 
 
 
 
 
69
  },
70
  "Religious Freedom & Persecution": {
71
- "Religious Discrimination": ["persecution", "intolerance", "sectarianism", "faith-based violence", "hate crime", "blasphemy", "religious hate speech"],
72
- "Religious Minorities' Rights": ["minorities", "blasphemy laws", "religious freedom", "forced conversion", "places of worship", "religious refugee", "interfaith dialogue"]
 
 
 
 
 
 
 
 
 
 
73
  },
74
  "Grassroots Mobilization": {
75
- "Community Activism": ["activism", "grassroots", "volunteering", "local organizing", "community engagement", "mutual aid", "citizen action"],
76
- "Protests & Demonstrations": ["march", "strike", "rally", "sit-in", "boycott", "mass mobilization", "civil disobedience", "public gathering"],
77
- "Coalition Building": ["solidarity", "collaboration", "alliances", "mutual aid", "networking", "joint statement", "collective movement"]
 
 
 
 
 
 
 
 
 
78
  },
79
  "Environmental Crisis & Activism": {
80
- "Climate Change Awareness": ["climate crisis", "global warming", "carbon emissions", "fossil fuels", "sea level rise", "heatwaves", "melting ice caps"],
81
- "Conservation & Sustainability": ["deforestation", "wildlife protection", "biodiversity", "reforestation", "green energy", "sustainable agriculture", "plastic pollution"],
82
- "Environmental Justice": ["pollution", "water crisis", "land rights", "indigenous rights", "eco-activism", "environmental racism", "waste management"]
83
- },
84
- "Anti-Extremism & Anti-Violence": {
85
- "Hate Speech & Radicalization": ["hate speech", "extremism", "online radicalization", "propaganda", "far-right groups", "hate groups"],
86
- "Mob & Sectarian Violence": ["mob attack", "lynching", "sectarian violence", "hate crimes", "communal riots", "armed militia"],
87
- "Counterterrorism & De-Radicalization": ["terrorism", "prevention", "peacebuilding", "rehabilitation", "extremist ideology", "security policy"]
 
 
 
 
 
 
 
 
88
  },
89
  "Social Inequality & Economic Disparities": {
90
- "Class Privilege & Labor Rights": ["classism", "labor rights", "unions", "wage gap", "worker exploitation", "fair wages", "labor strikes"],
91
- "Poverty & Economic Justice": ["poverty", "inequality", "economic disparity", "wealth gap", "unemployment", "food insecurity"],
92
- "Housing & Healthcare": ["housing crisis", "healthcare access", "social safety nets", "homelessness", "medicaid", "affordable housing"]
 
 
 
 
 
 
 
 
 
 
 
93
  },
94
  "Activism & Advocacy": {
95
- "Policy Advocacy & Legal Reforms": ["campaign", "policy change", "legal advocacy", "legislative reform", "policy shift", "lobbying"],
96
- "Social Media Activism": ["hashtags", "digital activism", "awareness campaign", "viral movement", "online protest", "cyber activism"],
97
- "Freedom of Expression & Press": ["press freedom", "censorship", "media rights", "journalist safety", "fake news", "whistleblowing"]
98
- },
99
- "Systemic Oppression": {
100
- "Marginalized Communities": ["minorities", "exclusion", "systemic discrimination", "oppression", "intersectionality"],
101
- "Racial & Ethnic Discrimination": ["racism", "xenophobia", "ethnic cleansing", "casteism", "racial profiling", "hate speech"],
102
- "Institutional Bias": ["institutional racism", "structural oppression", "biased laws", "discriminatory policies"]
103
- },
104
- "Intersectionality": {
105
- "Multiple Oppressions": ["overlapping struggles", "intersecting identities", "double discrimination", "marginalization"],
106
- "Women & Marginalized Identities": ["feminism", "queer feminism", "minority women", "disabled women", "indigenous women"],
107
- "Global Solidarity Movements": ["transnational activism", "cross-movement solidarity", "international justice"]
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: