ppsingh commited on
Commit
0ea7c9a
1 Parent(s): fd40c74

add conditionality

Browse files
app.py CHANGED
@@ -61,7 +61,7 @@ with st.expander("ℹ️ - About this app", expanded=False):
61
  wide scale. """)
62
  st.write("")
63
  apps = [processing.app, target_extraction.app, netzero.app, ghg.app,
64
- policyaction.app]#, indicator.app]
65
  #conditional.app, sector.app]
66
  #adapmit.app]
67
 
 
61
  wide scale. """)
62
  st.write("")
63
  apps = [processing.app, target_extraction.app, netzero.app, ghg.app,
64
+ policyaction.app, conditional.app, sector.app]#, indicator.app]
65
  #conditional.app, sector.app]
66
  #adapmit.app]
67
 
utils/conditional_classifier.py CHANGED
@@ -71,10 +71,15 @@ def conditional_classification(haystack_doc:pd.DataFrame,
71
  logging.info("Working on Conditionality Identification")
72
  haystack_doc['Conditional Label'] = 'NA'
73
  haystack_doc['Conditional Score'] = 'NA'
 
 
 
 
 
74
  # we apply Netzero to only paragraphs which are classified as 'Target' related
75
- temp = haystack_doc[haystack_doc['Target Label'] == 'TARGET']
76
  temp = temp.reset_index(drop=True)
77
- df = haystack_doc[haystack_doc['Target Label'] == 'NEGATIVE']
78
  df = df.reset_index(drop=True)
79
 
80
  if not classifier_model:
 
71
  logging.info("Working on Conditionality Identification")
72
  haystack_doc['Conditional Label'] = 'NA'
73
  haystack_doc['Conditional Score'] = 'NA'
74
+ haystack_doc['cond_check'] = False
75
+ haystack_doc['cond_check'] = haystack_doc.apply(lambda x: True if (
76
+ (x['Target Label'] == 'TARGET') | (x['Action Label'] == 'Action') |
77
+ (x['Policies_Plans Label'] == 'Policies and Plans')) else
78
+ False, axis=1)
79
  # we apply Netzero to only paragraphs which are classified as 'Target' related
80
+ temp = haystack_doc[haystack_doc['cond_check'] == True]
81
  temp = temp.reset_index(drop=True)
82
+ df = haystack_doc[haystack_doc['cond_check'] == False]
83
  df = df.reset_index(drop=True)
84
 
85
  if not classifier_model:
utils/policyaction_classifier.py CHANGED
@@ -88,7 +88,7 @@ def policyaction_classification(haystack_doc:pd.DataFrame,
88
  truth_df = truth_df.astype(str)
89
  truth_df.rename(columns = {'Action':'Action Label','Policies & Plans':'Policies_Plans Label'},
90
  inplace =True)
91
- st.dataframe(truth_df)
92
  truth_df['Action Label'] = truth_df['Action Label'].apply(lambda x: 'Action' if x == 'True'
93
  else 'NEGATIVE')
94
  truth_df['Policies_Plans Label'] = truth_df['Policies_Plans Label'].apply(lambda x:
 
88
  truth_df = truth_df.astype(str)
89
  truth_df.rename(columns = {'Action':'Action Label','Policies & Plans':'Policies_Plans Label'},
90
  inplace =True)
91
+ # st.dataframe(truth_df)
92
  truth_df['Action Label'] = truth_df['Action Label'].apply(lambda x: 'Action' if x == 'True'
93
  else 'NEGATIVE')
94
  truth_df['Policies_Plans Label'] = truth_df['Policies_Plans Label'].apply(lambda x: