Add gazetteer configuration and dependency
This commit introduces the `VOCAB_DIR` configuration option, which specifies the directory for gazetteer files. It also adds the `strsim` crate, which is used for calculating string similarity and is essential for the gazetteer's functionality. The gazetteer module has been significantly expanded to include the `Gazetteer` struct, its loading mechanism from `.txt` files, and an annotation function. This functionality allows for pre-LLM correction of proper names and technical vocabulary by identifying potential misspellings based on phonetic similarity and edit distance.
This commit is contained in:
@@ -58,6 +58,10 @@ pub struct Config {
|
||||
/// or empty. Runtime-configurable so admins can iterate and use the
|
||||
/// "Neu analysieren" button to re-run cases.
|
||||
pub llm_system_prompt: String,
|
||||
/// Directory containing gazetteer `*.txt` files (anatomy, substances,
|
||||
/// medications). Loaded once at startup; a missing directory is a
|
||||
/// non-fatal WARN — analysis runs without proper-name correction.
|
||||
pub vocab_dir: PathBuf,
|
||||
pub session_timeout_hours: u32,
|
||||
/// Whether to set the `Secure` flag on the session cookie. Default `true`.
|
||||
/// Set `COOKIE_SECURE=false` only for plain-HTTP local development —
|
||||
@@ -100,6 +104,7 @@ impl Config {
|
||||
v
|
||||
}
|
||||
},
|
||||
vocab_dir: PathBuf::from(optional_env("VOCAB_DIR", "./vocab")),
|
||||
session_timeout_hours: optional_env_parsed("SESSION_TIMEOUT_HOURS", 8),
|
||||
cookie_secure: optional_env_parsed("COOKIE_SECURE", true),
|
||||
}
|
||||
@@ -152,6 +157,7 @@ impl Config {
|
||||
llm_temperature: 0.0,
|
||||
llm_timeout_seconds: 180,
|
||||
llm_system_prompt: crate::analyze::prompt::SYSTEM_PROMPT.to_string(),
|
||||
vocab_dir: PathBuf::new(),
|
||||
session_timeout_hours: 8,
|
||||
cookie_secure: false,
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user