|
@@ -640,16 +640,29 @@ class AttributeQualityScorer:
|
|
|
logger.warning(f"Content Rules scorer not available: {e}")
|
|
logger.warning(f"Content Rules scorer not available: {e}")
|
|
|
|
|
|
|
|
# UPDATED WEIGHTS (Total = 100%)
|
|
# UPDATED WEIGHTS (Total = 100%)
|
|
|
|
|
+
|
|
|
|
|
+ # self.weights = {
|
|
|
|
|
+ # 'mandatory_fields': 0.16,
|
|
|
|
|
+ # 'standardization': 0.12,
|
|
|
|
|
+ # 'missing_values': 0.08,
|
|
|
|
|
+ # 'consistency': 0.04,
|
|
|
|
|
+ # 'seo_discoverability': 0.08,
|
|
|
|
|
+ # 'content_rules_compliance': 0.12,
|
|
|
|
|
+ # 'title_quality': 0.08,
|
|
|
|
|
+ # 'description_quality': 0.12,
|
|
|
|
|
+ # 'image_quality': 0.20
|
|
|
|
|
+ # }
|
|
|
|
|
+
|
|
|
self.weights = {
|
|
self.weights = {
|
|
|
- 'mandatory_fields': 0.16,
|
|
|
|
|
- 'standardization': 0.12,
|
|
|
|
|
- 'missing_values': 0.08,
|
|
|
|
|
- 'consistency': 0.04,
|
|
|
|
|
- 'seo_discoverability': 0.08,
|
|
|
|
|
- 'content_rules_compliance': 0.12,
|
|
|
|
|
- 'title_quality': 0.08,
|
|
|
|
|
- 'description_quality': 0.12,
|
|
|
|
|
- 'image_quality': 0.20
|
|
|
|
|
|
|
+ 'mandatory_fields': 0.25,
|
|
|
|
|
+ 'standardization': 0.00,
|
|
|
|
|
+ 'missing_values': 0.00,
|
|
|
|
|
+ 'consistency': 0.00,
|
|
|
|
|
+ 'seo_discoverability': 0.00,
|
|
|
|
|
+ 'content_rules_compliance': 0.00,
|
|
|
|
|
+ 'title_quality': 0.15,
|
|
|
|
|
+ 'description_quality': 0.25,
|
|
|
|
|
+ 'image_quality': 0.35
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
def score_product(
|
|
def score_product(
|
|
@@ -783,9 +796,14 @@ class AttributeQualityScorer:
|
|
|
component_status['image_quality'] = "Image scorer not available"
|
|
component_status['image_quality'] = "Image scorer not available"
|
|
|
|
|
|
|
|
# --- Final Score Calculation: use only numeric scores ---
|
|
# --- Final Score Calculation: use only numeric scores ---
|
|
|
|
|
+ print(scores.items())
|
|
|
numeric_scores = {k: v for k, v in scores.items() if isinstance(v, (int, float))}
|
|
numeric_scores = {k: v for k, v in scores.items() if isinstance(v, (int, float))}
|
|
|
|
|
+ print("numeric score is")
|
|
|
|
|
+ print(numeric_scores)
|
|
|
applicable_weights = {k: self.weights[k] for k in numeric_scores}
|
|
applicable_weights = {k: self.weights[k] for k in numeric_scores}
|
|
|
|
|
+
|
|
|
total_weight = sum(applicable_weights.values())
|
|
total_weight = sum(applicable_weights.values())
|
|
|
|
|
+ print(f"total sum taking wt in consideration is: {total_weight}")
|
|
|
if numeric_scores and total_weight > 0:
|
|
if numeric_scores and total_weight > 0:
|
|
|
final_score = sum(numeric_scores[k] * (applicable_weights[k] / total_weight) for k in numeric_scores)
|
|
final_score = sum(numeric_scores[k] * (applicable_weights[k] / total_weight) for k in numeric_scores)
|
|
|
else:
|
|
else:
|