use crate::rules::artificial_passive::{
evaluate_artificial_passive_fast, evaluate_redundant_beneficiary_passive,
};
use crate::rules::aspect::evaluate_aspect_mechanics;
use crate::rules::bureaucracy::evaluate_bureaucratic_rules;
use crate::rules::cliche::{
evaluate_ai_opening_cliche, evaluate_ai_summary_tail, evaluate_discovered_ai_cliches,
evaluate_formulaic_metaphor,
};
use crate::rules::concessive::{
evaluate_concessive_inversion, evaluate_factual_concessive_misuse,
evaluate_hypothetical_concessive_misuse,
};
use crate::rules::lexical::{evaluate_superlative_misuse, evaluate_suyt_nua_thi};
use crate::rules::pleonasm::evaluate_logical_pleonasm;
use crate::rules::syntax::{
evaluate_syntax_cliche, evaluate_syntax_parallel, evaluate_syntax_reporting,
};
use crate::rules::topic_comment::{
evaluate_crippled_prepositional_topic, evaluate_preposition_conjunction_conflict,
};
use crate::rules::translationese::{
evaluate_dummy_it_translationese, evaluate_nominalization_heavy, evaluate_temporal_framing,
evaluate_translationese_soleil,
};
use crate::types::Finding;
pub fn audit_linguistics(text: &str) -> Vec<Finding> {
let mut all_findings = Vec::new();
all_findings.extend(evaluate_artificial_passive_fast(text));
all_findings.extend(evaluate_redundant_beneficiary_passive(text));
all_findings.extend(evaluate_crippled_prepositional_topic(text));
all_findings.extend(evaluate_preposition_conjunction_conflict(text));
all_findings.extend(evaluate_logical_pleonasm(text));
all_findings.extend(evaluate_nominalization_heavy(text));
all_findings.extend(evaluate_temporal_framing(text));
all_findings.extend(evaluate_translationese_soleil(text));
all_findings.extend(evaluate_dummy_it_translationese(text));
all_findings.extend(evaluate_factual_concessive_misuse(text));
all_findings.extend(evaluate_hypothetical_concessive_misuse(text));
all_findings.extend(evaluate_concessive_inversion(text));
all_findings.extend(evaluate_aspect_mechanics(text));
all_findings.extend(evaluate_syntax_reporting(text));
all_findings.extend(evaluate_syntax_parallel(text));
all_findings.extend(evaluate_syntax_cliche(text));
all_findings.extend(evaluate_superlative_misuse(text));
all_findings.extend(evaluate_suyt_nua_thi(text));
all_findings.extend(evaluate_ai_opening_cliche(text));
all_findings.extend(evaluate_ai_summary_tail(text));
all_findings.extend(evaluate_formulaic_metaphor(text));
all_findings.extend(evaluate_discovered_ai_cliches(text));
all_findings.extend(evaluate_bureaucratic_rules(text));
all_findings.sort_by(|a, b| a.start.cmp(&b.start).then_with(|| a.end.cmp(&b.end)));
all_findings
}
#[cfg(test)]
mod tests {
use super::*;
#[test]
fn test_audit_linguistics_multiple_findings() {
let text = "Trong tình hình hiện nay đòi hỏi giải pháp tối ưu nhất được triển khai bởi nhóm.";
let findings = audit_linguistics(text);
assert!(findings.len() >= 3);
let ids: Vec<&str> = findings.iter().map(|f| f.pattern_id.as_str()).collect();
assert!(ids.contains(&"CRIPPLED_PREPOSITIONAL_TOPIC"));
assert!(ids.contains(&"LOGICAL_PLEONASM"));
assert!(ids.contains(&"ARTIFICIAL_PASSIVE_BE_BY"));
}
#[test]
fn test_audit_linguistics_all_categories() {
let text = "Không thể phủ nhận rằng ngày mai, tuy trời mưa nhưng dự án đã và đang là chiếc chìa khóa vạn năng.";
let findings = audit_linguistics(text);
let ids: Vec<&str> = findings.iter().map(|f| f.pattern_id.as_str()).collect();
assert!(ids.contains(&"AI_OPENING_CLICHE"));
assert!(ids.contains(&"FACTUAL_CONCESSIVE_MISUSE"));
assert!(ids.contains(&"CXH_VERBAL_SERIES_TENSE_FALSE_MARKER"));
assert!(ids.contains(&"FORMULAIC_METAPHOR"));
}
#[test]
fn test_audit_linguistics_bureaucracy_and_dummy_it() {
let text = "Nó là rất quan trọng để tiến hành thực hiện phương án mang tính chất đột phá này.";
let findings = audit_linguistics(text);
let ids: Vec<&str> = findings.iter().map(|f| f.pattern_id.as_str()).collect();
assert!(ids.contains(&"DUMMY_IT_TRANSLATIONESE"));
assert!(ids.contains(&"BUREAUCRATIC_VERB_PADDING"));
assert!(ids.contains(&"ADJECTIVAL_SUFFIX_FAKE"));
}
}