Commit
•
69f3949
1
Parent(s):
4c85bef
Update news_category_similar_news_prediction.py
Browse files
news_category_similar_news_prediction.py
CHANGED
@@ -146,8 +146,8 @@ def predict_news_category_similar_news(old_news: pd.DataFrame, new_news: pd.Data
|
|
146 |
final_df.loc[final_df['pred_proba']<CLASSIFIER_THRESHOLD, 'category'] = 'OTHERS'
|
147 |
final_df.loc[(final_df['title'].str.contains('Pakistan')) & (final_df['category'] == 'NATION'), 'category'] = 'WORLD'
|
148 |
logger.warning('Updated category of articles having Pakistan in title and category=NATION to WORLD')
|
149 |
-
final_df.loc[(final_df['title'].str.contains('Zodiac Sign', case=False)) | (final_df['title'].str.contains('Horoscope', case=False)), 'category'] = '
|
150 |
-
logger.warning('Updated category of articles having Zodiac Sign in title to
|
151 |
else:
|
152 |
logger.warning('Prior predictions found in old news')
|
153 |
if not cols_check([*new_news.columns], [*old_news.columns][:-3]):
|
@@ -175,8 +175,8 @@ def predict_news_category_similar_news(old_news: pd.DataFrame, new_news: pd.Data
|
|
175 |
final_df.loc[final_df['pred_proba']<CLASSIFIER_THRESHOLD, 'category'] = 'OTHERS'
|
176 |
final_df.loc[(final_df['title'].str.contains('Pakistan')) & (final_df['category'] == 'NATION'), 'category'] = 'WORLD'
|
177 |
logger.warning('Updated category of articles having Pakistan in title and category=NATION to WORLD')
|
178 |
-
final_df.loc[(final_df['title'].str.contains('Zodiac Sign', case=False)) | (final_df['title'].str.contains('Horoscope', case=False)), 'category'] = '
|
179 |
-
logger.warning('Updated category of articles having Zodiac Sign in title to
|
180 |
else:
|
181 |
logger.warning('INFO: Old & New Articles are the same. There is no requirement of updating them in the database. Database is not updated.')
|
182 |
db_updation_required = 0
|
|
|
146 |
final_df.loc[final_df['pred_proba']<CLASSIFIER_THRESHOLD, 'category'] = 'OTHERS'
|
147 |
final_df.loc[(final_df['title'].str.contains('Pakistan')) & (final_df['category'] == 'NATION'), 'category'] = 'WORLD'
|
148 |
logger.warning('Updated category of articles having Pakistan in title and category=NATION to WORLD')
|
149 |
+
final_df.loc[(final_df['title'].str.contains('Zodiac Sign', case=False)) | (final_df['title'].str.contains('Horoscope', case=False)), 'category'] = 'SCIENCE'
|
150 |
+
logger.warning('Updated category of articles having Zodiac Sign in title to SCIENCE')
|
151 |
else:
|
152 |
logger.warning('Prior predictions found in old news')
|
153 |
if not cols_check([*new_news.columns], [*old_news.columns][:-3]):
|
|
|
175 |
final_df.loc[final_df['pred_proba']<CLASSIFIER_THRESHOLD, 'category'] = 'OTHERS'
|
176 |
final_df.loc[(final_df['title'].str.contains('Pakistan')) & (final_df['category'] == 'NATION'), 'category'] = 'WORLD'
|
177 |
logger.warning('Updated category of articles having Pakistan in title and category=NATION to WORLD')
|
178 |
+
final_df.loc[(final_df['title'].str.contains('Zodiac Sign', case=False)) | (final_df['title'].str.contains('Horoscope', case=False)), 'category'] = 'SCIENCE'
|
179 |
+
logger.warning('Updated category of articles having Zodiac Sign in title to SCIENCE')
|
180 |
else:
|
181 |
logger.warning('INFO: Old & New Articles are the same. There is no requirement of updating them in the database. Database is not updated.')
|
182 |
db_updation_required = 0
|