import json from typing import Dict, List, TypedDict from .config import Config class Intents(TypedDict): name_query: List[str] class NaturalLanguageProcessor: def __init__(self, config: Config): with config.data_path.open('r', encoding='utf-8') as file: self.intents: Intents = json.load(file) def analyze(self, input_text: str) -> str: lower_text = input_text.lower() for intent, phrases in self.intents.items(): if any(phrase in lower_text for phrase in phrases): return intent return "unknown"