diff --git a/data/configs/abgb.toml b/data/configs/abgb.toml index 98a9c69..9bcadba 100644 --- a/data/configs/abgb.toml +++ b/data/configs/abgb.toml @@ -4,8 +4,14 @@ id = 10001622 [[law.classifiers]] name = "Theil" is_root = true +#match_function = "containsCaseSensitive" match_function = "contains" +#[[law.classifiers]] +#name = "Abtheilung" +#is_root = false +#match_function = "contains" + [[law.classifiers]] name = "Hauptstück" is_root = false diff --git a/src/config.rs b/src/config.rs index 7f792c6..951c61d 100644 --- a/src/config.rs +++ b/src/config.rs @@ -12,6 +12,7 @@ use crate::paragraph::Parser; fn create_classifier(match_function: &str) -> Result { let func: ClassifierApplicable = match match_function { "contains" => Arc::new(contains), + "containsCaseSensitive" => Arc::new(contains_case_sensitive), "starts_with_roman_number" => Arc::new(starts_with_roman_number), "contains_at_start" => Arc::new(contains_at_start), "starts_with_number" => Arc::new(starts_with_number), diff --git a/src/law/responsible.rs b/src/law/responsible.rs index dc1643b..c3a8279 100644 --- a/src/law/responsible.rs +++ b/src/law/responsible.rs @@ -11,6 +11,10 @@ pub fn contains(classifier_name: &str, instance_name: &str) -> bool { .contains(&classifier_name.to_lowercase()) } +pub fn contains_case_sensitive(classifier_name: &str, instance_name: &str) -> bool { + instance_name.contains(&classifier_name) +} + pub fn starts_with_roman_number(_: &str, s: &str) -> bool { // Define the prefixes for Roman numerals. let roman_prefixes = [