Files changed (1) hide show
  1. WNgen.py +3 -0
WNgen.py CHANGED
@@ -187,6 +187,7 @@ def wordnet_df(word,POS=False,seed_definition=None):
187
  df = pd.DataFrame(df)
188
  df = df.drop_duplicates().reset_index()
189
  df = df.drop("index", axis=1)
 
190
  return df
191
 
192
  def eval_pred_test(text, return_all = False):
@@ -292,6 +293,7 @@ def wordnet_parallel_df(word,seed_definition=None):
292
  df = pd.DataFrame(df)
293
  df = df.drop_duplicates("Words").reset_index()
294
  df = df.drop("index", axis=1)
 
295
  return df
296
 
297
  #@st.experimental_singleton(suppress_st_warning=True)
@@ -311,4 +313,5 @@ def cf_from_wordnet_df(seed,text,seed_definition=False):
311
  df["pred"] = df.text.apply(eval_pred_test)
312
  # added this because I think it will make the end results better if we ensure the seed is in the data we generate counterfactuals from.
313
  df['seed'] = df.Words.apply(lambda x: 'seed' if x.lower() == seed.lower() else 'alternative')
 
314
  return df
 
187
  df = pd.DataFrame(df)
188
  df = df.drop_duplicates().reset_index()
189
  df = df.drop("index", axis=1)
190
+ df = df.convert_dtypes()
191
  return df
192
 
193
  def eval_pred_test(text, return_all = False):
 
293
  df = pd.DataFrame(df)
294
  df = df.drop_duplicates("Words").reset_index()
295
  df = df.drop("index", axis=1)
296
+ df = df.convert_dtypes()
297
  return df
298
 
299
  #@st.experimental_singleton(suppress_st_warning=True)
 
313
  df["pred"] = df.text.apply(eval_pred_test)
314
  # added this because I think it will make the end results better if we ensure the seed is in the data we generate counterfactuals from.
315
  df['seed'] = df.Words.apply(lambda x: 'seed' if x.lower() == seed.lower() else 'alternative')
316
+ df = df.convert_dtypes()
317
  return df