lalithadevi commited on
Commit
8e119ad
1 Parent(s): e3e2a58

Update news_category_similar_news_prediction.py

Browse files
news_category_similar_news_prediction.py CHANGED
@@ -203,6 +203,10 @@ def predict_news_category_similar_news(old_news: pd.DataFrame, new_news: pd.Data
203
 
204
  final_df = process_prediction_df(final_df, df_type="production")
205
  prediction_df = new_news.copy()
 
 
 
 
206
  prediction_df = add_flags_to_prediction_df(prediction_df)
207
 
208
  else:
 
203
 
204
  final_df = process_prediction_df(final_df, df_type="production")
205
  prediction_df = new_news.copy()
206
+ prediction_df.loc[(prediction_df['title'].str.contains('Pakistan')) & (prediction_df['category'] == 'NATION'), 'category'] = 'WORLD'
207
+ logger.warning('Updated category of articles having Pakistan in title and category=NATION to WORLD in prediction_df')
208
+ prediction_df.loc[(prediction_df['title'].str.contains('Zodiac Sign', case=False)) | (prediction_df['title'].str.contains('Horoscope', case=False)), 'category'] = 'ASTROLOGY'
209
+ logger.warning('Updated category of articles having Zodiac Sign in title to ASTROLOGY in prediction_df')
210
  prediction_df = add_flags_to_prediction_df(prediction_df)
211
 
212
  else: