use std::sync::LazyLock;
use super::Language;
use super::language::continues_after_boundary;
#[derive(Debug, Clone)]
pub struct German {}
static GERMAN_ABBREVIATIONS: LazyLock<Vec<String>> = LazyLock::new(|| {
include_str!("./abbrev/de.txt")
.lines()
.chain(include_str!("./abbrev/en.txt").lines())
.map(|line| line.trim().to_string())
.filter(|line| !line.starts_with("//") && !line.is_empty())
.collect()
});
const MONTHS: [&str; 12] = [
"Januar",
"Februar",
"März",
"April",
"Mai",
"Juni",
"Juli",
"August",
"September",
"Oktober",
"November",
"Dezember",
];
impl Language for German {
fn get_abbreviations(&self) -> &[String] {
&GERMAN_ABBREVIATIONS
}
fn continue_in_next_word(&self, text_after_boundary: &str) -> bool {
continues_after_boundary(text_after_boundary, &MONTHS)
}
}
#[cfg(test)]
mod tests {
use crate::languages::tests::run_language_tests;
use super::*;
#[test]
fn test_segment() {
run_language_tests(German {}, "tests/de.txt");
}
}