improv abgb
All checks were successful
CI/CD Pipeline / test (push) Successful in 1m34s

This commit is contained in:
philipp 2024-02-06 13:20:38 +01:00
parent 4cc684ea91
commit d0ba9f53db
3 changed files with 11 additions and 0 deletions

View File

@ -4,8 +4,14 @@ id = 10001622
[[law.classifiers]] [[law.classifiers]]
name = "Theil" name = "Theil"
is_root = true is_root = true
#match_function = "containsCaseSensitive"
match_function = "contains" match_function = "contains"
#[[law.classifiers]]
#name = "Abtheilung"
#is_root = false
#match_function = "contains"
[[law.classifiers]] [[law.classifiers]]
name = "Hauptstück" name = "Hauptstück"
is_root = false is_root = false

View File

@ -12,6 +12,7 @@ use crate::paragraph::Parser;
fn create_classifier(match_function: &str) -> Result<ClassifierApplicable, Error> { fn create_classifier(match_function: &str) -> Result<ClassifierApplicable, Error> {
let func: ClassifierApplicable = match match_function { let func: ClassifierApplicable = match match_function {
"contains" => Arc::new(contains), "contains" => Arc::new(contains),
"containsCaseSensitive" => Arc::new(contains_case_sensitive),
"starts_with_roman_number" => Arc::new(starts_with_roman_number), "starts_with_roman_number" => Arc::new(starts_with_roman_number),
"contains_at_start" => Arc::new(contains_at_start), "contains_at_start" => Arc::new(contains_at_start),
"starts_with_number" => Arc::new(starts_with_number), "starts_with_number" => Arc::new(starts_with_number),

View File

@ -11,6 +11,10 @@ pub fn contains(classifier_name: &str, instance_name: &str) -> bool {
.contains(&classifier_name.to_lowercase()) .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 { pub fn starts_with_roman_number(_: &str, s: &str) -> bool {
// Define the prefixes for Roman numerals. // Define the prefixes for Roman numerals.
let roman_prefixes = [ let roman_prefixes = [