use webpage_quality_analyzer::metrics::*;
fn main() {
println!("🔬 Profile-Aware Scoring Validation");
println!("=====================================");
let all_metrics = get_all_metrics();
println!("📊 Loaded {} metrics from registry", all_metrics.len());
let word_count_scorer = WordCountScorer;
let test_word_count = MetricValue::Usize(1000);
let content_article_config = ProfileMetricConfig {
weight: 0.3,
enabled: true,
thresholds: ThresholdSet {
excellent: 2000.0, good: 1000.0,
fair: 500.0,
poor: 200.0,
},
penalty_multiplier: 1.0,
bonus_conditions: Vec::new(),
scoring_function_override: None,
};
let product_config = ProfileMetricConfig {
weight: 0.15,
enabled: true,
thresholds: ThresholdSet {
excellent: 500.0, good: 300.0,
fair: 150.0,
poor: 50.0,
},
penalty_multiplier: 1.0,
bonus_conditions: Vec::new(),
scoring_function_override: None,
};
let news_config = ProfileMetricConfig {
weight: 0.25,
enabled: true,
thresholds: ThresholdSet {
excellent: 800.0,
good: 500.0,
fair: 300.0,
poor: 100.0,
},
penalty_multiplier: 1.0,
bonus_conditions: Vec::new(),
scoring_function_override: None,
};
let content_score =
word_count_scorer.score_metric(test_word_count.clone(), &content_article_config);
let product_score = word_count_scorer.score_metric(test_word_count.clone(), &product_config);
let news_score = word_count_scorer.score_metric(test_word_count, &news_config);
println!("\n📝 Word Count Scoring (1000 words):");
println!("Content Article Profile: {:.1} points", content_score);
println!("Product Page Profile: {:.1} points", product_score);
println!("News Page Profile: {:.1} points", news_score);
let scores_are_different = content_score != product_score || product_score != news_score;
if scores_are_different {
println!("\n✅ SUCCESS: Profile-aware scoring is working!");
println!("Different profiles produce different scores for the same content.");
println!("\n🎯 Scoring Logic:");
println!("- Content articles favor longer content (excellent ≥ 2000 words)");
println!("- Product pages favor concise content (excellent ≥ 500 words)");
println!("- News articles use balanced thresholds (excellent ≥ 800 words)");
println!("\nWith 1000 words:");
println!("- Content: Below excellent threshold → moderate score");
println!("- Product: Well above excellent threshold → high score");
println!("- News: Above excellent threshold → high score");
} else {
println!("\n❌ ISSUE: All profiles produced the same score!");
println!("This suggests profile-aware scoring may not be fully implemented.");
}
println!("\n📈 Registry Statistics:");
let categories: std::collections::HashSet<_> =
all_metrics.iter().map(|m| &m.category).collect();
println!("- Total metrics: {}", all_metrics.len());
println!("- Categories: {}", categories.len());
println!(
"- Enabled by default: {}",
all_metrics.iter().filter(|m| m.default_enabled).count()
);
println!("\n🏁 Phase 1 Enhanced Metric Registry validation complete!");
}